尝试添加 IPv6 路由时收到“RTNETLINK 答案:参数无效”

尝试添加 IPv6 路由时收到“RTNETLINK 答案:参数无效”

当我尝试添加 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

我想这就是正在发生的事情。

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)尝试一下

答案2

根据 Michael Hampton 的评论,如果您的 IP/网络掩码组合无效,您通常会看到此错误消息。

使用子网计算器仔细检查您是否具有所需 IP 范围和子网大小的正确网络掩码。

相关内容