This Document describes how to setup a RedHat Linux Box with Masquerading and DHCP.
If you have a RedHat Linux and want to setup masquerading, just add the following lines to /etc/rc.local:
modprobe iptable_nat iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE echo 1 > /proc/sys/net/ipv4/ip_forward
You can even add these for more security:
/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT /sbin/iptables -A INPUT -i lo -j ACCEPT /sbin/iptables -A INPUT -j LOG --log-level 4 --log-prefix "ATTACK" /sbin/iptables -A INPUT -j DROP
But then you have to additionally add
/sbin/iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
More Information is available here: http://www.linuxathome.net/iptables.php.
First install a DHCP Server. A default config file (/etc/dhcpd.conf) looks somehow like this:
default-lease-time 600; max-lease-time 7200; option domain-name "myhome.com"; option domain-name-servers 123.45.67.89, 123.45.67.90;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.220;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
}
host some_host_name {
hardware ethernet 02:12:A1:A2:B0:B3;
fixed-address 192.168.0.5;
}
Then add the following line to /etc/rc.local:
dhcpd eth1
and your done.
Rafael Perez, securemailer at _superrafi_ dot com