Overview

In TCP/IP world, the word host refers to any device with an IP address, this could be your phone, tablet, PC, server, router, switch—any device that uses IP to provide a service or just needs an IP address to be managed. It can also mean some less-obvious devices as well like Electronic advertising video screen at the mall, your electrical power meter that uses the same technology as mobile phones to submit your electrical usage information for billing, your new car.

Now, for these devices to have an IP address in order to communicate with one another, they had to either be configured manually by the administrator or learned automatically. Configuring by an administrator means it is static, and if it’s learned automatically, it means, there is a server responsible for giving out the IP addresses upon request by the clients. Either way, any host that uses IPv4 needs four IPv4 settings to work properly, no matter the type of host and these are;

  • IP address,
  • Subnet mask
  • Default routers
  • DNS server IP addresses

Dynamic Host Configuration Protocol (DHCP)

Dynamic Host Configuration Protocol (DHCP) provides one of the most commonly used services in a TCP/IP network. The vast majority of hosts in a TCP/IP network are user devices, and the vast majority of user devices learn their IPv4 settings using DHCP. The DHCP server uses UDP port 67 while the client uses UDP port 68. Using DHCP has several advantages over the other option of manually configuring IPv4 settings.

  • The configuration of host IP settings sits in a DHCP server, with each client learning these settings using DHCP messages. As a result, the host IP configuration is controlled by the IT staff, rather than on local configuration on each host, resulting in fewer user errors.
  • DHCP allows both the permanent assignment of host addresses, but more commonly, DHCP assigns a temporary lease of IP addresses. With these leases, the DHCP server can reclaim IP addresses when a device is removed from the network, making better use of the available addresses.
  • DHCP also enables mobility. For example, every time a user moves to a new location with a tablet computer—to a coffee shop, a client location, or back at the office—the user’s device can connect to another wireless LAN, use DHCP to lease a new IP address in that LAN, and begin working on the new network.
  • Without DHCP, the user would have to ask for information about the local network and configure settings manually, with more than a few users making mistakes.

 DHCP Concepts

The host acts as a DHCP client. As a DHCP client, the host begins with no IPv4 settings—no IPv4 address, no mask, no default router, and no DNS server IP addresses. But a DHCP client does have knowledge of the DHCP protocol, so the client can use that protocol to (a) discover a DHCP server and (b) request to lease an IPv4 address. DHCP uses the following four messages between the client and server. (Also, as a way to help remember the messages, note that the first letters spell DORA):

  • Discover:  DHCP client sends a broadcast to find a willing DHCP server
  • Offer:  The DHCP Server offers and IP address to the client
  • Request: DHCP client sends a request to the server to lease the IP address
  • Acknowledgement: The DHCP server sends an IP to the client and update its database

DHCP clients, however, have a somewhat unique problem: they do not have an IP address yet, hence, their reason for making a request but how do they communicate with a server without an IP address? To make that work, DHCP messages make use of two special IPv4 addresses that allow a host that has no IP address to still be able to send and receive messages on the local subnet :

  • 0.0.0.0: An address reserved for use as a source IPv4 address for hosts that do not yet have an IP address.
  • 255.255.255.255: The local broadcast IP address. Packets sent to this destination address are broadcast on the local data link, but routers do not forward them.

