• How to Disable/Enable IP forwarding in Linux


    This article describes how to Disable or Enable an IP forwarding in Linux.

    Current IP forwarding status

    Read a current state of IP forwarding:

    # sysctl net.ipv4.ip_forward
    net.ipv4.ip_forward = 1
    

    Currently, the output number 1 indicates that the IP forwarding is enabled. The above value is read from the Linux proc file system and more precisely from the actual file /proc/sys/net/ipv4/ip_forward file:

    # cat /proc/sys/net/ipv4/ip_forward
    1
    

    Disable IP forwarding

    To disable IP forwarding on a running Linux system run:

    # sysctl -w net.ipv4.ip_forward=0
    net.ipv4.ip_forward = 0
    

    The above command actually writes number 0 into the above mentioned file /proc/sys/net/ipv4/ip_forward. If from some reason the above command fails you can attempt to disable the IP forwarding manually by:

    echo 0 > /proc/sys/net/ipv4/ip_forward
    

    The above change is not reboot persistent. To permanently disable the IP forwarding on your Linux system edit /etc/sysctl.conf and add the following line:

    net.ipv4.ip_forward = 0
  • 相关阅读:
    为什么下水井盖是圆的
    静心尽力
    菜鸟的一年
    [转]Libev教程
    流媒体:V4L2视频获取
    [转]Libev源码分析 -- 整体设计
    c#操作xml增删改查
    dwz简单配置与操作
    jsonp 跨域访问
    操作cookie.判断浏览器系统版本,判断safir浏览器存储数据
  • 原文地址:https://www.cnblogs.com/mouseleo/p/9859990.html
Copyright © 2020-2023  润新知