基于IPv6静态路由和默认路由的配置
实验环境:
实验背景:在路由器R1上配置3个环回接口IPv6地址,分别模拟三个不同的IPv6前缀,作为IPV6目标网络,然后,在路由器R2上为三个IPv6前缀配置静态路由,并检测其连通性,最后使用IPv6的默认路由替代静态路由条目。
第一步:为路由器R1和R2完成基础配置,包括启动IPv6和地址配置,并激活相关的接口,配置如下:
R1上的配置:
R1(config)#ipv6 unicast-routing //启动IPv6的路由功能,否则静态路由无法完成//
R1(config)#int f0/0 //进入f0/0接口
R1(config-if)#ipv6 add 2001:10::1/64 //为该接口配置IPv6地址
R1(config-if)#no sh
R1(config)#interface lo1
R1(config-if)#ipv6 add 2001:2::1/64
R1(config-if)#ex
R1(config)#int lo2
R1(config-if)#ipv6 add 2001:3::1/64
R1(config-if)#ex
R1(config)#int lo3
R1(config-if)#ipv6 add 2001:4::1/64
R1(config-if)#ex
R2上的配置:
R2(config)#ipv6 unicast-routing
R2(config)#int f0/0
R2(config-if)#ipv6 add 2001:10::2/64
R2(config-if)#no sh
第二步:在路由器R2上ping R1上的环回IPv6地址,结果为ping不通,因为在路由器R2上没有到目标地址的路由,关于这一技术知识点与IPv4的环境相同,要配置IPv6静态和默认路由功能类似于IPv4,但是书写形式还存在一定的区别,而默认路由是一种特殊的静态路由。
IPv6静态路由的格式:
ipv6 route 【目标IPv6前缀】 【出站接口】 【下一跳IPv6地址】
目标IPv6前缀:指示目标IPv6网络,这与IPv4的目标子网的意义相同。
出站接口:当前路由器转发数据包的出站接口,如果使用了邻接路由器的IPv6本地链路地址来作为下一跳地址,那么在静态路由的语法中必须包含出站接口关键字。
下一跳IPv6地址:要到达目标网络所要经历的下一跳路由器的IPv6地址,这与IPv4的环境相同。注意:根据RFC2461规定,路由器必须能够确定下一跳路由器的本地链路地址,所以,在配置IPv6静态路由时,下一跳地址建议配置为邻接路由器本地链路IPv6地址,在本次实验中,可以在R1上使用show ipv6 interface f0/0来查看:
R1#sho ipv6 int f0/0
FastEthernet0/0 is up, line protocol is up
IPv6 is enabled, link-local address is FE80::C800:1AFF:FE74:8
No Virtual link-local address(es):
Global unicast address(es):
2001:10::1, subnet is 2001:10::/64
Joined group address(es):
FF02::1
FF02::2
FF02::1:FF00:1
FF02::1:FF74:8
MTU is 1500 bytes
ICMP error messages limited to one every 100 milliseconds
ICMP redirects are enabled
ICMP unreachables are sent
ND DAD is enabled, number of DAD attempts: 1
ND reachable time is 30000 milliseconds (using 19434)
ND advertised reachable time is 0 (unspecified)
ND advertised retransmit interval is 0 (unspecified)
ND router advertisements are sent every 200 seconds
ND router advertisements live for 1800 seconds
ND advertised default router preference is Medium
Hosts use stateless autoconfig for addresses.
在R2上配置静态路由:
R2(config)#ipv6 route 2001:2::/64 f0/0 FE80::C800:1AFF:FE74:8
R2(config)#ipv6 route 2001:3::/64 f0/0 FE80::C800:1AFF:FE74:8
R2(config)#ipv6 route 2001:4::/64 f0/0 FE80::C800:1AFF:FE74:8
配置完成后,查看自己的路由表(show ipv6 route),可以看到被添加的三条静态路由,然后再次测试与目标网段进行通讯。
R2#sho ipv6 route
IPv6 Routing Table - Default - 6 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, M - MIPv6, R - RIP, I1 - ISIS L1
I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP
EX - EIGRP external
O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
S 2001:2::/64 [1/0]
via FE80::C800:1AFF:FE74:8, FastEthernet0/0 //被添加的
S 2001:3::/64 [1/0] 静态路由//
via FE80::C800:1AFF:FE74:8, FastEthernet0/0
S 2001:4::/64 [1/0]
via FE80::C800:1AFF:FE74:8, FastEthernet0/0
C 2001:10::/64 [0/0]
via FastEthernet0/0, directly connected
L 2001:10::2/128 [0/0]
via FastEthernet0/0, receive
L FF00::/8 [0/0]
via Null0, receive
R2#ping 2001:2::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:2::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/28/48 ms
R2#ping 2001:3::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:3::1, timeout is 2 seconds:
!.!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 24/36/48 ms
R2#ping 2001:4::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:4::1, timeout is 2 seconds:
!!!!!
接下来把刚刚配置的静态路由条目删掉(直接在命令前面加no,就OK了),下面做默认路由。
R2(config)#no ipv6 route 2001:2::/64 f0/0 FE80::C800:1AFF:FE74:8
R2(config)#no ipv6 route 2001:3::/64 f0/0 FE80::C800:1AFF:FE74:8
R2(config)#no ipv6 route 2001:4::/64 f0/0 FE80::C800:1AFF:FE74:8
再次查看路由表,这时路由表中应该没有静态路由条目,测试连通性也是不行的。
R2#sho ipv route
IPv6 Routing Table - Default - 3 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, M - MIPv6, R - RIP, I1 - ISIS L1
I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP
EX - EIGRP external
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 2001:10::/64 [0/0]
via FastEthernet0/0, directly connected
L 2001:10::2/128 [0/0]
via FastEthernet0/0, receive
L FF00::/8 [0/0]
via Null0, receive
R2#ping 2001:2::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:2::1, timeout is 2 seconds:
% No valid route for destination
Success rate is 0 percent (0/1)
在R2上配置默认路由:
(查看路由表中,有没有默认路由条目,如果有则测试连通性,一步到位,就OKl)
R2(config)#ipv6 route ::/0 f0/0 FE80::C800:1AFF:FE74:8
R2(config)#end
*Jun 9 09:26:01.619: %SYS-5-CONFIG_I: Configured from console by console
R2#sho ipv6 route
IPv6 Routing Table - Default - 4 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, M - MIPv6, R - RIP, I1 - ISIS L1
I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP
EX - EIGRP external
O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
S ::/0 [1/0]
via FE80::C800:1AFF:FE74:8, FastEthernet0/0 //被添加的默认路由//
C 2001:10::/64 [0/0]
via FastEthernet0/0, directly connected
L 2001:10::2/128 [0/0]
via FastEthernet0/0, receive
L FF00::/8 [0/0]
via Null0, receive
R2#ping 2001:2::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:2::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/29/44 ms
以上就是今天的实验了;其实原则上还是跟IPv4基本相似,没有太大的差别,就是命令上有所改动,
只要有IPv4的基础,理解IPv6就很容易了
好了,今天就到这里啦!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。