Linux

net.ipv6.conf.all.forwarding=1 是否等同於為所有單個介面啟用轉發?

  • March 2, 2017

或者這是啟用 IPv6 轉發的唯一方法?

/proc/sys/net/ipv6/conf# grep '' */forwarding
all/forwarding:0
default/forwarding:1
eth0/forwarding:1
lo/forwarding:1
nat64/forwarding:1
tunl0/forwarding:1
veth_cm/forwarding:1
wifi0/forwarding:1
wlan0/forwarding:1

不路由。我在 Wireshark 中看到數據包,但它們沒有到達 ip6tables。

/proc/sys/net/ipv6/conf# grep '' */forwarding
all/forwarding:1
default/forwarding:1
eth0/forwarding:1
lo/forwarding:1
nat64/forwarding:1
tunl0/forwarding:1
veth_cm/forwarding:1
wifi0/forwarding:1
wlan0/forwarding:1

現在網路開始工作。

/proc/sys/net/ipv6/conf# grep '' */forwarding
all/forwarding:1
default/forwarding:0
eth0/forwarding:0
lo/forwarding:0
nat64/forwarding:0
tunl0/forwarding:0
veth_cm/forwarding:0
wifi0/forwarding:0
wlan0/forwarding:0

網路仍然有效。是否甚至使用了那些單獨的每個介面開關?會不會是 Linux 核心錯誤(現在執行版本 4.9.5)。

看起來它確實被設計為與 IPv4 相比以不同的方式工作,*/forwarding並且all/forwarding

來自https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt

conf/all/forwarding - BOOLEAN
   Enable global IPv6 forwarding between all interfaces.

   IPv4 and IPv6 work differently here; e.g. netfilter must be used
   to control which interfaces may forward packets and which not.

   This also sets all interfaces' Host/Router setting
   'forwarding' to the specified value.  See below for details.

   This referred to as global forwarding.

forwarding - INTEGER
   Configure interface-specific Host/Router behaviour.

   Note: It is recommended to have the same setting on all
   interfaces; mixed router/host scenarios are rather uncommon.

   Possible values are:
       0 Forwarding disabled
       1 Forwarding enabled

   FALSE (0):

   By default, Host behaviour is assumed.  This means:

   1. IsRouter flag is not set in Neighbour Advertisements.
   2. If accept_ra is TRUE (default), transmit Router
      Solicitations.
   3. If accept_ra is TRUE (default), accept Router
      Advertisements (and do autoconfiguration).
   4. If accept_redirects is TRUE (default), accept Redirects.

   TRUE (1):

   If local forwarding is enabled, Router behaviour is assumed.
   This means exactly the reverse from the above:

   1. IsRouter flag is set in Neighbour Advertisements.
   2. Router Solicitations are not sent unless accept_ra is 2.
   3. Router Advertisements are ignored unless accept_ra is 2.
   4. Redirects are ignored.

   Default: 0 (disabled) if global forwarding is disabled (default),
        otherwise 1 (enabled).

因此,每個介面forwarding僅用於各種標誌和特殊數據包行為等輔助功能,而不用於決定是否重新傳輸數據包。

引用自:https://unix.stackexchange.com/questions/348533