/etc/network/interfaces
# the Internet interface, assuming a static config # as received from the Internet provider iface eth0 inet static address xxx.xxx.xxx.xxx # this is your Internet IP address netmask 255.255.255.0 gateway xxx.xxx.xxx.xxx # this is your gateway to the Internet dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx # internal network, where this computer is the gateway iface eth1 inet static address 192.168.0.1 netmask 255.255.255.0
Install resolvconf, shorewall, dnsmasq.
For shorewall first you need the files contained in /usr/share/doc/shorewall-common/default-config to /etc/shorewall/ and then adjust a few of them according to the example in /usr/share/doc/shorewall-common/examples/two-interfaces ( all paths from memory as both gateways I administer remotely are currently shut-down ). Also don't forget to set IP_FORWARDING=On ( instead of Keep ) in /etc/shorewall/shorewall.conf.
On a client machine you only need the package resolvconf and :
/etc/network/interfaces
iface eth0 inet static address 192.168.0.xx # anything else but 192.168.0.1 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 192.168.0.1 # yes, the gateway, because we have dnsmasq
If you want your gateway to also provide DHCP just uncomment one example that suits you in /etc/dnsmasq.conf and restart dnsmasq.
On the client side you only need :
# iface eth0 inet dhcp
To connect multiple computers you need an Ethernet switch, preferably with auto-crossover or even Gigabit capabilities ( a hub would also do, but I doubt you can still buy one... ). You can also add a network card for each additional internal computer and use bridge-utils to create a bridge. This way your gateway will also act as a switch ;)
This setup is very flexible and can be extended in several ways depending on your needs.
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
0 comments :: gateway or router configuration example
Post a Comment