linux ipv6 默认路由到环回

linux ipv6 默认路由到环回

我试图理解为什么最近的 Linux 内核中存在 ipv6 默认路由到环回

::/0                           ::                         !n   -1  1     4 lo

是为了防止循环吗?为什么下面的输出中有两条这样的路由?

root@ubuntu:/# ip -6 route show table all
fd00:1::/64 dev eth0  proto kernel  metric 256  expires 2591833sec
fd00:1::/64 dev eth1  proto kernel  metric 256  expires 2591833sec
fd00:2::/64 via fd00:1::1 dev eth0  metric 1 
fe80::/64 dev eth0  proto kernel  metric 256 
fe80::/64 dev eth1  proto kernel  metric 256 
default via fe80::21f:12ff:fe31:5600 dev eth0  proto kernel  metric 1024  expires 1309sec
default via fe80::21f:12ff:fe31:5600 dev eth1  proto kernel  metric 1024  expires 1309sec
unreachable default dev lo  table unspec  proto kernel  metric -1  error -101
local ::1 via :: dev lo  table local  proto none  metric 0 
local fd00:1::250:56ff:fe8a:596a via :: dev lo  table local  proto none  metric 0 
local fd00:1::250:56ff:fe8a:596b via :: dev lo  table local  proto none  metric 0 
local fd00:1::18ec:2a1:3b2e:8302 via :: dev lo  table local  proto none  metric 0 
local fd00:1::59b1:42d0:b380:a32d via :: dev lo  table local  proto none  metric 0 
local fe80::250:56ff:fe8a:596a via :: dev lo  table local  proto none  metric 0 
local fe80::250:56ff:fe8a:596b via :: dev lo  table local  proto none  metric 0 
ff00::/8 dev eth0  table local  metric 256 
ff00::/8 dev eth1  table local  metric 256 
unreachable default dev lo  table unspec  proto kernel  metric -1  error -101
root@ubuntu:/# route -nA inet6           
Kernel IPv6 routing table
Destination                    Next Hop                   Flag Met Ref Use If
fd00:1::/64                    ::                         UAe  256 0     1 eth0
fd00:1::/64                    ::                         UAe  256 0     0 eth1
fd00:2::/64                    fd00:1::1                  UG   1   0     0 eth0
fe80::/64                      ::                         U    256 0     0 eth0
fe80::/64                      ::                         U    256 0     0 eth1
::/0                           fe80::21f:12ff:fe31:5600   UGDAe 1024 0     0 eth0
::/0                           fe80::21f:12ff:fe31:5600   UGDAe 1024 0     0 eth1
::/0                           ::                         !n   -1  1     4 lo
::1/128                        ::                         Un   0   1    12 lo
fd00:1::250:56ff:fe8a:596a/128 ::                         Un   0   1     0 lo
fd00:1::250:56ff:fe8a:596b/128 ::                         Un   0   1     0 lo
fd00:1::18ec:2a1:3b2e:8302/128 ::                         Un   0   1     0 lo
fd00:1::59b1:42d0:b380:a32d/128 ::                         Un   0   1     0 lo
fe80::250:56ff:fe8a:596a/128   ::                         Un   0   1     0 lo
fe80::250:56ff:fe8a:596b/128   ::                         Un   0   1     0 lo
ff00::/8                       ::                         U    256 0     0 eth0
ff00::/8                       ::                         U    256 0     0 eth1
::/0                           ::                         !n   -1  1     4 lo
root@ubuntu:/# 

输出形式

root@ubuntu:/# uname -a
Linux ubuntu 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

答案1

正如标志!n所示,这是对 IN6ADDR_ANY 流量的拒绝。此路由条目的含义是该lo设备永远不会被用作默认路由。

此处显示的表中的等效线ip route是:

unreachable default dev lo  table unspec  proto kernel  metric -1  error -101

(另请注意,正如手册页警告您的那样,该route命令已过时,您应该改用ip route。)

相关内容