Subscribe Us

How to enable IP Forwarding -net.ipv4.ip_forward

By default, IP Forwarding is disabled in Linux. If you want to make linux as a router/gateway or may be VPN(PPTP | IPSec) or dial up then you will need to enable ip forward. That can be done with several ways that will information below.

Display the status of ip_forward:
cat /proc/sys/net/ipv4/ip_forward
0 (Disable)Linux
or
sysctl -p

Enable the ip_forward :
sysctl -w net.ipv4.ip_forward=1
or
echo 1 > /proc/sys/net/ipv4/ip_forward
or 

Permanent setting using /etc/sysctl.conf
vim /etc/sysctl.conf
net.ipv4.ip_forward = 1

Load the kernel parameter using -p
sysctl –p
or
sysctl -p /etc/sysctl.conf


Enjoy :)

Post a Comment

0 Comments