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 ...
随机推荐
- 2018面向对象程序设计(Java)第3周学习指导及要求
2018面向对象程序设计(Java) 第3周学习指导及要求(2018.9.11-2018.9.16) 学习目标 适应老师教学方式,能按照自主学习要求完成本周理论知识学习: 掌握Java Appli ...
- linux centos 基本命令
init 3 进入命令行界面. init 5 进入图形界面. ifconfig 查询IP地址. nmtui 设置网卡. su - root 是切换到root账号使用,使用的是root用户的环境变量:s ...
- azkaban编译以及安装(调度系统)
编译源码 下载azkaban源码 git clone https://github.com/azkaban/azkaban.git jdk要求是1.8以上版本 export JAVA_HOME=/ ...
- 百度地图API自动定位和3种导航
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- python全栈 字典数据类型相关知识及操作
python 全栈开发 一.字典 1. 字典的概念: 字典 : dict 用 {} 来表示, 键位值数据. { key , value } 具有唯一性. 键:都必须是可哈希的 不可变 ...
- Python基础之逻辑运算
逻辑运算 概念: 优先级() > not > and > or print(2 > 1 and 1 < 4 or 2 < 3 and 9 > 6 or 2 & ...
- defer和async的详细区别
看过javascript高级程序设计的人,在javascript高级程序设计里,应该看到了介绍了有关defer和async的区别,可是比较浅显,而且也说得不是很清楚.下面我们来通过图片来详细了解下df ...
- STL:unordered_set/unordered_multiset(c++11)
unordered_set:容器内的元素无序排列,基于值进行获取单个元素速度非常快.内部根据它们的 hash value 被组织成 buckets(slot). unordered_multiset: ...
- rancher 2 webhook 格式
{ "version":"4", "groupKey":<string>, "status":"& ...
- 包含min函数的栈(python)
题目描述 定义栈的数据结构,请在该类型中实现一个能够得到栈中所含最小元素的min函数(时间复杂度应为O(1)). # -*- coding:utf-8 -*- class Solution: #入栈时 ...