簡介
本文說明 IPv6 連結本機位址在網路中的運作方式。
必要條件
需求
思科建議您瞭解以下主題:
採用元件
本檔案中的資訊是根據使用Cisco IOS®軟體版本12.4 (15)T1的Cisco 3700系列路由器。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
慣例
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
背景資訊
本地鏈路地址是可在使用本地鏈路字首FE80::/10 (1111 1110 10)和介面識別符號的任何介面上自動配置的IPv6單播地址,格式為修改後的EUI-64。本地鏈路地址不一定要繫結到MAC地址,但使用EUI-64方法配置本地鏈路地址(其中MAC地址嵌入到IPv6地址中)是很常見的,使用ipv6 address <address> link-local命令,也可以以FE80::/10格式手動配置本地鏈路地址。
註:有關EUI-64格式介面識別符號的詳細資訊,請訪問IP版本6編址架構RFC4291
IPv6中的本地鏈路地址僅用於特定物理鏈路,這意味著裝置之間的本地網路連線。這些地址對於自動地址配置等任務以及幫助同一鏈路上的裝置相互查詢和通訊的鄰居發現協定(NDP)至關重要。本地鏈路地址允許相鄰節點之間的通訊,而無需全局唯一的地址。重要的是,IPv6路由器不會使用本地鏈路地址將資料轉發到本地網路之外。所有啟用IPv6的介面自動擁有本地鏈路單播地址。
組態
在本例中,路由器R1、R2和R3透過串列介面連線,並且按照網路圖中的說明配置了IPv6地址。路由器R1和R3上配置了環回地址,並且路由器使用OSPFv3相互通訊。此示例使用ping命令演示具有本地鏈路地址的路由器之間的連通性。路由器R1和R3可以使用IPv6本地單播地址互相ping通,但不能使用它們的本地鏈路地址互相ping通。但是,路由器R2直接連線到R1和R3,因此它可以使用它們的本地鏈路地址與兩台路由器通訊,因為本地鏈路地址僅在物理介面專用的本地網路中使用。
網路圖表
此文件使用以下網路設定:
使用的組態
本文件使用以下組態:
此影片展示了Cisco IOS路由器中IPv6本地鏈路地址和全局單播地址之間的主要區別:
路由器R1 |
hostname R1
!
ipv6 cef
!
ipv6 unicast-routing
!
interface Loopback10
no ip address
ipv6 address FD10::/64 eui-64
!--- Assigned a IPv6 unicast address in EUI-64 format.
ipv6 ospf 1 area 1
!--- Enables OSPFv3 on the interface and associates the interface looback10 to area 1.
!
interface Loopback20
no ip address
ipv6 address FD20::/64 eui-64
ipv6 ospf 1 area 2
!--- Associates the Interface loopback20 to area 2.
!
interface Serial0/0
no ip address
ipv6 address 2001::1/124
ipv6 ospf 1 area 0
!--- Associates the Interface serial0/0 to area 0.
clock rate 2000000
!
ipv6 router ospf 1
router-id 10.1.1.1
!--- Router R1 uses 10.1.1.1 as router id.
log-adjacency-changes
!
end |
路由器R2 |
路由器R3 |
hostname R2
!
ipv6 cef
!
ipv6 unicast-routing
!
!
!
interface Serial0/0
no ip address
ipv6 address 2001::2/124
ipv6 ospf 1 area 0
clock rate 2000000
!
!
interface Serial0/1
no ip address
ipv6 address 2002::1/124
ipv6 ospf 1 area 0
clock rate 2000000
!
!
!
ipv6 router ospf 1
router-id 10.2.2.2
log-adjacency-changes
!
end |
hostname R3
!
ipv6 cef
!
ipv6 unicast-routing
! ! !
interface Loopback10
no ip address
ipv6 address FD01::/64 eui-64
ipv6 ospf 1 area 1
! !
interface Loopback20
no ip address
ipv6 address FD20::/64 eui-64
ipv6 ospf 1 area 2
! !
interface Serial0/0
no ip address
ipv6 address FE80::AB8 link-local
ipv6 address 2002::2/124
ipv6 ospf 1 area 0
clock rate 2000000
! ! !
ipv6 router ospf 1
router-id 10.3.3.3
log-adjacency-changes
!
end
|
驗證
檢驗OSPF配置
要檢驗是否已正確配置OSPF,請使用 show ipv6 route ospf
命令。
show ipv6 route ospf |
路由器R1 R1#show ipv6 route ospf
IPv6 Routing Table - 10 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route, M - MIPv6
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
D - EIGRP, EX - EIGRP external
OI FD01::C002:1DFF:FEE0:0/128 [110/128]
via FE80::C001:1DFF:FEE0:0, Serial0/0
O 2002::/124 [110/128]
via FE80::C001:1DFF:FEE0:0, Serial0/0
OI FD20::C002:1DFF:FEE0:0/128 [110/128]
via FE80::C001:1DFF:FEE0:0, Serial0/0 路由器R3 R3#show ipv6 route ospf
IPv6 Routing Table - 10 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route, M - MIPv6
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
D - EIGRP, EX - EIGRP external
O 2001::/124 [110/128]
via FE80::C001:1DFF:FEE0:0, Serial0/0
OI FD10::C000:1DFF:FEE0:0/128 [110/128]
via FE80::C001:1DFF:FEE0:0, Serial0/0
OI FD20::C000:1DFF:FEE0:0/128 [110/128]
via FE80::C001:1DFF:FEE0:0, Serial0/0 |
驗證本地鏈路地址可達性
路由器可以使用全局單播地址彼此ping通。如果路由器僅使用本地鏈路地址,則直連網路可以通訊。例如,R1可以使用全局單播地址對R3執行ping操作,但兩台路由器無法與本地鏈路地址通訊。這在路由器R1和R3中使用ping 和debug ipv6 icmp 命令顯示。
從遠端網路Ping本地鏈路地址
當路由器R1嘗試使用本地鏈路地址與路由器R3通訊時,路由器R1會返回ICMP超時消息,該消息表明本地鏈路地址是本地特定地址,無法與直連網路外部的本地鏈路地址通訊。
從路由器R1 ping R3的本地鏈路地址 |
在路由器R1中 R1#ping FE80::AB8
Output Interface: serial0/0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to FE80::AB8, timeout is 2 seconds:
Packet sent with a source address of FE80::C000:1DFF:FEE0:0
.....
Success rate is 0 percent (0/5)
!--- Pinging Link-Local Address of router R3.
!--- The ping is unsuccessful and the ICMP packet cannot reach the destination through serial0/0.
!--- This timeout indicates that R1 has not received any replies from the router R3.
|
從直連網路Ping本地鏈路地址
對於路由器R2,路由器R1和R3直接連線,當它們與連線到路由器的相關介面通訊時,它們可以ping路由器R1和R2的本地鏈路地址。輸出如下所示:
從路由器R2 ping R1的本地鏈路地址 |
在路由器R2中 R2#ping FE80::C000:1DFF:FEE0:0
Output Interface: serial0/0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to FE80::C000:1DFF:FEE0:0, timeout is 2 seconds:
Packet sent with a source address of FE80::C001:1DFF:FEE0:0
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/19/56 ms
!--- Pinging Link-Local Address of router R1, R2 connects to R1 via serial0/0. R1的調試輸出 R1#
*Mar 1 03:59:53.367: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 03:59:53.371: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 03:59:53.423: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 03:59:53.427: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 03:59:53.463: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 03:59:53.463: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 03:59:53.467: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 03:59:53.467: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 03:59:53.471: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 03:59:53.471: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
!--- The debug output shows that the router R2 can ping router R1's Link-Local address.
|
從路由器R2 ping R3的本地鏈路地址 |
在路由器R2中 R2#ping FE80::AB8
Output Interface: serial0/1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to FE80::AB8, timeout is 2 seconds:
Packet sent with a source address of FE80::C001:1DFF:FEE0:0
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/18/60 ms
!--- Note that, to ping the Link-Local address, output interface is needed. In our case, R2 connects to R3 throught serial0/1. R3的調試輸出 R3#
*Mar 1 04:12:11.518: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 04:12:11.522: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 04:12:11.594: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 04:12:11.598: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 04:12:11.618: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 04:12:11.618: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 04:12:11.622: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 04:12:11.622: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 04:12:11.626: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 04:12:11.630: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
!--- The debug output shows that the router R2 can ping router R3's Link-Local address.
|
本地鏈路地址僅特定於該本地網路。路由器可以擁有相同的本地鏈路地址,並且直連網路可以彼此通訊,而不會有任何衝突。對於全局單播地址,情況並非如此。可路由的全局單播地址在網路中必須是唯一的。show ipv6 interface brief命令顯示介面上本地鏈路地址的資訊。
show ipv6 interface brief |
在路由器R1中 R1#show ipv6 interface brief
Serial0/0 [up/up]
FE80::AB8
2001::1
Loopback10 [up/up]
FE80::C000:1DFF:FEE0:0
FD10::C000:1DFF:FEE0:0
Loopback20 [up/up]
FE80::C000:1DFF:FEE0:0
FD20::C000:1DFF:FEE0:0 在路由器R3中 R3#show ipv6 interface brief
Serial0/0 [up/up]
FE80::AB8
2002::2
Loopback10 [up/up]
FE80::C002:1DFF:FEE0:0
FD01::C002:1DFF:FEE0:0
Loopback20 [up/up]
FE80::C002:1DFF:FEE0:0
FD20::C002:1DFF:FEE0:0
!--- Shows that R1 and R3's serial interface has same Link-Local address FE80::AB8.
|
在本例中,R1和R3被分配了相同的本地鏈路地址,當它們指定相關的輸出介面時,R2仍然可以到達兩台路由器。
從R2 ping R1和R3的本地鏈路地址 |
從R2 ping R1本地鏈路地址 R2#ping FE80::AB8
Output Interface: serial0/0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to FE80::AB8, timeout is 2 seconds:
Packet sent with a source address of FE80::C001:1DFF:FEE0:0
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/26/92 ms
!--- R2 is connected to R1 through serial0/0. R1的調試輸出 R1#
*Mar 1 19:51:31.855: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 19:51:31.859: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 19:51:31.915: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 19:51:31.919: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 19:51:31.947: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 19:51:31.947: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 19:51:31.955: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 19:51:31.955: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 19:51:31.955: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 19:51:31.955: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0 從R2 ping R3本地鏈路地址 R2#ping FE80::AB8
Output Interface: serial0/1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to FE80::AB8, timeout is 2 seconds:
Packet sent with a source address of FE80::C001:1DFF:FEE0:0
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/28/76 ms
!--- R2 is connected to R1 through serial0/1. R3的調試輸出 R3#
*Mar 1 19:53:38.815: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 19:53:38.819: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 19:53:38.911: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 19:53:38.915: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 19:53:38.923: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 19:53:38.927: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 19:53:38.955: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 19:53:38.955: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0
*Mar 1 19:53:38.963: ICMPv6: Received echo request from FE80::C001:1DFF:FEE0:0
*Mar 1 19:53:38.963: ICMPv6: Sending echo reply to FE80::C001:1DFF:FEE0:0 |
注意:R2僅能ping通R1和R3的本地鏈路地址,因為它們是直接連線的。R2無法ping通路由器R1和R3中環回介面的本地鏈路地址,因為它們沒有直接連線。Ping僅在直連網路的情況下才在本地鏈路地址上運行。
注意:對於本地鏈路地址,Traceroute不起作用,並返回「% No valid source address for destination」錯誤消息。這是因為IPv6路由器不能將具有本地鏈路源地址或目標地址的資料包轉發到其他鏈路。
相關資訊