一个路由异常的实例
$ ip -6 route 2001::/32 dev teredo proto kernel metric 256 mtu 1280 advmss 1220 hoplimit 0 2001:250:217:f03::/64 dev eth0 proto kernel metric 256 expires 0sec mtu 1500 advmss 1440 hoplimit 0 2001:250:217:e008::/64 dev eth0 proto kernel metric 256 expires 0sec mtu 1500 advmss 1440 hoplimit 0 fe80::/64 dev eth0 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit 0 fe80::/64 dev vboxnet0 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit 0 fe80::/64 dev teredo proto kernel metric 256 mtu 1280 advmss 1220 hoplimit 0 default via fe80::21b:53ff:fe4b:3bff dev eth0 proto kernel metric 1024 expires 0sec mtu 1500 advmss 1440 hoplimit 64 default dev teredo metric 1029 mtu 1280 advmss 1220 hoplimit 0
根据IPv6协议地址规范,fe80打头的是私有地址,而以上路由表输出中的默认路由却是一条私有IPv6地址:
default via fe80::21b:53ff:fe4b:3bff dev eth0 proto kernel metric 1024 expires 0sec mtu 1500 advmss 1440 hoplimit 64
具体效果表现就是可以ping6通本地的IPv6地址,但无法访问外网的IPv6地址。
通过以下命令删除这条错误的默认路由就正常了:
sudo ip -6 route del via fe80::21b:53ff:fe4b:3bff
以上方式能访问外网IPv6,但几分钟之后就会自动添加以上这条路由了。并且,能访问外网IPv6的原因是我安装了teredo这个虚拟网卡。
huangwei@wzy-ThinkPad-X220:~$ ip -6 route 2001:250:217:208::/64 dev eth0 proto kernel metric 256 expires 2592046sec fe80::/64 dev eth0 proto kernel metric 256 fe80::/64 dev wlan0 proto kernel metric 256 default via fe80::20d:65ff:fe6d:2e3f dev eth0 proto kernel metric 1024 expires 1684sec
$ ip -6 addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436
inet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 2001:250:217:208:d480:292b:30b6:ae87/64 scope global temporary dynamic valid_lft 604402sec preferred_lft 85402sec inet6 2001:250:217:208:f2de:f1ff:fe85:8c4c/64 scope global dynamic valid_lft 2591983sec preferred_lft 604783sec inet6 fe80::f2de:f1ff:fe85:8c4c/64 scope link valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qlen 1000
inet6 fe80::3a59:f9ff:fee0:2264/64 scope link valid_lft forever preferred_lft forever