Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Tutorials»How To Enable IP Forwarding on Linux

    How To Enable IP Forwarding on Linux

    RahulBy RahulAugust 19, 20151 Min ReadUpdated:August 14, 2018

    For the security purpose by default IP forwarding is disabled in modern Linux operating system. If you are required to enable IP forwarding on your system, follow the below steps. In this article, you will get how to check that IP forwarding is enabled or not. If not, enable it.

    Check Current IP Forwarding

    Check the value if ip_forward in /proc filesystem as following command.

    cat /proc/sys/net/ipv4/ip_forward
    
    0
    

    or we can use sysctl command line to query for kernel values like below command.

    sudo sysctl net.ipv4.ip_forward
    
    net.ipv4.ip_forward = 0
    

    Enable Kernel IP Forwarding

    Let’s enable the IP forwarding for your current active shell of Linux system. This changes will be lost after a system shutdown or reboot.

    echo 1 > /proc/sys/net/ipv4/ip_forward
    

    Or, we can use sysctl to enable it

    sysctl -w net.ipv4.ip_forward=1
    

    Enable Kernel IP Forwarding (Permanent)

    To enable IP forwarding permanently edit /etc/sysctl.conf and add the following line. This will enable IP forwarding even after the system reboot.

    net.ipv4.ip_forward = 1
    

    After adding above values in sysctl.conf, Use following command to reload values of this file.

    sysctl -p
    
    ip forwarding kernel linux
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleReferenceError: $ is not defined – JavaScript
    Next Article How to Install NRPE on Ubuntu 18.04 & 16.04 LTS

    Related Posts

    (Resolved) userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms

    Updated:May 10, 20221 Min Read

    How to Install Apache ActiveMQ on Ubuntu 22.04

    3 Mins Read

    How To Enable SSH Server on Ubuntu 22.04

    Updated:April 22, 20222 Mins Read

    How To Install LAMP Stack on Ubuntu 22.04 LTS

    Updated:April 20, 20225 Mins Read

    10 Best Linux Video Players in 2022

    Updated:February 18, 20226 Mins Read

    How to Switch Python Version in Ubuntu & Debian

    Updated:April 22, 20223 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Sublime Text 4 on Ubuntu 22.04
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.