2004年1月27日

Simple Router/NAT Settings

1. If there is no DHCP service, configure WAN/LAN IP manually.
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255
ifconfig eth1 10.0.0.100 netmask 255.255.255.0 broadcast 10.0.0.255
2.Add routing rule if needed.
route add –net 192.168.1.0 netmask 255.255.255.0 dev eth0
route add –net 10.0.0.0 netmask 255.255.255.0 dev eth1
3. Add a default gateway IP.
route add default gw 10.0.0.1
4. Enable forwarding.
echo "1" > /proc/sys/net/ipv4/ip_forward
5. Set a simple NAT rule thru iptables tool. eth1 is output interface.
iptables –t nat –A POSTROUTING –o eth1 –s 192.168.1.0/24 –j MASQUERADE
6. Add DNS servers.
echo "168.95.1.1" > /etc/resolv.conf