首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >net.ipv4.conf.all.forwarding与net.ipv4.ip_forward的区别

net.ipv4.conf.all.forwarding与net.ipv4.ip_forward的区别
EN

Unix & Linux用户
提问于 2022-11-07 14:49:07
回答 1查看 1.6K关注 0票数 6

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

代码语言:javascript
运行
复制
conf/all/*    is special, changes the settings for all interfaces
代码语言:javascript
运行
复制
forwarding - BOOLEAN
    Enable IP forwarding on this interface.  This controls whether packets
    received _on_ this interface can be forwarded.
代码语言:javascript
运行
复制
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.forwardingnet.ipv4.ip_forward内核参数之间的区别吗?

EN

回答 1

Unix & Linux用户

发布于 2022-11-18 07:57:30

基于描述,ip_forward不仅会改变接口之间的包转发值,而且还会改变其他配置。如前所述,其他配置将设置为默认的,即主机的FC1122和路由器的RFC1812。

而在forwarding的情况下,它将在该特定接口或所有基于使用的接口上设置它,而不会影响其他配置。

例如:ipv4.conf.all.forwarding=1将在不影响其他配置的情况下在所有接口上设置ipv4转发,ipv4.ip_forward=1也将在所有接口上设置ipv4转发,但也会更改配置。

票数 1
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/723977

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档