DHCP – automatic network configuration

Table of Contents

DHCP – automatic network configuration

Almost all networks use DHCP to share network configuration (such as ip-addresses) automatically. This document explains how to setup your own DHCP server using Fedora Core.

© 2005 Tero Karvinen www.iki.fi/karvinen

Server has static ip-configuration, it shares network configuration to workstations. Required network information consists of

  • IP-address, identifies the computer on the Internet
  • Network mask, toghether with IP-address defines which address belong to local network (LAN). Packages to LAN are sent directly.
  • Gateway, the default router. Connects LAN to Internet.
  • Nameservers (DNS), returns addresses for server names such as www.iki.fi

All network information must be available and working before it is distributed with a DHCP server. DHCP server simply distributes settings that allready work.


DHCP Server Setup

Install dhcp server.

# yum install dhcp

Create the settings file. The “subnet .. netmask” row defines which network interface (network card) is used, so server’s own static IP-address must be within the block defined.

# /etc/dhcpd.conf # www.iki.fi/karvinen/dhcp.html
subnet 10.0.0.0 netmask 255.255.255.0 {
   range 			10.0.0.10 10.0.0.253;
   option routers		10.0.0.254;
   option domain-name-servers	10.0.0.8;
   option subnet-mask		255.255.255.0;
}

Make the log print on your screen continously so you can fix possible errors.

# tail -f /var/log/messages &

You can end the tail program with ‘fg’, ctrl-C.

Start the server

# /etc/init.d/dhcpd start


Test with a Client

Request network configuration using another computer as a client. Check if you got correct network configuration from server.

client# /etc/init.d/network restart
client# /sbin/ifconfig

If you client got network configuration from your DHCP-server, well done, you have a DHCP server.

If necessary, make it start automatically with chkconfig (don’t do this in Helia labs).


See also

Example homework reports, in Finnish: Sandelin 2004: 2. DHCP Myllymäki 2005: Harjoitus 2: DHCP-palvelin

Related page: PXE network-booting-pxe



Posted in Old Site | Tagged , , , , , , , | Comments Off on DHCP – automatic network configuration

Comments are closed.