KanREN DHCP Seminar November 7-9, 2005

Initial Subnet Configuration

The server looks for its configuration files in the directory /var/dhcp, so create the directory and cd into it.

lab1:/usr/local/src # cd /var

lab1:/var # mkdir dhcp

lab1:/var # cd dhcp

lab1:/var/dhcp #

Create a basic configuration file, dhcpd.conf, based on these settings. Change the values appropriately for your yellow network.

# This server is authoritative for the subnets it serves.

authoritative;

# Don't try to register hosts in DDNS (for now).

ddns-update-style none;

# Define the subnet the server is attached to:

subnet 192.168.10.0 netmask 255.255.255.0 {

option routers 192.168.10.254;

range 192.168.10.32 192.168.10.63;

}

When the server is first installed, it won't start until you create an empty lease database for it, so “touch” the lease file.

lab1:/var/dhcp # touch dhcpd.leases

Run the server in test mode (-t) to check your configuration. If the test output shows any errors, look at the line number of the first error listed, and make corrections in your configuration file. (One error can often cause spurious error reports for valid entries later in the configuration, so it's usually best to fix errors one at a time.

lab1:/var/dhcp # dhcpd -t

Internet Systems Consortium DHCP Server V3.0.4b2

Copyright 2004-2005 Internet Systems Consortium.

All rights reserved.

For info, please visit http://www.isc.org/sw/dhcp/

lab1:/var/dhcp #

Once your configuration file is error-free, start your server.

lab1:/var/dhcp # dhcpd

Internet Systems Consortium DHCP Server V3.0.4b2

Copyright 2004-2005 Internet Systems Consortium.

All rights reserved.

For info, please visit http://www.isc.org/sw/dhcp/

Wrote 0 leases to leases file.

Listening on BPF/xl0/00:50:da:10:e5:8c/192.168.10/24

Sending on BPF/xl0/00:50:da:10:e5:8c/192.168.10/24

Sending on Socket/fallback/fallback-net

lab1:/var/dhcp #

Now test your server. Plug the yellow network into your computer, make sure your computer is set to use DHCP, and you should get an IP address from the 192.168.<your-network>.32 – 63 range.

On Windows, you can open a command line window and use ipconfig to check your IP address, and ipconfig /all to check other information including which DHCP server granted you the address.

On Macintosh OS X, you can use the Network Pane in System Preferences to view your settings. Double-click the interface from the list (in my case, “Built-in Ethernet”), and you should see a variety of information including the current IP address.

Finally, make sure your PC's default gateway and routing are working properly. Normally I'd use ping to test that, but the PIX firewall that's NATting our classroom doesn't permit pings, so we'll use telnet. And we haven't configured nameservice yet, so we'll have to telnet by IP instead of by hostname. So from your PC (or Mac):

vlan402-dhcp11:~ neufeld$ telnet 164.113.130.2 22

Trying 164.113.130.2...

Connected to 164.113.130.2.

Escape character is '^]'.

SSH-1.99-OpenSSH_3.6.1p1 FreeBSD-20030924

^]

telnet> quit

Connection closed.

Success!

2005-11-07T09:22:35