根据https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
conf/all/* is special, changes the settings for all interfaces
forwarding - BOOLEAN
Enable IP forwarding on this interface. This controls whether packets
received _on_ this interface can be forwarded.
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)
因此,net.ipv4.conf.all.forwarding=0
禁用所有接口上的IPv4数据包转发,就像net.ipv4.ip_forward=0
禁用所有接口上的IPv4数据包转发一样。
有谁能解释一下net.ipv4.conf.all.forwarding
和net.ipv4.ip_forward
内核参数之间的区别吗?
发布于 2022-11-18 07:57:30
基于描述,ip_forward
不仅会改变接口之间的包转发值,而且还会改变其他配置。如前所述,其他配置将设置为默认的,即主机的FC1122和路由器的RFC1812。
而在forwarding
的情况下,它将在该特定接口或所有基于使用的接口上设置它,而不会影响其他配置。
例如:ipv4.conf.all.forwarding=1
将在不影响其他配置的情况下在所有接口上设置ipv4转发,ipv4.ip_forward=1
也将在所有接口上设置ipv4转发,但也会更改配置。
https://unix.stackexchange.com/questions/723977
复制相似问题