# 設定連接IPv6網路，沒有想像中那麼困難

> Episode of [Cisco學習資訊分享](https://podistic.com/podcast/cisco.md) · Published December 15, 2020

- **Listen on Podistic:** https://podistic.com/episode/ipv6
- **Audio:** https://archive.org/download/hongliji-sipt-p-20201215/hongliji-sipt-p-20201215.mp3 (audio/mpeg)

## About this episode

很多網管工作的朋友，不能立刻接受IPv6網路技術的原因，我的觀察，是因為感覺到IPv6技術好複雜。我設計了這個簡易的網路架構圖，來說明，感覺不一定完全正確，IPv6其實可以遠比IPv4容易設定。 在這個架構圖裡面，一共只有4套路由器，8個網段。其中路由器、路由器之間，一共只有6個網段，再加上用戶端、伺服器端各一個網段。只有這樣，就這麼簡單的拓樸。&nbsp; 假設給定的需求只有「連接用戶端、伺服器」，不限定第三層的協定，使用IPv4或者是IPv6。我們分別完成它們的設定，然後來做兩者之間的比較。 IPv4設定連接 傳統的IPv4設定的流程，我們必須先分配IPv4地址。地址決定好之後，我們再到路由器上面，設定IP地址還有路由協定。 我們會發現，大部分時間，竟然是花費在IPv4地址的計算，而不是路由器的設定。 下面我只列出R1的設定。 hostname R1 interface Loopback0 &nbsp;ip address 10.0.0.1 255.255.255.255 ! interface Ethernet1/0 &nbsp;description To R2 &nbsp;ip address 10.0.12.1 255.255.255.0 ! interface Ethernet1/1 &nbsp;description To R3 &nbsp;ip address 10.0.13.1 255.255.255.0 ! interface Ethernet1/2 &nbsp;description To R4 &nbsp;ip address 10.0.14.1 255.255.255.0 ! interface Ethernet2/0 &nbsp;description To Client &nbsp;ip address 10.1.0.1 255.255.255.0 ! router ospf 1 &nbsp;network 10.0.0.0 0.255.255.255 area 1 ! end 下面是IPv4路由表。 R1&gt;show ip route ... C&nbsp; &nbsp; &nbsp; &nbsp; 10.1.0.0/24 is directly connected, Ethernet2/0 L&nbsp; &nbsp; &nbsp; &nbsp; 10.1.0.1/32 is directly connected, Ethernet2/0 O&nbsp; &nbsp; &nbsp; &nbsp; 10.2.0.0/24 [110/20] via 10.0.13.3, 00:01:24, Ethernet1/1 ... R2&gt;show ip route ... O&nbsp; &nbsp; &nbsp; &nbsp; 10.1.0.0/24 [110/20] via 10.0.12.1, 00:05:11, Ethernet1/0 O&nbsp; &nbsp; &nbsp; &nbsp; 10.2.0.0/24 [110/20] via 10.0.23.3, 00:02:37, Ethernet1/1 R3&gt;show ip route O&nbsp; &nbsp; &nbsp; &nbsp; 10.1.0.0/24 [110/20] via 10.0.13.1, 00:02:48, Ethernet1/0 C&nbsp; &nbsp; &nbsp; &nbsp; 10.2.0.0/24 is directly connected, Ethernet2/0 L&nbsp; &nbsp; &nbsp; &nbsp; 10.2.0.3/32 is directly connected, Ethernet2/0 ... R4&gt;show ip route ... O&nbsp; &nbsp; &nbsp; &nbsp; 10.1.0.0/24 [110/20] via 10.0.14.1, 00:05:59, Ethernet1/0 O&nbsp; &nbsp; &nbsp; &nbsp; 10.2.0.0/24 [110/20] via 10.0.34.3, 00:03:32, Ethernet1/2 R4&gt; IPv6設定連接 IPv6的設定流程，我們並不需要設定路由器、路由器之間的地址，因為，IPv6原本就會自動產生「鍊路內本地地址」(Link Local)，更棒的是，大部分的路由協定，只需要「鍊路內本地地址」，就已經可以正常工作了。 下面我只列出R1的設定。 hostname R1 ipv6 unicast-routing ! interface Loopback0 &nbsp;ipv6 address FDE0:0:0:1::1/64 &nbsp;ipv6 ospf 1 area 1 ! interface Ethernet1/0 &nbsp;description To R2 &nbsp;ipv6 enable &nbsp;ipv6 ospf 1 area 1 ! interface Ethernet1/1 &nbsp;description To R3 &nbsp;ipv6 enable &nbsp;ipv6 ospf 1 area 1 ! interface Ethernet1/2 &nbsp;description To R4 &nbsp;ipv6 enable &nbsp;ipv6 ospf 1 area 1 ! interface Ethernet2/0 &nbsp;description To Client &nbsp;ipv6 address FDE0:0:0:100::1/64 &nbsp;ipv6 ospf 1 area 1 ! ipv6 router ospf 1 ! end 下面是IPv6路由表。 R1&gt;show ipv6 route IPv6 Routing Table - default - 9 entries Codes: C - Connected, L - Local, S - Static, U - Per-user Static route &nbsp; &nbsp; &nbsp; &nbsp;B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 &nbsp; &nbsp; &nbsp; &nbsp;I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP &nbsp; &nbsp; &nbsp; &nbsp;EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination &nbsp; &nbsp; &nbsp; &nbsp;NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 &nbsp; &nbsp; &nbsp; &nbsp;OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP ... C&nbsp; &nbsp;FDE0:0:0:100::/64 [0/0] &nbsp; &nbsp; &nbsp;via Ethernet2/0, directly connected L&nbsp; &nbsp;FDE0:0:0:100::1/128 [0/0] &nbsp; &nbsp; &nbsp;via Ethernet2/0, receive O&nbsp; &nbsp;FDE0:0:0:200::/64 [110/20] &nbsp; &nbsp; &nbsp;via FE80::C803:72FF:FE33:1C, Ethernet1/1 ... R1&gt; R2&gt;show ipv6 route ... O&nbsp; &nbsp;FDE0:0:0:100::/64 [110/20] &nbsp; &nbsp; &nbsp;via FE80::C801:78FF:FE7F:1C, Ethernet1/0 O&nbsp; &nbsp;FDE0:0:0:200::/64 [110/20] &nbsp; &nbsp; &nbsp;via FE80::C803:72FF:FE33:1D, Ethernet1/1 ... R2&gt; R3&gt;show ipv6 route ... O&nbsp; &nbsp;FDE0:0:0:100::/64 [110/20] &nbsp; &nbsp; &nbsp;via FE80::C801:78FF:FE7F:1D, Ethernet1/0 C&nbsp; &nbsp;FDE0:0:0:200::/64 [0/0] &nbsp; &nbsp; &nbsp;via Ethernet2/0, directly connected L&nbsp; &nbsp;FDE0:0:0:200::3/128 [0/0] &nbsp; &nbsp; &nbsp;via Ethernet2/0, receive ... R3&gt; R4&gt;show ipv6 route ... O&nbsp; &nbsp;FDE0:0:0:100::/64 [110/20] &nbsp; &nbsp; &nbsp;via FE80::C801:78FF:FE7F:1E, Ethernet1/0 O&nbsp; &nbsp;FDE0:0:0:200::/64 [110/20] &nbsp; &nbsp; &nbsp;via FE80::C803:72FF:FE33:1E, Ethernet1/2 ... R4&gt; 為什麼 為什麼有這麼大的差異？IPv4主要的問題，是在於沒有自動產生「鍊路內本地地址」的功能。因此，所有的路由器、路由器之間的網段，全部都需要手動檢查設定IP地址。除了手動設定這些地址之外，IPv4地址更需要手動詳細檢查，一一確認，子網段的分割、遮罩長度的定義、十進位二進位轉換計算、網段內地址是否相符…等等等。 光是地址分配，再加上檢驗的步驟，將會比全部的路由器命令輸入設定，都還要更花時間。而且計算過程，讓人非常痛苦。最糟糕的是，非常、非常容易出錯。 結論 您管理IPv4時所遇到的痛苦，在新的IPv6世界裡面，很多都已經自動消失了。希望這個資訊，讓您更有動力，將網路協定改成IPv6。 One more thing… 不設定路由器、路由器之間的IPv6單播路由地址，的確也有缺點。假設我們習慣於使用 PING、TRACEROUTE工具，來確認，某路由器的指定鍊結是否正常工作，這個老習慣就不能工作了。 我建議別再使用以上的老習慣。改從路由協定本身，確認鄰居的狀態的同時，也確認鍊路的工作狀態。例如OSPF鄰居、EIGRP鄰居。只要鄰居的狀態是維持住的，代表著鍊路狀態也是正常工作的。 我是洪李吉。我的網站是「Cisco學習資訊分享」。我們下次見！
