实验21:IPv6

九、IPv6

1、IPv6(RIP)

实验目的:熟悉IPv6的配置,并经过动态路由协议RIP,使三台路由器相互通讯
设备需求:3640三台
实验过程:

xdbr_R1#sh run
ipv6 unicast-routing *开户路由器的IPv6功能
!
interface Loopback0
 no ip address
 ipv6 address 1111:AAAA::A/64 *配置IPV6地址
 ipv6 rip ccna enable *在接口下调用RIP进程,其中调用的名字一定要和RIP进程下一样
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 2009:12::C/64 *配置IPv6地址
 ipv6 rip ccna enable *在接口下调用RIP进程,其中调用的名字一定要和RIP进程下一样
!
ipv6 router rip ccna *全局模式下开户IPV6的RIP进程,后面的名字为任意,本地有效
xdbr_R2#sh run
hostname xdbr_R2
!
ipv6 unicast-routing
!
interface Loopback0
 no ip address
 ipv6 address 2222:BBBB::B/64
 ipv6 rip ccnp enable *所有路由器,只要起了IPV6的,都要调用RIP进程,才能通告接口
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 2009:12::D/64
 ipv6 rip ccnp enable
!
interface FastEthernet1/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 2007:23::E/64
 ipv6 rip ccnp enable
ipv6 router rip ccnp *本地有效

xdbr_R3#sh run
ipv6 unicast-routing
!
interface Loopback0
 no ip address
 ipv6 address 3333:CCCC::C/64
 ipv6 rip ccie enable
!
interface FastEthernet1/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 2007:23::F/64
 ipv6 rip ccie enable
!
ipv6 router rip ccie *本地有效

查看路由学习情况:
xdbr_R3#sh ipv6 route        
IPv6 Routing Table - 9 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
       U - Per-user Static route
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R   1111:AAAA::/64 [120/3] *经过f1/0 学到的R1环回口的地址
     via FE80::CE01:8FF:FE64:10, FastEthernet1/0
C   2007:23::/64 [0/0] *直连接口
     via ::, FastEthernet1/0
L   2007:23::F/128 [0/0] *本地链路
     via ::, FastEthernet1/0
R   2009:12::/64 [120/2]
     via FE80::CE01:8FF:FE64:10, FastEthernet1/0
R   2222:BBBB::/64 [120/2]
     via FE80::CE01:8FF:FE64:10, FastEthernet1/0
C   3333:CCCC::/64 [0/0]
     via ::, Loopback0
L   3333:CCCC::C/128 [0/0]
     via ::, Loopback0
L   FE80::/10 [0/0] *link-local地址
     via ::, Null0
L   FF00::/8 [0/0]
     via ::, Null0

xdbr_R3#ping ipv6 1111:AAAA::A *ping测试到xdbr_R1的连通性

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1111:AAAA::A, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/34/96 ms

xdbr_R3#ping ipv6 2222:BBBB::B *ping测试到xdbr_R2的连通性

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2222:BBBB::B, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/15/44 ms


2、IPv6(OSPF)

实验目的:熟悉IPv6的配置,并经过动态路由协议OSPF,使三台路由器相互通讯
设备需求:3640三台
实验过程:

 注意:OSPF与RIP,调用方式不一样
xdbr_R1#sh run
ipv6 unicast-routing  *开户路由器的IPv6功能

interface Loopback0
 no ip address
 ipv6 address 1111:AAAA::A/64
 ipv6 ospf 1 area 1 *此接口运行OSPF并且在区域1
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 2009:12::C/64
 ipv6 ospf 1 area 0 *此接口运行OSPF并且在区域0
!
ipv6 router ospf 1 *开启IPV6的OSPF进程
 router-id 1.1.1.1 *手动配置Router-ID或者再起个环回口,随便配置个IPV4地址
 log-adjacency-changes
!

xdbr_R2#sh run
Building configuration...

hostname xdbr_R2
!
ipv6 unicast-routing
!
interface Loopback0
 no ip address
 ipv6 address 2222:BBBB::B/64
 ipv6 ospf 1 area 2 *此接口运行OSPF并且在区域2
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 2009:12::D/64
 ipv6 ospf 1 area 0 *此接口运行OSPF并且在区域0
!
interface FastEthernet1/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 2007:23::E/64
 ipv6 ospf 1 area 0
!
ipv6 router ospf 1
 router-id 2.2.2.2 *手动指定的Router-ID
 log-adjacency-changes
!