Host A, a client, sends a Discover message, with source IP address of 0.0.0.0 because host A does not have an IP address to use yet. Host A sends the packet to destination 255.255.255.255, which is sent in a LAN broadcast frame, reaching all hosts in the subnet. The client hopes that there is a DHCP server on the local subnet. Why? Packets sent to 255.255.255.255 only go to hosts in the local subnet; router R1 will not forward this packet. (This example shows details assuming the DHCP client chooses to use a DHCP option called the broadcast flag

Now look at the Offer message sent back by the DHCP server. The server sets the destination IP address to 255.255.255.255 again. Why? Host A still does not have an IP address, so the server cannot send a packet directly to host A. So, the server sends the packet to “all local hosts in the subnet” address (255.255.255.255). (The packet is also encapsulated in an Ethernet broadcast frame.)

Note, all hosts in the subnet will receive the Offer message. However, the original Discover message lists a number called the client ID, which includes the host’s MAC address, that identifies the original host (host A in this case). As a result, host A knows that the Offer message is meant for host A. The rest of the hosts will receive the Offer message, but notice that the message lists another device’s DHCP client ID, so the rest of the hosts ignore the Offer message.

DHCP for Remote Subnets with DHCP Relay

As a network engineer, do you have to put a DHCP server in every LAN subnet or better to locate the DHCP server in a central site?

Cisco routers can act as the DHCP server, so a distributed design could use the router at each site as the DHCP server. With a DHCP server in every subnet, the protocol flows stay local to each LAN. However, a centralized DHCP server approach has advantages as well, it allows for centralized control and configuration of all the IPv4 addresses assigned throughout the enterprise. In fact, some Cisco design documents suggest a centralized design as a best practice because of the above given reason, centralized control and configuration of all the IPv4 addresses assigned throughout the enterprise.

With a centralized DHCP server, those DHCP messages that flowed only on the local subnet will now have to flow over the IP network to the centralized DHCP server and back. To make that work, the routers connected to the remote LAN subnets need an interface subcommand:

  • the ip helper-address server-ip command.

The ip helper-address server-ip subcommand tells the router to do the following for the messages coming in an interface, from a DHCP client:

1. Watch for incoming DHCP messages, with destination IP address 255.255.255.255.
2. Change that packet’s source IP address to the router’s incoming interface IP address.
3. Change that packet’s destination IP address to the address of the DHCP server (as configured in the ip helper-address command).
4. Route the packet to the DHCP server.

Note: This feature, by which a router relays DHCP messages by changing the IP addresses in the packet header, is called DHCP relay.

Host A sits on the left, as a DHCP client. The DHCP server (172.16.2.11) sits on the right. R1 has an ip helper-address 172.16.2.11 command configured, under its G0/0 interface. At step 1, router R1 notices the incoming DHCP packet from 0.0.0.0, destined for 255.255.255.255. Step 2 shows the results of changing both the source and destination IP address, with R1 routing the packet.

The router uses a similar process for the return DHCP messages from the server. First, for the return packet from the DHCP server, the server simply reverses the source and destination IP address of the packet received from the router (relay agent). The Discover message lists source IP address 172.16.1.1, so the server sends the Offer message back to destination IP address 172.16.1.1.
When a router receives a DHCP message, addressed to one of the router’s own IP addresses, the router realizes the packet might be part of the DHCP relay feature. When that happens, the DHCP relay agent (router R1) needs to change the destination IP address, so that the real DHCP client (host A), which does not have an IP address yet, can receive and process the packet.

Releasing and Renewing DHCP Settings

DHCP servers can assign many network configuration settings automatically. These include IP addresses, default gateways, primary and secondary DNS servers, primary and secondary WINS servers, and more. When computers use dynamic addressing, they are assigned a lease on a specific IP address. This lease is good for a specific time period and must be renewed periodically. When the lease needs to be renewed, the computer contacts the DHCP server that provided the lease. If the server is available, the lease is renewed and a new lease period is granted. You can also renew leases manually as necessary on individual computers or by using the DHCP server itself.

Problems can occur during the lease assignment and renewal process that prevent network communications.

If the server isn’t available and cannot be reached before a lease expires, the IP address can become invalid. If this happens, the computer might use the alternate IP address configuration to set an alternate address, which in most cases has settings that are inappropriate and prevent proper communications. To resolve this problem, you’ll need to release and then renew the DHCP lease. Another type of problem occurs when users move around to various offices and subnets within the organization. Although moving from location to location, their computers might obtain DHCP settings from the wrong server. When the users return to their offices, the computers might seem sluggish or perform incorrectly due to the settings assigned by the DHCP server at another location. If this happens, you’ll need to release and then renew the DHCP lease.

The lease command takes up to three options: lease days [hours] [minutes], with hours and minutes being optional.

  • You can specify a maximum period of 365 days, 23 hours and 59 minutes, and a minimum of 1 second. The default is one day. The shorter the lease period, the faster you can reconfigure DHCP options that may need to change.

Short lease periods also permit IP addresses to be returned to the address pool for reallocation more quickly. This can be useful in environments where a large number of end devices connect and disconnect frequently, as in public wireless networks, such as at an airport. A short lease period of say 30 minutes might be useful to ensure that IP addresses are returned quickly to the shared pool. However, short lease periods also mean that workstations must renew their leases more often, which puts an extra strain on the network and DHCP server.

Conversely, a small office with a stable workforce may choose to increase their lease periods. Long lease periods can also reduce the impact of DHCP server failures. Unless a workstation reboots or needs to.

DHCP Summary

  1. Only one scope per subnet
  2. If DHCP gets disconnected, the computers connected or relying on the DHCP will stay connected until their lease expires .
  3. If a computer is assigned to use DHCP and cannot find a DHCP server, it will automatically assign itself an IP address called APIPA which has a range of 169.254.x.x
  4. ipconfig/release -resets the IP lease 
  5. Ipconfig/renew -renews the IP lease 

Domain Name System (DNS)

DNS is used to convert the domain name of the websites to their numerical IP address. It is a host name to IP address translation service. It is an application layer protocol for message exchange between clients and servers. Every host is identified by the IP address but remembering numbers is very difficult for the people and also the IP addresses are not static therefore a mapping is required to change the domain hostname like www.google.com to it’s IP address. This is called a forward lookup. You can also do a reverse lookup which is IP address to hostname 

Hierarchy of Name Servers

  • Root name servers
    It is contacted by name servers that can not resolve the name. It contacts authoritative name server if name mapping is not known. It then gets the mappin g and return the IP address to the host.
  • Top level server
    It is responsible for com, org, edu etc and all top level country domains like uk, fr, ca, in etc. They have info about authoritative domain servers and know names and IP addresses of each authoritative name server for the second level domains.
  • Authoritative name servers
    This is organization’s DNS server, providing authoritative hostname to IP mapping for organization servers. It can be maintained by organization or service provider. In order to reach cse.dtu.in we have to ask the root DNS server, then it will point out to the top level domain server and then to authoritative domain name server which actually contains the IP address. So the authoritative domain server will return the associative ip address.

Domain :

  • There are various kinds of DOMAIN :
    1. Generic domain : .com(commercial) .edu(educational) .mil(military) .org(non profit organization) .net(similar to commercial) all these are generic domain.
  • 2. Country domain .ae (UAE) .in(INDIA) .us(UNITED STATES) .uk (UNITED KINGDOM) .np(NEPAL) .au(AUSTRALIA) .pk(PAKISTAN)
  • 3. Inverse domain if we want to know what is the domain name of the website. Ip to domain name mapping. So, DNS can provide both the mapping for example to find the ip addresses of practonet.com then we have to type nslookup www.practonet.com.

The client machine sends a request to the local name server, which , if root does not find the address in its database, sends a request to the root name server, which in turn, will route the query to an intermediate or authoritative name server. The root name server can also contain some hostName to IP address mappings. The intermediate name server always knows who the authoritative name server is. So finally the IP address is returned to the local name server which in turn returns the IP address to the host.

<< See DHCP Configurations for Server, Client and Relay Agent..>>