Ubuntu Server 10.04 LTS – DHCP Server
- So you’ve set up a network with your ubuntu server box and shared your internet or something…
You’re not satisfied to enter a static ip on every machine on your network? Well here’s what you need to do:
You need to install a DHCP server so every time a new network device is connected to your local network it automatically gets an IP address.
- Here’s how:
sudo apt-get install dhcp3-server
vi /etc/dhcp3/dhcpd.conf
- Edit your /etc/dhcpd3/dhcpd.conf file to match your taste.
- Here’s my config (just the lines that are not commented and if my local ip is 192.168.17.1 and network name gryphon)
# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages (‘none’, since DHCP v2 didn’t
# have support for DDNS.)
ddns-update-style none;# option definitions common to all supported networks…
option domain-name “vityobug.com”;
option domain-name-servers 192.168.17.1;default-lease-time 600;
max-lease-time 7200;# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;# A slightly different configuration for an internal subnet.
subnet 192.168.17.0 netmask 255.255.255.0 {
range 192.168.17.10 192.168.17.30;
# option domain-name-servers ns1.internal.example.org;
option domain-name “gryphon.vityobug.com”;
option routers 192.168.17.1;
option broadcast-address 192.168.17.255;
default-lease-time 600;
max-lease-time 7200;
- Edit the next file to match your LOCAL network interface (eth0 in the example)
vi /etc/default/dhcp3-server
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. “eth0 eth1″.
INTERFACES=”eth0″
That’s it. Just restart the machine if needed.