您好,登錄后才能下訂單哦!
基于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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。