net.ipv4.conf.all.forwarding 和 net.ipv4.ip_forward 之间的区别

Ahm*_*nov 7 networking linux-kernel forwarding kernel-parameters

根据https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt

conf/all/*    is special, changes the settings for all interfaces
Run Code Online (Sandbox Code Playgroud)
forwarding - BOOLEAN
    Enable IP forwarding on this interface.  This controls whether packets
    received _on_ this interface can be forwarded.
Run Code Online (Sandbox Code Playgroud)
ip_forward - BOOLEAN
    0 - disabled (default)
    not 0 - enabled

    Forward Packets between interfaces.

    This variable is special, its change resets all configuration
    parameters to their default state (RFC1122 for hosts, RFC1812
    for routers)
Run Code Online (Sandbox Code Playgroud)

因此,net.ipv4.conf.all.forwarding=0禁用所有接口上的 IPv4 数据包转发,与net.ipv4.ip_forward=0禁用所有接口上的 IPv4 数据包转发,与禁用所有接口上的 IPv4 数据包转发

net.ipv4.conf.all.forwarding任何人都可以解释一下内核参数和内核参数之间的区别吗net.ipv4.ip_forward

Ahm*_*nov 0

事实上,这两个参数都会在广泛的层面上影响 IP 转发。然而,net.ipv4.conf.all.forwarding 的目的是在处理复杂的网络场景时,在网络命名空间内提供更精细的控制,在这种情况下,您希望启用或禁用特定命名空间的转发,同时不影响其他命名空间。