Create a Linux Router with DHCP services

It’s pretty easy to build a Linux router even on a virutal machine. I’ve used virtualbox to create a LAN NAT router with DHCP services using webmin. However, I’m not going to cover on how to use a virtualbox VM 🙂

Let’s create the NAT Router first.

On Webmin go to Networking > Network Configuration > Routing and Gateways


  1. Select right ethernet interface on Default Route
  2. Fillup the correct gateway
  3. Enable “Act as a Router”

On Networking > Linux Firewall > Select “Reset Firewall”

  1. Do network address translation on external interface: <select your WAN interface>
  2. Click Setup Firewall
  3. Finally “Apply Configuration”

Your Linux NAT router is now ready 🙂

Now Setting up simple DHCP Server using Webmin

Install DHCP server

Option A): Centos 5.8

# yum  install  dhcp

Set the DHCP service to start on boot

# chkconfig  dhcpd  on

Start DHCP service

# service dhcpd start

Option B): Ubuntu 10.04

sudo apt-get install dhcp3-server

2.- Setting up

My network design is the following:

Network name: Intranet
Network adsress:
Address range: –  (DHCP server can give 75 IPs)
Domain: mydomain.intranet
Default routers:
Broadcast address:
DNS servers: -> DNS Server Local (our own DNS Server, within our network) -> DNS Server External (ISP company)

Now do the following:

  • Access webmin from any browser (use your own IP number):     https://your_IP:10000
  • First refresh modules:   Webmin -> Webmin Configuration -> Refresh Modules
  • Servers -> DHCP Server  – >  Add a new subnet.
  • Fill boxes and click create
  • Servers -> DHCP Server ->  Edit Client Options
  • Fill boxes   (Antención with dot at the end of intranet!!!!!!!!)
  • on the same screen mark Interim in “DNS update style” and click save
  • Finally start DHCP server

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.