Вы находитесь на странице: 1из 9

Vision Infosystems (VIS)

Chapter
DHCP Service

Topics Covered
Overview of DHCP Service How DHCP works DHCP Addressing DHCP Options Configuration of DHCP Server DHCP Relay Agent Service Monitoring and Maintaining DHCP Server Question on DHCP Service

Page No. : 1

www.visioninfosystems.org

Vision Infosystems (VIS)

DHCP
Overview The Dynamic Host Configuration Protocol (DHCP) is based on the Bootstrap Protocol (BOOTP) and older version of DHCP, which allows to automatically assign TCP/IP configuration to clients that have DHCP enabled. DHCP is specified in RFC 2131. Cisco routers running Cisco IOS software include DHCP server and relay agent software. The Cisco IOS DHCP server is a full DHCP server implementation that assigns and manages IP addresses from specified address pools within the router to DHCP clients. DHCP uses port number 67 and 68. DHCP client uses port 67 to communicate with DHCP server and DHCP server uses port 68 to communicate with client. DHCP consists of three components: A DHCP Server : A server which store configuration information and assign IP to client computers. A DHCP Client : A Client computers which are DHCP enabled and receives TCP/IP configuration information from DHCP Server. A DHCP Relay Agent : A relay agent accepts request from DHCP client computer which are located in non-DHCP subnet and forwards it to DHCP server. We will cover DHCP relay again more in details later on.

Benefits of DHCP Reduced Client Configuration Task Easy of configure and Use Reduced Internet Access Cost Centralized Management

How DHCP Works When the client boots and initializes its network hardware, it sends out a DHCPDISCOVER message to find the DHCP server. The DHCPDISCOVER packet contains the source MAC is the client's MAC, destination MAC as FFFFFF-FFFFFF (i.e. Broadcast MAC address).

Page No. : 2

www.visioninfosystems.org

Vision Infosystems (VIS)

When the DHCP server receives the DHCPDISCOVER packet, it sends a DHCP OFFER packet. The OFFER packet contains the list of parameters that DHCP server is going to offer the client. The parameter includes IP address, DHCP server address, lease details, etc.

When the client receives the DHCP OFFER it sends DHCPREQUEST message that he is ready to accept the configuration details provided by the DHCP server.

On receipt of DHCP REQUEST packet by the DHCP server, it sends a DHCP ACK packet to confirm it or DHCP NOACK to reject the request.

DHCP addressing DHCP supports three mechanisms for IP address allocation: Automatic addressing: DHCP assigns a permanent IP address to a client. There is no limit or time duration for the IP address. Dynamic allocation: DHCP assigns an IP address to a client for a limited period of time, which is called a lease. On expiry of lease the client IP address is automatically release. These binding information is stored on a remote server like FTP, TFTP, server. The server that hosts this binding database is called as DHCP database agent. Manual allocation: In this method client MAC address is bind to IP address manually. So that client gets a fixed IP address. This method is generally users for servers, network printers, routers, etc. These binding information is stored on router NV-RAM.

Page No. : 3

www.visioninfosystems.org

Vision Infosystems (VIS)

DHCP Options DHCP server not only provides IP address, but also provides other parameters like DNS address, Gateway, etc. DHCP options are other configuration TCP/IP parameters which DHCP server provides the client computers. The various DHCP option are Lease duration Subnet Mask Router Address DNS Address WINS/NetBIOS Address TFTP server address, etc

Configuration of DHCP Server Command


()# ip dhcp database url seconds | write-delay seconds] ()# ip dhcp pool [pool name] ()# network mask] [network address] [subnet [timeout

Explanation To configure DHCP database agent Creating a DHCP Pool Specify the range of pool Specify DHCP options

()# default-router 10.0.0.1 ()# dns-server 10.0.0.1

()# netbios-name-server 10.0.0.1 ()# ip dhcp exclude-address address] [high-address] ()# lease [days infinite ] ()# import all 1) host address [mask |/prefix-length] 2) hardware-address hardware-address type bootfile filename | hours | [low-

To set exclusion in DHCP pool To set the lease duration To import all DHCP option into DHCP pool Specifies the IP address and subnet mask of the Client and specify a hardware address for the client. Specifies the name of the file that is used as a boot image for client to load operating systems.

Minutes

Page No. : 4

www.visioninfosystems.org

Vision Infosystems (VIS)

Ip address DHCP

Set an interface of router to be a DHCP client.

Now let start configuration of DHCP server on Cisco ISO router. We will take a scenario to understand and configure the DHCP service. In the below given scenario we have a DHCP server (Which provides IP address), a DHCP Database agent (Store binding database) and DHCP clients. Example - I

Configuration of DHCP server


Ip dhcp database ftp://192.168.1.2 ip dhcp pool vision network 192.168.1.0/24 dns-server 203.10.12.118 default-gateway 192.168.1.1 lease 10 ip dhcp exclude-address 192.168.1.0 192.168.1.2

Example - II This is how we have to configure DHCP server. Now let see a example of DHCP server hosting multiple pool for multiple network segment. In our next example we have created 3 different pools for different network and all the database is stored on a single FTP server.
ip dhcp database ftp:// 172.16.4.253/router-dhcp write-delay 120 ip dhcp excluded-address 172.16.1.100 172.16.1.103 ip dhcp excluded-address 172.16.2.100 172.16.2.103 ip dhcp pool 0

