====== Quick Links ====== * http://os.51cto.com/art/201103/249341.htm * http://www.xuebuyuan.com/1945506.html * http://blog.csdn.net/wbryfl/article/details/6146617 * http://www.ahlinux.com/safe/16121.html * http://linux.alai.net/viewblog.php?id=41605 ====== Setup Gateway ====== * Edit /etc/network/interfaces This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface allow-hotplug eth0 iface eth0 inet dhcp # The secondary network interface iface eth1 inet static address 192.168.0.1 netmask 255.255.255.0 * Restart networking # This does not work: /etc/init.d/networking restart sudo ifdown eth1 && sudo ifup eth1 * Enable ip forward: edit /etc/sysctl.conf, uncomment "#net.ipv4.ip_forward=1". ### OLD #net.ipv4.ip_forward=1 ### NEW net.ipv4.ip_forward=1 * Now we should be alble to ping 192.168.0.1. To ping 166.111.142.1, we should do iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE * Set up DHCP server ([[https://wiki.debian.org/DHCP_Serve | Ref]])