Home

Debian/Ubuntu Tips & Tricks

Debuntu.org: .deb packages, Unix/Linux Tutorials and Articles.

sponsors


User login

Poll

Syndicate

Syndicate content


Tips


How-To: Set up a LAN gateway with DHCP, Dynamic DNS and iptables on Debian Etch

Linux is a perfect platform to act as a router/gateway.

In this tutorial, I will explain how to set up a Linux box to operate as a network router. The box will provide the following services:

  • DHCP server to provide the ip addresses to the machines in the LAN
  • DNS server to resolve domain names
  • Gateway with IP tables to give access to the Internet.
  • Firewall with IP tables.

The resulting machine will have quite a small footprint: about 600M, and except if your network is intensively used, a low spec computer can be recycled to do the job.

As the machine is going to operate as a router/firewall

This tutorial is based on a Debian Etch 4.0 r3 minimal network install, i.e that during the install, at the "Software selection" step, I unselected everything.

The box has 2 network interfaces:

  • eth0: ip 192.168.1.9 which is connected to internet (not directly though, but it is the box that is routing the traffic toward internet for this LAN)
  • eth1: ip 192.168.2.1, this is the interface connected to our LAN and that will forward the traffic to and from internet.

Also, we are going to manage the domain name lan.debuntu.local, so each machine will be able to communicate with each others by using their hostname.

So first let's get started with the set up of bind9

Adding localhost to the machines DNS server list

I wanted my gateway to resolve it's new local domain so in the file /etc/dhcp3/dhclient.conf I removed the comment from the line:

prepend domain-name-servers 127.0.0.1;