I had to setup a debian multihomed box as a router, so here goes the receipt. In my example the internal network is 10.1.1.0 and the as its IP address is set to 10.1.1.1, you should direct your clients to use that as the gateway. eth0 is connected to the outside network.
- Add network interface in file /etc/network/interfaces:
- auto eth1
- iface eth1 inet static
- address 10.1.1.1
- netmask 255.255.255.0
- broadcast 10.0.0.255
- echo 1 > /proc/sys/net/ipv4/ip_forward
- route add -net 10.1.1.0 netmask 255.255.255.0 dev eth1
- iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
- iptables --append FORWARD --in-interface eth1 -j ACCEPT
That should be it. Note that only the iptables and echo statements should be automated through init.d scripts.
No comments:
Post a Comment