修改/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