dhcp mike o’connor eric tallman matt yasiejko. overview dhcp defined dhcp defined how it works how...
TRANSCRIPT
DHCPDHCP
Mike O’ConnorMike O’Connor
Eric TallmanEric Tallman
Matt YasiejkoMatt Yasiejko
OverviewOverview
DHCP definedDHCP defined How it worksHow it works InstallationInstallation dhcpd.confdhcpd.conf rc.confrc.conf
DHCP definedDHCP defined DHCP – Dynamic Host Configuration DHCP – Dynamic Host Configuration
ProtocolProtocol Uses UDP (User Datagram Protocol)Uses UDP (User Datagram Protocol)
Broadcasts without error correctionBroadcasts without error correction
Allows systems to connect to a Allows systems to connect to a network and be assigned necessary network and be assigned necessary network informationnetwork information IP address, subnet, lease periodIP address, subnet, lease period
DHCP definedDHCP defined Simplifies network administrationSimplifies network administration
Automatically assigns and keeps track of IP Automatically assigns and keeps track of IP Addresses on the networkAddresses on the network
Eliminates the necessity of assigning static IP Eliminates the necessity of assigning static IP AddressesAddresses
Static IP can be assigned using DHCP in configurationStatic IP can be assigned using DHCP in configuration Developed from BOOTPDeveloped from BOOTP
Introduced the idea of a lease and IP bindingIntroduced the idea of a lease and IP binding Purposes:Purposes:
Provide persistent storage of network Provide persistent storage of network parameters for network clientsparameters for network clients
Allocation of temporary or permanent network Allocation of temporary or permanent network (IP) addresses to clients(IP) addresses to clients
DHCP – How it worksDHCP – How it works
http://www.tarunz.org/~vassilii/TAU/protocols/dhcp/timeline.htm
DHCPDISCOVERDHCPDISCOVER
Client finds out which machines out there Client finds out which machines out there are providing a DHCP serverare providing a DHCP server
DHCPOFFERDHCPOFFER
Server responds to DHCPDISCOVER with Server responds to DHCPDISCOVER with possible configuration parameters for the possible configuration parameters for the networknetwork
The client collects various DHCPOFFER The client collects various DHCPOFFER responsesresponses
DHCPREQUESTDHCPREQUEST Chooses possible actionChooses possible action
Gets parameters from one server and declines all othersGets parameters from one server and declines all others Missing use defaults; get all; get only requestedMissing use defaults; get all; get only requested
Verifies correctness of parameters of previous Verifies correctness of parameters of previous allocationallocation
Negotiates extended lease of a network addressNegotiates extended lease of a network address
DHCPACK / DHCPNAKDHCPACK / DHCPNAK
Server responds with an ACK or NAKServer responds with an ACK or NAK ACK – initialization of client completeACK – initialization of client complete NAK – client has invalid network informationNAK – client has invalid network information
Use a previous allocationUse a previous allocation Old configuration Old configuration
locatedlocated Server sends Server sends
DHCPACK to clientDHCPACK to client Other DHCPACKs Other DHCPACKs
ignoredignored
IP-subnet-number, IP-subnet-number, hardware-address hardware-address key to find old key to find old configuration configuration parametersparameters
DHCP Message FormatDHCP Message Format
http://www.tarunz.org/~vassilii/TAU/http://www.tarunz.org/~vassilii/TAU/protocols/dhcp/frame.htmprotocols/dhcp/frame.htm
Format used in the handshake Format used in the handshake between client and server to pass between client and server to pass network informationnetwork information
DHCPINFORMDHCPINFORM
DHCP – IP AllocationDHCP – IP Allocation
Automatic allocation – DHCP assigns Automatic allocation – DHCP assigns a permanent address, no human a permanent address, no human interferenceinterference
Dynamic allocation – DHCP assigns Dynamic allocation – DHCP assigns an IP for a lease periodan IP for a lease period
Manual allocation – Network Manual allocation – Network administrator assigns an IPadministrator assigns an IP
DHCP Lease DatabaseDHCP Lease Database
/var/lib/dhcp/dhcpd.leases stores the /var/lib/dhcp/dhcpd.leases stores the DHCP client lease database DHCP client lease database
Lease lengthLease length To whom the IP is assignedTo whom the IP is assigned MAC addressMAC address
DHCP Lease DatabaseDHCP Lease Databaselease 134.198.161.99 {lease 134.198.161.99 { starts 2 2005/03/01 18:45:39;starts 2 2005/03/01 18:45:39; ends 2 2005/03/01 18:55:39;ends 2 2005/03/01 18:55:39; tstp 2 2005/03/01 18:55:39;tstp 2 2005/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 134.198.161.98 {lease 134.198.161.98 { starts 4 2005/03/03 03:01:59;starts 4 2005/03/03 03:01:59; ends 4 2005/03/03 03:11:59;ends 4 2005/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 *courtesy of Robert Huylo and Ana Chanaba
http://www.cs.uofs.edu/%7Eplishka/cmps354/DHCP1.ppthttp://www.cs.uofs.edu/%7Eplishka/cmps354/DHCP1.ppt
Defining the subnetDefining the subnet
10000110.11000110.10100001.01101100 (134.198.161.106) BITWISE AND11111111.11111111.11111000.00000000 (255.255.248.0)--------------------------------------------------------------------------10000110.11000110.10100000.00000000 (134.198.160.0)
Subnet
Installing DHCP ServerInstalling DHCP Server
Ensure that the Ensure that the bpfbpf device is device is compiled in the kernelcompiled in the kernel Berkeley Packet Filter Berkeley Packet Filter Provides a raw interface to data link Provides a raw interface to data link
layers in a protocol independent fashionlayers in a protocol independent fashion Install the net/isc-dhcp3-server portInstall the net/isc-dhcp3-server port
Make install cleanMake install clean
Installing DHCP ServerInstalling DHCP Server
cp cp /usr/local/etc/dhcpd.conf.sample /usr/local/etc/dhcpd.conf.sample /usr/local/etc/dhcpd.conf/usr/local/etc/dhcpd.conf Modify dhcpd.confModify dhcpd.conf
dhcpd.confdhcpd.conf
dhcpd.confdhcpd.conf file 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 Assign IP Addresses based on MAC
AddressesAddresses
Installing DHCP ServerInstalling DHCP Server
Start the serverStart 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 Modify rc.conf to make the daemon run on startuprun on startup
rc.confrc.conf
hostname=“lab6.research.cs.uofs.edu”hostname=“lab6.research.cs.uofs.edu”ifconfig_dc0=“inet 134.198.161.106 ifconfig_dc0=“inet 134.198.161.106
netmask 255.255.248.0”netmask 255.255.248.0”defaultrouter=“134.198.161.254”defaultrouter=“134.198.161.254”hostname=“lab6.research.cs.uofs.edu”hostname=“lab6.research.cs.uofs.edu”dhcpd_enable=“YES”dhcpd_enable=“YES”dhcpd_conf=“/usr/local/etc/dhcpd_conf=“/usr/local/etc/
dhcpd.conf”dhcpd.conf”sshd_enable=“YES”sshd_enable=“YES”
ResourcesResources
http://www.freebsd.org/doc/en_US.Ihttp://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-SO8859-1/books/handbook/network-dhcp.htmldhcp.html
http://www.tarunz.org/~vassilii/TAU/http://www.tarunz.org/~vassilii/TAU/protocols/dhcp/toc.htmprotocols/dhcp/toc.htm
RFC 2131RFC 2131