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
How to Disable/Enable IP forwarding in Linux的更多相关文章
- 11 TCP/IP 基础与Linux的网络配置
1. TCP/IP与OSI参考模型 TCP/IP是Unix/Linux世界的网络基础,在某种意义上Unix网络就是TCP/IP,而TCP/IP就是网络互联的标准.它不是一个独立的协议,而是一组协议.其 ...
- 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 ...
- TCP/IP协议栈在Linux内核中的运行时序分析
网络程序设计调研报告 TCP/IP协议栈在Linux内核中的运行时序分析 姓名:柴浩宇 学号:SA20225105 班级:软设1班 2021年1月 调研要求 在深入理解Linux内核任务调度(中断处理 ...
- mysql的DISABLE/ENABLE KEYS
有一个表 tbl1 的结构如下: CREATE TABLE `tbl1` ( `id` int(10) unsigned NOT NULL auto_increment, `name` char(20 ...
- 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 ...
- 什么是 IP 隧道,Linux 怎么实现隧道通信?
本文首发于我的公众号 Linux云计算网络(id: cloud_dev),专注于干货分享,号内有 10T 书籍和视频资源,后台回复「1024」即可领取,欢迎大家关注,二维码文末可以扫. 通过之前的文章 ...
- 学习Mysql过程中拓展的其他技术栈:设置linux虚拟机的固定ip和克隆linux虚拟机
一.设置linux虚拟机的固定ip 1. 安装好虚拟机后在菜单栏选择编辑→ 虚拟网络编辑器,打开虚拟网络编辑器对话框,选择Vmnet8 Net网络连接方式,随意设置子网IP,点击NAT设置页面,查看子 ...
- Linux TCP/IP调优-Linux内核参数注释
固定文件的内核参数 下列文件所在目录: /proc/sys/net/ipv4/ 名称 默认值 建议值 描述 tcpsyn_retries 5 1 对于一个新建连接,内核要发送多少个SYN连接请求才决定 ...
- disable enable 所有其他表关联的外键
Disable: begin for i in (select constraint_name, table_name from user_constraints where constraint_n ...
随机推荐
- RGB图片取大于阈值部分
#include<opencv2\opencv.hpp> #include <iostream> using namespace cv; using namespace std ...
- node-rsa
[node-rsa] 引用 var NodeRSA = require('node-rsa') 生成一个私钥长度为512的key(同时生成公钥) var key = new NodeRSA({b: 5 ...
- jvm 几个invoke 指令
invokestatic : 调用静态方法 invokespecial : 调用实例构造器<init>方法, 私有方法和父类方法 invokevirtual : 调用虚方法 invokei ...
- MVC001之mvcpager简单分页
描述:用mvcpager实现简单分页功能 参考网址: http://www.cnblogs.com/iamlilinfeng/archive/2013/03/11/2951460.html http: ...
- Java 一维多项式计算
求解Java一维多项式的通用方法 比如ax^4+bx^3+cx^2+dx+e 可以化为(((ax+b)x+c)x+d)x+e 那么观察规律可以将系数放到一个数组里num[e,d,c,b,a] publ ...
- MyBufferedReader
/** 需求:自定义一个包含 readLine 方法的 BufferedReader 来模拟一下 BufferedReader */ import java.io.FileReader; import ...
- centos7 脚本搭建SVN
#!/usr/bin/env bash #安装软件 HTTP 和 SVN软件 yum install -y httpd subversion mod_dav_svn #创建库文件夹并更改文件夹权限 m ...
- 与服务器同步工程(expect脚本)
先看下我实际用的例子: #!/usr/bin/expect spawn rsync -vazu ssh-src/src wayne@192.168.5.2:~/projects/ expect &qu ...
- verilog task1
问题描述: 设计中需要重复多次施加一种激励,每一次激励的施加过程,都可以划分为4个部分,如图所示. 每一次施加的激励只有第二部分的数据有变化(数据格式无变化).所以顶层的Testbench代码如下: ...
- PHPlaravel中从数据库中选择数据是增加时间条件及各种条件
注:附加条件后要加get函数. 1.public function getForDataTable($startTime,$endTime){ return $this->query() -&g ...