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

How to Disable/Enable IP forwarding in Linux的更多相关文章

  1. 11 TCP/IP 基础与Linux的网络配置

    1. TCP/IP与OSI参考模型 TCP/IP是Unix/Linux世界的网络基础,在某种意义上Unix网络就是TCP/IP,而TCP/IP就是网络互联的标准.它不是一个独立的协议,而是一组协议.其 ...

  2. How To Set Up Port Forwarding in Linux

    Port forwarding usually used when we want our computer act like a router. Our computer receive the p ...

  3. TCP/IP协议栈在Linux内核中的运行时序分析

    网络程序设计调研报告 TCP/IP协议栈在Linux内核中的运行时序分析 姓名:柴浩宇 学号:SA20225105 班级:软设1班 2021年1月 调研要求 在深入理解Linux内核任务调度(中断处理 ...

  4. mysql的DISABLE/ENABLE KEYS

    有一个表 tbl1 的结构如下: CREATE TABLE `tbl1` ( `id` int(10) unsigned NOT NULL auto_increment, `name` char(20 ...

  5. REST API disable / enable service auto start by API

    how to disable service auto start by API as the following how to enable service auto start by API as ...

  6. 什么是 IP 隧道,Linux 怎么实现隧道通信?

    本文首发于我的公众号 Linux云计算网络(id: cloud_dev),专注于干货分享,号内有 10T 书籍和视频资源,后台回复「1024」即可领取,欢迎大家关注,二维码文末可以扫. 通过之前的文章 ...

  7. 学习Mysql过程中拓展的其他技术栈:设置linux虚拟机的固定ip和克隆linux虚拟机

    一.设置linux虚拟机的固定ip 1. 安装好虚拟机后在菜单栏选择编辑→ 虚拟网络编辑器,打开虚拟网络编辑器对话框,选择Vmnet8 Net网络连接方式,随意设置子网IP,点击NAT设置页面,查看子 ...

  8. Linux TCP/IP调优-Linux内核参数注释

    固定文件的内核参数 下列文件所在目录: /proc/sys/net/ipv4/ 名称 默认值 建议值 描述 tcpsyn_retries 5 1 对于一个新建连接,内核要发送多少个SYN连接请求才决定 ...

  9. disable enable 所有其他表关联的外键

    Disable: begin for i in (select constraint_name, table_name from user_constraints where constraint_n ...

随机推荐

  1. 服务器安装pip

    1. wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6. ...

  2. javase中javax源码下载地址

    OracleJDK 和 OpenJDK 源码都可以参考. OpenJDK 源码下载 http://hg.openjdk.java.net/jdk7/jdk7/jdk/file 我主要是想下载 java ...

  3. Unity&UGUI

    UI:User Interface 用户交互接口,处理用户与程序直接的交互 新建一个UI控件,都会同时新建两个物体: --Canvas:画布,所有的UI控件都必须放到画布上 --EnventSyste ...

  4. msf客户端渗透(六):抓包、搜索文件、破解弱口令、修改MACE时间

    嗅探抓包 查看网卡 指定网卡,因为资源有限,默认抓满50000个包如果不dump下来,就会自动销毁掉,从0开始抓. dump嗅探到的文件到本机,传递到本机的过程是结果ssl加密的 dump了两个文件 ...

  5. 【OpenGL】glsl、glew、glfw

    glsl: OpenGL着色语言(OpenGL Shading Language)是用来在OpenGL中着色编程的语言,也即开发人员写的短小的自定义程序,他们是在图形卡的GPU (Graphic Pr ...

  6. SQL%ROWCOUNT作用

    SQL%ROWCOUNT是一个游标属性,而SQL中的DML操作实际上是一种隐式的游标操作,在做insert,update,delete,merge以及select into操作时,Oracle会打开一 ...

  7. 手机端用swiper组件 轮播图设置后右侧出现空白 及 部分手机浏览器打开网页空白

    我的方法是设置内容css overflow:hidden;width:100%; ok. 之前搜到一个方法也可以,就是设置css height: auto;overflow-y: scroll; 但是 ...

  8. verilog task2

    1.问题:串口的发送和接收 系统时钟50Mhz,波特率119200.系统时钟计数约2604个,才是一位数据的传输时间. 模拟接收的任务函数rx_data_task():LSB first task r ...

  9. LightOJ - 1030 期望+dp

    题目链接:https://vjudge.net/problem/25907/origin 一个山洞,里面有有1到n个位置,每个位置都有一定的金币,你有一个六面的骰子,一开始你在1,每次摇到了哪个数就往 ...

  10. switch只跟在这些之后

    switch case 可以用在他们之后