Powered By Blogger

Wednesday, December 28, 2011

IP Forwarding on RHEL

We can modify IP_forwarding temporally or permanently

For temporally

There are two methods for temporally change,

Method 1

Check if IP Forwarding was already enabled or not

[root@Ram ~]# cat /proc/sys/net/ipv4/ip_forward
0

if it is 0 it is disabled, if 1 then it is enabled

Modify the value

[root@Ram ~]# echo 1 > /proc/sys/net/ipv4/ip_forward
[root@Ram ~]# cat /proc/sys/net/ipv4/ip_forward
1

Method 2

[root@Ram ~]# sysctl -a|grep ip_forward
net.ipv4.ip_forward = 0

[root@Ram ~]# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1

[root@Ram ~]# sysctl -a|grep ip_forward
net.ipv4.ip_forward = 1




For permanent change,

Modify following line in /etc/sysctl.conf to 1 from 0

# Controls IP packet forwarding
net.ipv4.ip_forward = 1


Execute following command to load the configuration

[root@Ram ~]# sysctl -p

No comments:

Post a Comment

Welcome to the UNIX world