无论是 NAT,还是 CIDR 等都是缓解 IP 地址短缺的手段,而 IPv6 才是解决地址短缺的最终方法。IPv6 是由 IETF 设计的下一代互联网协议,目的是取代现有的互联网协议 IPv4。
IPv4 的设计思想成功地造就了目前的国际互联网,其核心价值体现在简单、灵活和开放性。但随着新应用的不断涌现,传统的 IPv4 协议已经难以支持互联网的进一步扩张和新业务的特性,比如实时应用和服务质量保证等。IPv6 能够解决 IPv4 存在的许多问题,如地址短缺、服务质量保证等。同时,IPv6 还对 IPv4 作了大量的改进,包括路由和网络自动配置等。IPv6 和 IPv4 将在过渡期内共存几年,并由 IPv6 渐渐取代 IPv4。
IPv6静态路由配置:
由此我们学习启用 IPv6 流量转发,配置IPv6地址和设备的调试。
拓扑图:
实验基础配置
R1(config)#ipv6 unicast-routing
//启用IPv6流量转发
R1(config)#interface lo0
R1(config-if)#ipv6 address 2020:AAAA::1/64
//配置ipv6地址
R1(config-if)#exit
R1(config)#interface s2/0
R1(config-if)#ipv6 address 2019:BBBB::1/64
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#ipv6 route 2020:DDDD::1/64 s2/0
//配置ipv6静态路由
R2(config)#ipv6 unicast-routing
R2(config)#interface lo0
R2(config-if)#ipv6 address 2020:DDDD::1/64
R2(config-if)#exit
R2(config)#interface s2/0
R2(config-if)#ipv6 address 2019:BBBB::2/64
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#ipv6 route ::/0 s2/0
//配置ipv6默认路由
配置完成,我们查看实验现象。
R2#ping ipv6 2020:AAAA::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2020:AAAA::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/23/32 ms
R2#
Ping成功,证明我们的静态路由配置成功!
查看IPv6路由表。
R1#show ipv6 route
IPv6 Routing Table - default - 6 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, la - LISP alt
lr - LISP site-registrations, ld - LISP dyn-eid, a - Application
C 2019:BBBB::/64 [0/0]
via Serial2/0, directly connected
L 2019:BBBB::1/128 [0/0]
via Serial2/0, receive
C 2020:AAAA::/64 [0/0]
via Loopback0, directly connected
L 2020:AAAA::1/128 [0/0]
via Loopback0, receive
S 2020:DDDD::/64 [1/0]
via Serial2/0, directly connected
L FF00::/8 [0/0]
via Null0, receive
R2#show ipv6 route
IPv6 Routing Table - default - 6 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, la - LISP alt
lr - LISP site-registrations, ld - LISP dyn-eid, a - Application
S ::/0 [1/0]
via Serial2/0, directly connected
C 2019:BBBB::/64 [0/0]
via Serial2/0, directly connected
L 2019:BBBB::2/128 [0/0]
via Serial2/0, receive
C 2020:DDDD::/64 [0/0]
via Loopback0, directly connected
L 2020:DDDD::1/128 [0/0]
via Loopback0, receive
L FF00::/8 [0/0]
via Null0, receive
以上输出表明路由器 R1 上有一条 IPv6 的静态路由,R2 上有一条 IPv6 的默认路由,IPv6中的默认路由是没有“*”的。