xdbr_R3#sh run
!
hostname xdbr_R3
!
ipv6 unicast-routing*开户路由器的IPv6功能
!
interface Loopback0
 no ip address
 ipv6 address 3333:CCCC::C/64
 ipv6 ospf 1 area 3*此接口运行OSPF并且在区域3
!!
interface FastEthernet1/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 2007:23::F/64
 ipv6 ospf 1 area 0*此接口运行OSPF并且在区域0
!
ipv6 router ospf 1
 router-id 3.3.3.3 *手动配置的Router-ID
 log-adjacency-changes
!
xdbr_R3#sh ipv6 route
IPv6 Routing Table - 9 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
       U - Per-user Static route
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
OI  1111:AAAA::A/128 [110/2] *学来的域间路由
     via FE80::CE01:8FF:FE64:10, FastEthernet1/0
C   2007:23::/64 [0/0]*直连接口
     via ::, FastEthernet1/0
L   2007:23::F/128 [0/0] *本地链路
     via ::, FastEthernet1/0
O   2009:12::/64 [110/2] *学来的域内路由
     via FE80::CE01:8FF:FE64:10, FastEthernet1/0
OI  2222:BBBB::B/128 [110/1] *学来的域间路由
     via FE80::CE01:8FF:FE64:10, FastEthernet1/0
C   3333:CCCC::/64 [0/0]
     via ::, Loopback0
L   3333:CCCC::C/128 [0/0]
     via ::, Loopback0
L   FE80::/10 [0/0]
     via ::, Null0
L   FF00::/8 [0/0]
     via ::, Null0
xdbr_R3#ping ipv6 1111:AAAA::A *ping测试到xdbr_R1的连通性

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1111:AAAA::A, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/34/96 ms

xdbr_R3#ping ipv6 2222:BBBB::B *ping测试到xdbr_R2的连通性

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2222:BBBB::B, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/15/44 ms

xdbr_R2#sh ipv6 ospf neighbor

Neighbor ID  Pri   State         Dead Time   Interface ID    Interface
3.3.3.3        1   FULL/DR      00:00:34    5               FastEthernet1/0
1.1.1.1        1   FULL/DR      00:00:32    4               FastEthernet0/0

3、IPv6(6to4)

现在IPv6还没有普及,只有小部分地区在实施,那么就存在6与4通讯的问题,单纯的6to4可以用翻译,这就你举6-4-6的一种拓扑环境
实验目的:让两边的V6网络通过公网V4进行通讯
实验需求:5台C3640
实验过程:

由于R1与R5最简单,先做它们
R1:
R1(config)#ipv6 unicast-routing
R1(config)#int f0/0
R1(config-if)#ipv6 address 2008:101:202::1/64 *给此接口配置IPv6地址
R1(config-if)#no sh
R1(config)#ipv6 route ::/0 2008:101:202::2 *设置IPv6的默认路由

R5:
R5(config)#ipv6 unicast-routing
R5(config)#int f0/0
R5(config-if)#ipv6 address 2009:505:404::5/64 *给此接口配置IPv6地址
R5(config-if)#no sh
R5(config-if)#exit
R5(config)#ipv6 route ::/0 2009:505:404::4*设置IPv6的默认路由
R2:
R2(config)#ipv6 unicast-routing
R2(config)#int f0/0
R2(config-if)#ipv6 address 2008:101:202::2/64
R2(config-if)#no sh
R2#int s2/0
R2(config-if)#ip add 23.1.1.2 255.255.255.0 *再配置一个ipv4的地址,连接ipv4公网
R2(config-if)#no sh
R2(config-if)#int lo 0
R2(config-if)#ip add 2.2.2.2 255.255.255.0 *给ospf做Router-ID
R2(config-if)#end
R2(config)#router os 1 *开启IPv4的路由,让R2、R3、R4互通
R2(config-router)#net 23.1.1.0 0.0.0.255 a 0
R2(config-router)#net 2.2.2.0 0.0.0.255 a 0
*Mar  1 00:08:35.211: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on Serial2/0 from LOADING to FULL, Loading Done

