return to first page linux journal archive
keywordscontents

Listing 4. Local Startup File /etc/rc.d/rc.local

This file is used to automatically start up or set various settings that are not part of the normal Linux distribution. It is here that you set up the firewall specific settings, such as IP forwarding and the firewall rules.

#!/bin/sh
# /etc/rc.d/rc.local: Local system initialization
# script.
# Put any local setup commands in here:
# Turn on Kernel IP forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward
# Set default policy forwarding packets to DENY
ipchains -P forward DENY
# Append a rule to forward our packets out of our 
# local network, masquerading the IP addresses of 
# our local LAN with the Internet IP address of the 
# Firewall.
ipchains -A forward -j MASQ -s 192.168.0.0/24 -d 0.0.0.0/0
# start up Real Audio Pass thru
insmod /lib/modules/2.2.9/ipv4/ip_masq_raudio.o
# start up FTP Pass thru
insmod /lib/modules/2.2.9/ipv4/ip_masq_ftp.o
# start up IRC Pass thru
insmod /lib/modules/2.2.9/ipv4/ip_masq_irc.o