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 ...
随机推荐
- Linux下修改tab建为4个空格
1.编辑 vim /etc/vim/vimrc 2.修改 set ts=4 set expandtab set autoindent 其实只要set ts=4 就ok了.
- 安装 Laravel 遇到问题?你需要更新 composer.json 文件
转载自 https://9iphp.com/web/laravel/laravel-install-fail-update-composer.html 在使用最新版 Composer 安装 Larav ...
- Linux 永久PATH环境变量
在/etc/profile文件中添加变量[对所有用户生效(永久的)] 用vim在文件/etc/profile文件中增加变量,该变量将会对Linux下所有用户有效,并且是“永久的”. 例如:编辑/etc ...
- mongodb-参考其他
MongoDB教程 http://www.runoob.com/mongodb/mongodb-window-install.html
- Java 中的 static 使用
Java语言基础--static 0.目录 8.static 8.1 Java 中的 static 使用之静态变量 8.2 Java 中的 static 使用之静态方法 8.3 Java 中的 sta ...
- WAS 忘记密码
一.重置密码 1.首先关闭was,ps –ef|grep java 查看java进程号,然后kill -9 XXXX杀掉进程即可.或者使用命令./stopServer.sh server1 2.取消控 ...
- numpy的使用数组的创建2
随机创建了长度为十的数组 获得十以类的随机整数 快速获取数组2乘3维的数组 生成20个1到10之间的数组 通过reshape 将这些数变成二位数组 shape这个方法可以查看数组中的元素是几行几列的
- MySQL之多表查询练习 与基本查询基础
MySQL 增删查改 一.增:有2种方法 1.使用insert插入单行数据: 语法:insert [into]<表名> [列名] values <列值> 例:insert i ...
- java函数方法
1.方法重载 (1)源代码 // MethodOverload.java // Using overloaded methods public class MethodOverload { publi ...
- 问题2:input、textarea、submit 宽度设置为100%,但显示宽度不一致
<style type="text/css"> body{ padding: 10px; } input,textarea{ width: 100%; } </s ...