R2(config)#interface tunnel 0 *开启一个隧道口,用来给IPv6做下一跳
R2(config-if)#ipv6 address 2002:202:202::2/64 *给它配置一个IPv6的地址,不能用IPv4
R2(config-if)#tunnel source s2/0 *指定这个隧道从哪个口进(是IPv4地址)
R2(config-if)#tunnel destination 34.1.1.4*指定这个隧道从哪个口出(是IPv4地址)
R2(config-if)#tunnel mode ipv6ip *设置隧道的模式为:IPv6 Over IP
R2(config-if)#end
R2(config)#ipv6 router ospf 1 *开启IPv6的OSPF 进程,此进程与IPv4毫不相干
R2(config)#int tunnel 0
R2(config-if)#ipv6 ospf 1 area 0 *运行了IPv6的接口调用IPv6 OSPF进程
R2(config-if)#int f0/0
R2(config-if)#ipv6 ospf 1 area 0 *运行了IPv6的接口调用IPv6 OSPF进程
R3:
R3(config)#int s2/0
R3(config-if)#ip add 23.1.1.3 255.255.255.0
R3(config-if)#no sh
R3(config)#int lo 0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#int s2/1
R3(config-if)#ip add 34.1.1.3 255.255.255.0
R3(config-if)#no sh
R3(config)#router os 1
R3(config-router)#net 0.0.0.0 0.0.0.0 a 0
R3(config-router)#end *R3最简单,两个WAN口配置好IPv4地址,全网发到ospf中
R4:
R4(config)#int lo 0 *与R2批注基本上一样,只是tunnel源和目的正好相反
R4(config-if)#ip add 4.4.4.4 255.255.255.0
R4(config-if)#int s2/1
R4(config-if)#ip add 34.1.1.4 255.255.255.0
R4(config-if)#no sh
R4(config)#router ospf 1
R4(config-router)#network  34.1.1.0 0.0.0.255 a 0
R4(config-router)#network  4.4.4.0 0.0.0.255 a 0  
R4(config)#interface tunnel 0
R4(config-if)#ipv6 address 2002:202:202::4/64
R4(config-if)#tunnel source s2/1
R4(config-if)#tunnel destination 23.1.1.2
R4(config-if)#tunnel mode ipv6ip
R4(config-if)#exi
R4(config)#ipv6 router ospf 1 *因为没有开启路由器的IPv6功能,所以报错
% IPv6 routing not enabled
R4(config)#ipv6 unicast-routing
R4(config)#ipv6 router ospf 1
R4(config-rtr)#exi
R4(config)#int f0/0
R4(config-if)#ipv6 ospf 1 area 0
OSPFv3: No IPV6 enabled on this interface *报错的原因是没有给此接口配置IPv6地址
R4(config-if)#int tu 0
R4(config-if)#ipv6 ospf 1 area 0
R4(config-if)#int f0/0
R4(config-if)#ipv6 address 2009:505:404::4/64
R4(config-if)#no sh
R4(config-if)#ipv6 ospf 1 area 0

R2#sh ip route *查看IPv4的路由表R2与R4通讯没有问题

     34.0.0.0/24 is subnetted, 1 subnets
O       34.1.1.0 [110/128] via 23.1.1.3, 00:34:33, Serial2/0 *R2到R4的路由已经学到
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/65] via 23.1.1.3, 00:34:33, Serial2/0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/129] via 23.1.1.3, 00:34:33, Serial2/0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, Serial2/0
R2#sh ipv6 route
IPv6 Routing Table - 7 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
       U - Per-user Static route
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
C   2002:202:202::/64 [0/0]
     via ::, Tunnel0
L   2002:202:202::2/128 [0/0]
     via ::, Tunnel0
C   2008:101:202::/64 [0/0]
     via ::, FastEthernet0/0
L   2008:101:202::2/128 [0/0]
     via ::, FastEthernet0/0
O   2009:505:404::/64 [110/11112] *到R5的路由也学到,并且是IPV6的路由
     via FE80::2201:104, Tunnel0 *tunnel 是用来做下一跳的
L   FE80::/10 [0/0]
     via ::, Null0
L   FF00::/8 [0/0]
     via ::, Null0
R1#p 2009:505:404::5 *从R5到R1做测试

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2009:505:404::5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/52/84 ms
R5#ping ipv6 2008:101:202::1*从R1到R5做测试


Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2008:101:202::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/32/72 ms
批注:此问题最终可以简化为R2与R4是直连的,然后后面各带一个IPv6的网段,在R2与R4上各运行一个IPv6的路由协议(动态或静态),使其能相互通讯,在此例子中,使它们感觉是”直连”的就靠那个“tunnel”来实现了,中间的R3代表IPv4的公网,即很多台运行了IPv4的路由器.

原文地址:https://www.cnblogs.com/zhongguiyao/p/8012409.html