9.6. The /etc/sysctl.conf file

In Red Hat Linux 6.2, many kernel options related to networking security such as dropping packets that come in over interfaces they shouldn't or ignoring ping/broadcasts request, etc. can be set in the new /etc/sysctl.conf file instead of the /etc/rc.d/rc.local file. One important consideration is the IPv4 forwarding parameter which is now done via the sysctl program, as opposed to being controlled by the contents of the file in /etc/sysconfig/network. The sysctl settings are stored in /etc/sysctl.conf, and are loaded at each boot before the /etc/rc.d/rc.local file is loaded. We've already talked about all networking security parameters that we must set into the server in General System Security, and for this reason we'll focus only on the kernel option for IPv4 forwarding.

To enable IPv4 forwarding on your RH 6.2 system, use the following command: Edit the /etc/sysctl.conf file and add the following line:

           # Enable packet forwarding
           net.ipv4.ip_forward = 1
           
You must restart your network for the change to take effect. The command to restart the network is the following:

           [root@deep] /# /etc/rc.d/init.d/network restart
           

           
           Setting network parameters	        [  OK  ]
           Bringing up interface lo	        [  OK  ]
           Bringing up interface eth0	        [  OK  ]
           Bringing up interface eth1	        [  OK  ]
           
           

Tip: Enabling IPv4 forwarding via the sysctl.conf file is only valid for Red Hat Linux 6.2 users. Users with version 6.1 of Red Hat must set this parameter into the /etc/sysconfig/network file as explained above.