Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»How To Enable IP Forwarding on Linux

    How To Enable IP Forwarding on Linux

    By RahulAugust 14, 20181 Min Read

    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.

    Advertisement

    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

    Related Posts

    Understanding 2>&1 in Bash: A Beginner’s Guide

    How to Choose the Best Shebang (#!) for Your Shell Scripts

    Modulus Operator (%) in Bash

    Using Modulus Operator (%) in Bash

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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