/etc/network/interfaces file # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo eth1 eth3 eth4 eth5 iface lo inet loopback # The primary network interface allow-hotplug eth1 iface eth1 inet dhcp # iface eth3 inet static address 192.168.3.1 netmask 255.255.255.0 # iface eth4 inet static address 192.168.4.1 netmask 255.255.255.0 # iface eth5 inet static address 192.168.5.1 netmask 255.255.255.0 > ifconfig -a eth1 Link encap:Ethernet HWaddr 00:50:8D:5A:77:B5 inet addr:12.219.61.253 Bcast:255.255.255.255 Mask:255.255.248.0 UP BROADCAST RUNNING MULTICAST MTU:576 Metric:1 RX packets:6102 errors:0 dropped:0 overruns:0 frame:0 TX packets:260 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:511967 (499.9 KiB) TX bytes:45976 (44.8 KiB) Interrupt:17 Base address:0xa000 eth3 Link encap:Ethernet HWaddr 00:10:B5:5F:9D:E2 inet addr:192.168.3.1 Bcast:192.168.3.255 Mask:255.255.255.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:19 Base address:0x9000 eth4 Link encap:Ethernet HWaddr 00:04:5A:72:9E:6E inet addr:192.168.4.1 Bcast:192.168.4.255 Mask:255.255.255.0 inet6 addr: fe80::204:5aff:fe72:9e6e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:734 errors:0 dropped:0 overruns:0 frame:0 TX packets:915 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:116657 (113.9 KiB) TX bytes:686136 (670.0 KiB) Interrupt:20 Base address:0x9400 eth5 Link encap:Ethernet HWaddr 00:04:5A:72:9E:51 inet addr:192.168.5.1 Bcast:192.168.5.255 Mask:255.255.255.0 inet6 addr: fe80::204:5aff:fe72:9e51/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:3 dropped:0 overruns:0 carrier:6 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:21 Base address:0x9800 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:9 errors:0 dropped:0 overruns:0 frame:0 TX packets:9 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:636 (636.0 b) TX bytes:636 (636.0 b) /etc/network/firewall file # assuming eth1 = ext net and eth0 = int net # iptables -F; iptables -t nat -F; iptables -t mangle -F iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to 12.219.61.253 echo 1 > /proc/sys/net/ipv4/ip_forward # # to secure it # iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -m state --state NEW -i ! eth1 -j ACCEPT iptables -P INPUT DROP iptables -A FORWARD -i eth1 -o eth1 -j REJECT /etc/rc.local file # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /etc/network/firewall exit 0