Linux

嘗試添加 IPv6 路由時得到“RTNETLINK 答案:無效參數”

  • April 5, 2018

當我嘗試添加 IPv6 路由時,我收到一條錯誤消息:

root@lx-anielsen ~ $ ip -6 route add ::a:6:0/112 via ::a:4:1 dev eth1.1001
RTNETLINK answers: Invalid argument

這是我的界面配置的樣子:

root@lx-anielsen ~ $ ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436
   inet6 ::1/128 scope host
      valid_lft forever preferred_lft forever
2: eth4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
   inet6 fe80::92e2:baff:fe1f:a964/64 scope link
      valid_lft forever preferred_lft forever
6: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
   inet6 fe80::ea39:35ff:fe33:d2b8/64 scope link
      valid_lft forever preferred_lft forever
7: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
   inet6 fe80::227:19ff:feb0:3cdf/64 scope link
      valid_lft forever preferred_lft forever
8: vmnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
   inet6 fe80::250:56ff:fec0:1/64 scope link
      valid_lft forever preferred_lft forever
9: vmnet8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
   inet6 fe80::250:56ff:fec0:8/64 scope link
      valid_lft forever preferred_lft forever
10: eth1.1001@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
   inet6 ::a:4:2/112 scope global
      valid_lft forever preferred_lft forever
   inet6 fe80::227:19ff:feb0:3cdf/64 scope link
      valid_lft forever preferred_lft forever

還有我的路由表:

root@lx-anielsen ~ $ ip -6 route
unreachable ::/96 dev lo  metric 1024  error -101 mtu 16436 advmss 16376 hoplimit 4294967295
::a:4:0/112 dev eth1.1001  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 4294967295
unreachable ::ffff:0.0.0.0/96 dev lo  metric 1024  error -101 mtu 16436 advmss 16376 hoplimit 4294967295
unreachable 2002:a00::/24 dev lo  metric 1024  error -101 mtu 16436 advmss 16376 hoplimit 4294967295
unreachable 2002:7f00::/24 dev lo  metric 1024  error -101 mtu 16436 advmss 16376 hoplimit 4294967295
unreachable 2002:a9fe::/32 dev lo  metric 1024  error -101 mtu 16436 advmss 16376 hoplimit 4294967295
unreachable 2002:ac10::/28 dev lo  metric 1024  error -101 mtu 16436 advmss 16376 hoplimit 4294967295
unreachable 2002:c0a8::/32 dev lo  metric 1024  error -101 mtu 16436 advmss 16376 hoplimit 4294967295
unreachable 2002:e000::/19 dev lo  metric 1024  error -101 mtu 16436 advmss 16376 hoplimit 4294967295
unreachable 3ffe:ffff::/32 dev lo  metric 1024  error -101 mtu 16436 advmss 16376 hoplimit 4294967295
fe80::/64 dev eth0  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 4294967295
fe80::/64 dev vmnet1  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 4294967295
fe80::/64 dev vmnet8  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 4294967295
fe80::/64 dev eth1  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 4294967295
fe80::/64 dev eth4  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 4294967295
fe80::/64 dev eth1.1001  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 4294967295

我正在使用 RHEL 6:

anielsen@lx-anielsen ~ $ cat /etc/issue
Red Hat Enterprise Linux Client release 6.3 (Santiago)
Kernel \r on an \m

我究竟做錯了什麼?

我認為這就是正在發生的事情。

1)載入ipv6模組

modprobe ipv6

2)添加ipv6地址和路由

ip addr add 2001:IPV6:...2/64 dev eth1.1001
ip route add ::a:6:0/112 dev eth1.1001

3)試一試

根據 Michael Hampton 的評論,如果您的 IP/網路遮罩組合無效,您通常會看到此錯誤消息。

使用子網計算器仔細檢查您的網路遮罩是否適合您所需的 IP 範圍和子網大小。

引用自:https://serverfault.com/questions/469620