Page No. : 5

www.visioninfosystems.org

Vision Infosystems (VIS)


network 172.16.0.0 /16 domain-name vision.com dns-server 172.16.1.102 172.16.2.102 netbios-name-server 172.16.1.103 172.16.2.103 netbios-node-type h-node ip dhcp pool 1 network 172.16.1.0 /24 default-router 172.16.1.100 172.16.1.101 lease 30 ! ip dhcp pool 2 network 172.16.2.0 /24 default-router 172.16.2.100 172.16.2.101 lease 30

Example - III Example of Manual Bindings The following example creates a manual binding for a client named Mars.cisco.com. The MAC address of the client is 02c7.f800.0422 and the IP address of the client is 172.16.2.254.
ip dhcp pool vision host 172.16.2.254 hardware-address 02c7.f800.0422 ieee802 client-name pc3

DHCP Relay Agent Service DHCP relay agent is also called as BOOTP relay agent. This service or feature helps a DHCP server to provide DHCP service to many DHCP subnets or network. With the help of this service DHCP service is extended beyond its local subnet. With a single DHCP server we can provide DHCP server to all or many networks. A DHCP relay agent is a bridge between DHCP server and DHCP clients located on remote subnet. DHCP relay agent accepts DHCP request from DHCP client and forwards the same to DHCP server.

Now let see how DHCP relay agent help to provide DHCP service to non-DHCP subnet or a subnet without DHCP server. When a client sends a DHCP DISCOVER packet, the packet is

Page No. : 6

www.visioninfosystems.org

Vision Infosystems (VIS)

broadcasted. But since the DHCP server is located in different subnet or across the router, the broadcast packet cannot cross the boundary of router as router always drops broadcast packets. So the DHCP DISCOVER packet cannot reach the DHCP server located on remote subnet. So DHCP rely agent helps to resolve this scenario. When a DHCP client sends a DHCP DISCOVER broadcast packet, the DHCP relay agent receives the packet and send the packet as unicast to DHCP server located on remote subnet. So due DHCP relay agent which know the IP address of DHCP server, it converts the broadcast packet into unicast packet and forwards the same to DHCP server located on remote subnet, so that the packet dont get dropped by the router. This Cisco ISO based router also works as DHCP relay agent, the procedure to this is a sample single command used on router interface i.e. ip helper-address <address>. This command must be applied on the interface from which traffic arrives. This command is not only used by relay agent service but also help to transport broadcast packet across the router by converting it into unicast packet. The helper-address command, by default forward following UDP-based broadcast packets. Protocol Time TACACS DNS BOOTP/DHCP server BOOTP/DHCP Client TFTP NetBIOS name Service NetBIOS datagram Service Port Number 37 49 53 67 68 69 137 138

If you dont want to forward a specify type protocol use the command no ip forward-protocol udp <port>. This command tells the helper-address command that not to forward broadcast traffic of this specific port. Example : In this example we will configure the router to forwards all broadcast packet received by the F0 interface of Router B to host 192.168.1.1 and not to forward port 137 and 138 traffic.

Page No. : 7

www.visioninfosystems.org

Vision Infosystems (VIS)

Configuring Router B as relay agent


Interface FastEthernet 0 Ip address 20.0.0.1 255.0.0.0.0 Ip help-address 192.168.1.1 No ip forward-protocol udp 137 No ip forward-protocol udp 138

Monitoring and Maintaining the DHCP server There are series of commands to manage DHCP server. Below are the list of command which helps a administrator the manage DHCP server.
Commands Router# clear ip dhcp binding address Explanation Deletes an automatic address binding from the DHCP database. Specifying address clears the automatic binding for a specific (client) IP address whereas specifying asterisk (*) clears all automatic bindings. Clears an address conflict from the DHCP database. Specifying address clears the conflict for a specific IP address whereas specifying an asterisk (*) clears conflicts for all addresses. Resets all DHCP server counters to 0. Enabling Debugging of DHCP server

Router# clear ip dhcp conflict address

Router# clear ip dhcp server statistics Router# debug ip dhcp server {events |packets | linkage} show ip dhcp binding [address]

Displays a list of all bindings created on a specific DHCP server. Displays a list of all address conflicts recorded by a specific DHCP server. Displays recent activity on the DHCP database. Displays count information about server statistics and messages sent and received.

show ip dhcp conflict [address]

show ip dhcp database [url] show ip dhcp server statistics

Questions 1) What ports are used by DHCP server and DHCP Client 2) How does a client get IP from DHCP Server 3) What is a role of DHCP server
Page No. : 8 www.visioninfosystems.org

Vision Infosystems (VIS)

4) What is lease time 5) What is boot file 6) Does ip helper-address support TCP based protocol 7) Which command is used to debug DHCP packets 8) Which command is used to view DHCP bindings 9) What is manual binding 10) What happens if you have 2 DHCP server 11) How can to use 2 DHCP servers in a network; one acting as backup of another 12) What is exclusion

Page No. : 9

www.visioninfosystems.org

Вам также может понравиться