修改/etc/network/interfaces文件:
auto lo iface lo inet loopback auto eth0 iface eth0 inet6 static address 2000:ffff::64 netmask 64 up route -A inet6 add 2000:ffff::/64 gw 2000:ffff::5
重啟后查看接口信息和路由表:
tony@ubuntu-b:~$ ifconfig eth0 eth0 Link encap:以太網 硬件地址 00:0c:29:15:e1:63 inet6 地址: 2000:ffff::64/64 Scope:Global inet6 地址: fe80::20c:29ff:fe15:e163/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 躍點數:1 接收數據包:116 錯誤:0 丟棄:0 過載:0 幀數:0 發送數據包:38 錯誤:0 丟棄:0 過載:0 載波:0 碰撞:0 發送隊列長度:1000 接收字節:11027 (11.0 KB) 發送字節:5821 (5.8 KB) 中斷:19 基本地址:0x2024
tony@ubuntu-b:~$ route -A inet6 內核 IPv6 路由表 Destination Next Hop Flag Met Ref Use If 2000:ffff::/64 2000:ffff::5 UG 1 0 0 eth0 2000:ffff::/64 :: U 256 0 1 eth0 fe80::/64 :: U 256 0 0 eth0 ::/0 :: !n -1 1 2093 lo ::1/128 :: Un 0 1 0 lo 2000:ffff::64/128 :: Un 0 1 3 lo fe80::20c:29ff:fe15:e163/128 :: Un 0 1 0 lo ff00::/8 :: U 256 0 0 eth0 ::/0 :: !n -1 1 2093 lo
