使用 radvd 通告子网路由

Tho*_*ger 7 linux ipv6 radvd icmpv6

我们已经建立了一个小型的 IPv6 测试网络。设置如下所示:

    ::/0
+----------+
| Firewall | Router to the public net
+----------+
     |           2001:...::/106
     |       +----------+
     +-------|  SIT GW  | sit Tunnel gatway to the some test users
     |       +----------+
     |
+----------+
| Test Sys |  Testsystem
+----------+
Run Code Online (Sandbox Code Playgroud)

这个想法是通告来自防火墙的默认路由和来自坐网关的 SIT 子网的路由。radvd 的配置是:

# Firewall
interface eth0
{
   AdvSendAdvert on;
   route ::/0 
   {
   };
};


# SIT Gatway
interface eth0
{
   AdvSendAdvert on;
   route 2001:...::/106
   {
   };
};
Run Code Online (Sandbox Code Playgroud)

我们已经捕获了 adv。带有 tcpdump 的包,这些包看起来不错。我们看到来自 fw 的默认路由和来自 SIT 网关的子网路由。

但是,如果我们查看测试系统,则两个网关上都有两条默认路由。没有子网路由。路由当然不起作用。这里我们得到的路线:

2001:.....::/64 dev eth0  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 4294967295
fe80::/64 dev eth0  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 4294967295
default via fe80::baac:6fff:fe8e:XXXX dev eth0  proto kernel  metric 1024  expires 0sec mtu 1500 advmss 1440 hoplimit 64
default via fe80::e415:aeff:fe12:XXXX dev eth0  proto kernel  metric 1024  expires 0sec mtu 1500 advmss 1440 hoplimit 64
Run Code Online (Sandbox Code Playgroud)

任何的想法?

Tho*_*ger 7

我找到了问题所在。

默认情况下,Linux 内核仅通过 icmpv6 中的路由器广告选项接受默认路由。

要解决此问题,必须设置正确的内核参数:

net.ipv6.conf.all.accept_ra_rt_info_max_plen = 128
Run Code Online (Sandbox Code Playgroud)

从内核文档:

accept_ra_rt_info_max_plen - INTEGER RA 中路由信息的最大前缀长度。

    Route Information w/ prefix larger than or equal to this
    variable shall be ignored.

    Functional default: 0 if accept_ra_rtr_pref is enabled.
                        -1 if accept_ra_rtr_pref is disabled.
Run Code Online (Sandbox Code Playgroud)

  • 好奇到底什么是过时的以及新的/当前的状态是什么。 (3认同)