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 ...
随机推荐
- opencv批量读取图片
#include<opencv2/opencv.hpp>using namespace cv;using namespace std;int main(){ int num=4;// ...
- mui-当使用addeleventlisener()方法绑定事件时选择器无法绑定事件
在mui中绑定事件不能用jQuery或mui(“#XX”)的形式选取某个元素,而是document.getelementbyid()的形式 mui(“#XX”)可以使用on方法绑定事件
- div 光标处插入内容
var Manager = { insertHtml: function(html, type) { var lastMemo = document.getElementById("memo ...
- MyBatis数据库连接的基本使用-补充Mapper映射器
补充 Mapper映射器的使用: Mapper映射器,google添加.Mapper映射器是将mapper.xml中配置的sql id,parameterType和resultMap按照规则一一映射到 ...
- 基于oslo_messaging的RPC通信
oslo_messaging源于Openstack的一个经典的模块,用以实现服务间的RPC通信.Client端将数据放入rabbitmq中,server端从消息队列中获取传送数据. oslo.mess ...
- DB2 57016报错的解决办法(表状态不正常,导致表无法操作)
新建了一张表,删除了一列,然后执行insert的时候,报错 57016,解释为:因为表不活动. 1.执行db2 "load query table <tabname>" ...
- dbcp第一次获取连接的时间问题
最近优化代码,发现第一次调用数据库连接时非常慢,往后便不再发生.经了解,数据库连接是用dbcp管理的,想在网上查找答案,但没有找到.在某人的提醒下决定研究源代码: 部分源代码如下(BasicDataS ...
- sqoop2问题解决
sqoop:000> show version --serverException has occurred during processing command Exception: org.a ...
- Ant 初级入门
一.Ant简介 Ant是一个Apache基金会下的跨平台的构件工具. 由于Ant是基于Java的,所以需要Java环境的支持,也就是配置好 JAVA_HOME 和 ANT_HOME 环境变量分别指向J ...
- CentOS 查看是否安装软件包
1. rpm包安装的,可以用rpm -qa看到,如果要查找某软件包是否安装,用 rpm -qa | grep "软件或者包的名字" 2. deb包安装的,可以用dpkg -l能看到 ...