How to IP MASQUERADING


On Red Hat AS 3.0 (kernel 2.4.21-4.EL)

Using IPTABLES

No matter on wheter Firewall is enabled or not, I use it.
Please refer to ... for Firewall configuration.

Common situation here, you are connected to the internet over a modem
connection and you want to enable other machines to navigate.
 

#--Load modules, this modules allow correct working of specific client
programs, such ftp and others.
modprobe ip_tables
modprobe iptable_filter
modprobe iptable_mangle
modprobe ipt_LOG
modprobe ipt_limit
modprobe ipt_state
modprobe ipt_owner
modprobe ipt_REJECT
modprobe ipt_MASQUERADE
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
modprobe iptable_nat
modprobe ip_nat_ftp
modprobe ip_nat_irc

#--Initial clean up
#iptables --flush
#iptables --table nat --flush
#iptables --delete-chain
#iptables --table nat --delete-chain
#--Set up IP FORWARDing and Masquerading
iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
#--This only allow 192.168.0.2(255.255.255.0) to exit
#iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.2/24 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

Configuring clients

Configure default gateway to the masquerading host and to access the internet configure a valid dns.