1、掌握基本的 IPv6 的配置方法。
2、掌握基于 IPv6 的静态路由及路由总结配置。
用3640IOS做IPv6的实验搞不通,这里用的是:C7200-AD.124-15.T3.bin
网络图:
配置三台路由器的IPv6地址如下:
R1(config)#ipv6 unicast-routing ------->启用IPv6路由功能
R1(config)#int lo0
R1(config-if)#ipv6 add 2001:ab1:0:8::1/64 ---->在IPv6网络中,一个接口可以有多个IPv6网段地址所以在这里
R1(config-if)#ipv6 add 2001:ab1:0:9::1/64 配置其它地址不像IPv4一样要使用secondary关键字
R1(config-if)#ipv6 add 2001:ab1:0:a::1/64
R1(config-if)#ipv6 add 2001:ab1:0:b::1/64
R1(config-if)#ipv6 add 2001:ab1:0:c::1/64
R1(config-if)#exit
R1(config)#int s0/0
R1(config-if)#ipv6 add 2001:ab1:0:2::1/64
R1(config-if)#no sh
R1(config-if)#end
R2(config)#ipv6 unicast
R2(config)#int s0/0
R2(config-if)#ipv6 add 2001:ab1:0:2::2/64
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#int s0/1
R2(config-if)#ipv6 add 2001:ab1:0:3::1/64
R2(config-if)#no sh
R2(config-if)#end
R3(config)#int s0/0
R3(config-if)#ipv6 add 2001:ab1:0:3::2/64
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#int lo0
R3(config-if)#ipv6 add 2001:ab1:0:4::1/64
R3(config-if)#exit
在R2上测试连通性:
R2#ping 2001:ab1:0:2::1 ----->测试R1的连接
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:AB1:0:2::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/18/52 ms
R2#ping 2001:ab1:0:3::2 ----->测试R2的连接
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:AB1:0:3::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/20/56 ms
测试结果正常。
查看R1的路由表:
R1#show ipv6 route ---->查看IPv6路由表
IPv6 Routing Table - 13 entries
C 2001:AB1:0:2::/64 [0/0]
via ::, Serial1/0 ------>C关键字前缀指出本地连接的网段
L 2001:AB1:0:2::1/128 [0/0]
via ::, Serial1/0 ------>L关键字前缀指出本地直接主机地址
C 2001:AB1:0:8::/64 [0/0]
via ::, Loopback0
L 2001:AB1:0:8::1/128 [0/0]
via ::, Loopback0
C 2001:AB1:0:9::/64 [0/0]
via ::, Loopback0
L 2001:AB1:0:9::1/128 [0/0]
via ::, Loopback0
C 2001:AB1:0:A::/64 [0/0]
via ::, Loopback0
L 2001:AB1:0:A::1/128 [0/0]
via ::, Loopback0
C 2001:AB1:0:B::/64 [0/0]
via ::, Loopback0
L 2001:AB1:0:B::1/128 [0/0]
via ::, Loopback0
C 2001:AB1:0:C::/64 [0/0]
via ::, Loopback0
L 2001:AB1:0:C::1/128 [0/0]
via ::, Loopback0
L FF00::/8 [0/0]
via ::, Null0 ------->多播地址
查看R1的IPv6接口信息:
R1#show ipv6 int bri
FastEthernet0/0 [administratively down/down]
Serial1/0 [up/up]
FE80::C800:CFF:FE34:0 ---->FE80地址前缀为链路本地单播地址,其主要用于OSPF等路由
2001:AB1:0:2::1 协议更新时作为其更新源地址
Serial1/1 [administratively down/down]
Serial1/2 [administratively down/down]
Serial1/3 [administratively down/down]
Serial1/4 [administratively down/down]
Serial1/5 [administratively down/down]
Serial1/6 [administratively down/down]
Serial1/7 [administratively down/down]
Loopback0 [up/up]
FE80::C800:CFF:FE34:0 ---->和上面那个是一样的
2001:AB1:0:8::1
2001:AB1:0:9::1
2001:AB1:0:A::1
2001:AB1:0:B::1
2001:AB1:0:C::1
在所有路由上配置到其它非直边网络的静态路由,配置如下:
R1(config)#ipv6 route 2001:ab1:0:3::/64 2001:ab1:0:2::2
R1(config)#ipv6 route 2001:ab1:0:4::/64 2001:ab1:0:2::2 ---->IPv6静态路由配置和IPv4类似,解释也是一样的
R2(config)#ipv6 route 2001:ab1:0:4::/64 2001:ab1:0:3::2 ---->到达R3回环口的路由
R2(config)#ipv6 route 2001:ab1:0:8::/62 2001:ab1:0:2::1 ---->到达R1回环口的可汇总路由
R2(config)#ipv6 route 2001:ab1:0:c::/64 2001:ab1:0:2::1 ---->到达R1回环口的不可汇总路由
R3(config)#ipv6 route ::/0 2001:ab1:0:3::1 ---->默认路由,简化配置
IPv6网络的子网汇总与IPv4类似,不同的是一个IPv6的地址字符为16进制,用二进制表示需要4位,所以每缩减IPv6的一个字符,对应的二进制为4位,如下表所示,即针对R1路由器的回环口汇总方法,总的还是要找相同的网络前缀:
2001:AB1:0:8::1 -> 2001:AB1:0: 0000 0000 0000 1000::1
2001:AB1:0:9::1 -> 2001:AB1:0: 0000 0000 0000 1001::1
2001:AB1:0:A::1 -> 2001:AB1:0: 0000 0000 0000 1010::1 2001:AB1:0:8::/62
2001:AB1:0:B::1 -> 2001:AB1:0: 0000 0000 0000 1011::1
-----------------------------------------------------------------------------------
2001:AB1:0:C::1 -> 2001:AB1:0: 0000 0000 0000 1100::1 2001:AB1:0:C::/64
查看R2和R3路由表,确认静态路由配置:
R2#show ipv6 route
IPv6 Routing Table - 8 entries
C 2001:AB1:0:2::/64 [0/0]
via ::, Serial1/0
L 2001:AB1:0:2::2/128 [0/0]
via ::, Serial1/0
C 2001:AB1:0:3::/64 [0/0]
via ::, Serial1/1
L 2001:AB1:0:3::1/128 [0/0]
via ::, Serial1/1
S 2001:AB1:0:4::/64 [1/0]
via 2001:AB1:0:3::2
S 2001:AB1:0:8::/62 [1/0]
via 2001:AB1:0:2::1
S 2001:AB1:0:C::/64 [1/0]
via 2001:AB1:0:2::1 ----->管理距离是1的静态路由
L FF00::/8 [0/0]
via ::, Null0
R3#show ipv6 route
IPv6 Routing Table - 6 entries
S ::/0 [1/0]
via 2001:AB1:0:3::1 ----->默认路由
C 2001:AB1:0:3::/64 [0/0]
via ::, Serial1/0
L 2001:AB1:0:3::2/128 [0/0]
via ::, Serial1/0
C 2001:AB1:0:4::/64 [0/0]
via ::, Loopback0
L 2001:AB1:0:4::1/128 [0/0]
via ::, Loopback0
L FF00::/8 [0/0]
via ::, Null0
测试路由有效性:
R3#ping 2001:ab1:0:9::1 ------>通通通~
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:AB1:0:9::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/30/88 ms
R3#ping ----------->扩展测试方法
Protocol [ip]: ipv6
Target IPv6 address: 2001:ab1:0:c::1
Repeat count [5]: 20
Datagram size [100]: 1000
Timeout in seconds [2]: 1
Extended commands? [no]:
Sweep range of sizes? [no]:
Type escape sequence to abort.
Sending 20, 1000-byte ICMP Echos to 2001:AB1:0:C::1, timeout is 1 seconds:
!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (20/20), round-trip min/avg/max = 0/16/80 ms
在R1上:
R1# ping 2001:ab1:0:4::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:AB1:0:4::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/26/60 ms
一切顺利。