DHCP Mike O’Connor Eric Tallman Matt Yasiejko
Overview DHCP defined DHCP defined How it works How it works Installation Installation dhcpd.conf dhcpd.conf rc.conf rc.conf
DHCP defined DHCP – Dynamic Host Configuration Protocol DHCP – Dynamic Host Configuration Protocol Uses UDP (User Datagram Protocol) Uses UDP (User Datagram Protocol) Broadcasts without error correction Broadcasts without error correction Allows systems to connect to a network and be assigned necessary network information Allows systems to connect to a network and be assigned necessary network information IP address, subnet, lease period IP address, subnet, lease period
DHCP defined Simplifies network administration Simplifies network administration Automatically assigns and keeps track of IP Addresses on the network Automatically assigns and keeps track of IP Addresses on the network Eliminates the necessity of assigning static IP Addresses Eliminates the necessity of assigning static IP Addresses Static IP can be assigned using DHCP in configuration Static IP can be assigned using DHCP in configuration Developed from BOOTP Developed from BOOTP Introduced the idea of a lease and IP binding Introduced the idea of a lease and IP binding Purposes: Purposes: Provide persistent storage of network parameters for network clients Provide persistent storage of network parameters for network clients Allocation of temporary or permanent network (IP) addresses to clients Allocation of temporary or permanent network (IP) addresses to clients
DHCP – How it works
DHCPDISCOVER Client finds out which machines out there are providing a DHCP server Client finds out which machines out there are providing a DHCP server
DHCPOFFER Server responds to DHCPDISCOVER with possible configuration parameters for the network Server responds to DHCPDISCOVER with possible configuration parameters for the network The client collects various DHCPOFFER responses The client collects various DHCPOFFER responses
DHCPREQUEST Chooses possible action Chooses possible action Gets parameters from one server and declines all others Gets parameters from one server and declines all others Missing use defaults; get all; get only requested Missing use defaults; get all; get only requested Verifies correctness of parameters of previous allocation Verifies correctness of parameters of previous allocation Negotiates extended lease of a network address Negotiates extended lease of a network address
DHCPACK / DHCPNAK Server responds with an ACK or NAK Server responds with an ACK or NAK ACK – initialization of client complete ACK – initialization of client complete NAK – client has invalid network information NAK – client has invalid network information
Use a previous allocation Old configuration located Server sends DHCPACK to client Other DHCPACKs ignored IP-subnet-number, hardware-address key to find old configuration parameters
DHCP Message Format ls/dhcp/frame.htm ls/dhcp/frame.htm ls/dhcp/frame.htm ls/dhcp/frame.htm Format used in the handshake between client and server to pass network information Format used in the handshake between client and server to pass network information DHCPINFORM DHCPINFORM
DHCP – IP Allocation Automatic allocation – DHCP assigns a permanent address, no human interference Automatic allocation – DHCP assigns a permanent address, no human interference Dynamic allocation – DHCP assigns an IP for a lease period Dynamic allocation – DHCP assigns an IP for a lease period Manual allocation – Network administrator assigns an IP Manual allocation – Network administrator assigns an IP
DHCP Lease Database /var/lib/dhcp/dhcpd.leases stores the DHCP client lease database /var/lib/dhcp/dhcpd.leases stores the DHCP client lease database Lease length Lease length To whom the IP is assigned To whom the IP is assigned MAC address MAC address
DHCP Lease Database lease { starts /03/01 18:45:39; starts /03/01 18:45:39; ends /03/01 18:55:39; ends /03/01 18:55:39; tstp /03/01 18:55:39; tstp /03/01 18:55:39; binding state free; binding state free; hardware ethernet 00:c0:f0:30:d7:11; hardware ethernet 00:c0:f0:30:d7:11; uid "\001\000\300\3600\327\021"; uid "\001\000\300\3600\327\021";} lease { starts /03/03 03:01:59; starts /03/03 03:01:59; ends /03/03 03:11:59; ends /03/03 03:11:59; binding state active; binding state active; next binding state free; next binding state free; hardware ethernet 00:e0:4c:96:f3:95; hardware ethernet 00:e0:4c:96:f3:95; client-hostname "lab112.research.cs.uofs.edu"; client-hostname "lab112.research.cs.uofs.edu";} *courtesy of Robert Huylo and Ana Chanaba
Defining the subnet ( ) BITWISE AND ( ) ( ) Subnet
Installing DHCP Server Ensure that the bpf device is compiled in the kernel Ensure that the bpf device is compiled in the kernel Berkeley Packet Filter Berkeley Packet Filter Provides a raw interface to data link layers in a protocol independent fashion Provides a raw interface to data link layers in a protocol independent fashion Install the net/isc-dhcp3-server port Install the net/isc-dhcp3-server port Make install clean Make install clean
Installing DHCP Server cp /usr/local/etc/dhcpd.conf.sample /usr/local/etc/dhcpd.conf cp /usr/local/etc/dhcpd.conf.sample /usr/local/etc/dhcpd.conf Modify dhcpd.conf Modify dhcpd.conf
dhcpd.conf dhcpd.conf file dhcpd.conf file dhcpd.conf file dhcpd.conf file Domain Name System (DNS) Domain Name System (DNS) ddns-update-style none; ddns-update-style none; host mailhost { host mailhost { hardware ethernet 02:03:04:05:06:07; hardware ethernet 02:03:04:05:06:07; fixed-address mailhost.example.com; } fixed-address mailhost.example.com; } Assign IP Addresses based on MAC Addresses
Installing DHCP Server Start the server Start the server /usr/local/etc/rc.d/isc-dhcpd.sh start /usr/local/etc/rc.d/isc-dhcpd.sh start Modify rc.conf to make the daemon run on startup Modify rc.conf to make the daemon run on startup
rc.conf hostname=“lab6.research.cs.uofs.edu” ifconfig_dc0=“inet netmask ” defaultrouter=“ ”hostname=“lab6.research.cs.uofs.edu”dhcpd_enable=“YES”dhcpd_conf=“/usr/local/etc/dhcpd.conf”sshd_enable=“YES”
Resources 1/books/handbook/network-dhcp.html 1/books/handbook/network-dhcp.html 1/books/handbook/network-dhcp.html 1/books/handbook/network-dhcp.html ls/dhcp/toc.htm ls/dhcp/toc.htm ls/dhcp/toc.htm ls/dhcp/toc.htm RFC 2131 RFC 2131