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. linux安装memcached和php的memcache扩展 (已使用)

    所需软件libevent-1.4.6-stable.tar.gz (http://monkey.org/~provos/libevent/)memcache-2.2.3.tgz (http://pec ...

  2. window上安装 MongoDB 及其 PHP扩展

    window上安装 MongoDB 及其 PHP扩展   工具/原料   window MongoDB MongoDB 方法/步骤     MongoDB 下载 MongoDB提供了可用于32位和64 ...

  3. 简单的实现微信获取openid

    微信公众平台获取openid在公众号的开发中有很多用途,前段时间为实现用户使用公众号在登录一次以后可以免密登陆而使用了openid.开发过程中遇到了一些问题,在这里向需要且还没有获取到openid的米 ...

  4. 2017面向对象程序设计(JAVA)课程总结

    以下就课程结束之后的问题进行简单小结:1. 关于课程教学方法       课程在部分章节的学习中采用了翻转课堂教学,目的是促进同学们借助方便获取的线上线下学习资源进行课前自学,以便于老师留出课堂时间进 ...

  5. 第三篇:jmeter的作用域和执行顺序

    1.元件的作用域: 8类可执行的元件,testplan和threadgroup不属于可执行的元件:这些元件中,取样器,是典型的不与其他元件发生交互作用的元件,逻辑控制器只对其子节点的取样器有效,而其他 ...

  6. php 读取网站页面源码的经典函数

    Snoopy.class.php下载 include "inc/Snoopy.class.php"; //读取网页,返回网页源文件内容 function read_url($str ...

  7. Failed to start LSB: Bring up/down networking 问题

    Failed to start LSB: Bring up/down networking 问题   1.执行 service network restart 出现以下错误 Restarting ne ...

  8. hdoj1004(查找众多字符串中个数最多的字符串)

    Let the Balloon Rise. 最近开始刷hdoj,想通过写博客做做笔记,记录写过代码. Problem Description Contest time again! How excit ...

  9. SystemC_Basic

    1.http://baike.baidu.com/view/1018980.htm 百度百科介绍的很好,举例很清晰. 2.SystemC的三个基本进程:SC_METHOD,SC_THREAD,SC_C ...

  10. js 计算丢失精度问题

    计算时用parseFloat,计算完后转换成Number对象 var ytje = parseFloat("0.03"); var handlecharge = parseFloa ...