Sometimes, we only know the domain name of a remote host. In this case, we use Domain Name System (DNS) protocol to get the corresponding IP address.
When the sender and receiver are located in the same subnet, and the sender only knows the receiver's IP address, sender can use Address Resolution Protocol (ARP) to find out the receivers MAC address. In order to find the receiver's MAC Address, the sender will transmit a Layer 2 ARP broadcast, which is received by every other devices on the same ethernet segment. Only the device with the matching IP address will unicast back an ARP Reply with its MAC address. The sender thus knows both the MAC address and IP address of the receiver therefore can establish connection.
To verify tha a router or switch has the appropriate Layer 2 mappings, we can use command "show ip arp" under EXEC mode. The following is an example output of command "show ip arp" on a cisco 2811 Router, where protocol field indicates the protocol for network address in the Address field, age field indicates the age of the cache entry in minutes. A hyphen (-) means that the address is local, type field indicates the encapsulation type that the Cisco IOS software is using in the network address in this entry (possible values include: ARPA, SNAP and SAP), interface indicates the interface associated with this network address.
Router#show ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.0.1 - 0001.C9B1.8E01 ARPA FastEthernet0/0
Internet 192.168.0.101 0 00E0.B077.6A99 ARPA FastEthernet0/0
On the other hand, when a PC boots up, it only knows its own MAC address. To get an IP address for it, we use Reverse ARP (RARP) in ancient time and Dynamic Host Configuration Protocol (DHCP) nowdays.
RARP is the ancient way of getting IP address for diskless computers using the network. It is very simple! When the booting computer sends the broadcast RARP request with its own MAC address, a seperate device, RARP server will check its MAC Address-to-IP table and reply with the matching IP address. This way the booting computer will know its own IP address by broadcasting its MAC address. The problems with RARP is the MAC Address-to-IP table must be statically configured in every single RARP server in the network, render it hard to manage. In addition, RARP is not scalable because it requires one RARP Server per subnet.
DHCP came to rescue. Similar to RARP, DHCP provides IP address, default gateway IP Address, sometimes DNS server IP address to the DHCP client. However, there are two big advantages: DHCP Server use IP pool, which is a range of IP addresses dynamically assigned to requesting PCs. There's no need for a static MAC-to-IP mapping in DHCP Server anymore. Furthermore, we can assign addresses to different subnets when using a router (more on this later). For more detail about DHCP, check the definition document RFC 1541.
DHCP Process is similar to RARP,
1. When the DHCP client wants an IP address, it broadcasts DHCPDISCOVER message "Are there any DHCP Server out there?". The destination IP address is 255.255.255.255, which is sent to all-subnets. Since the client have no IP address yet, the source IP address is 0.0.0.0.
2. A seperate device, DHCP server, upon receiving the discover message, will dynamically pick an IP address from its IP pool and broadcast an DHCPOFFER message "Here's an address for you". DHCPOFFER message could contain other information such as subnet mask, default gateway, IP address lease time, and domain name server.
3. The client indicates acceptance of the offer by selecting the offered address and broadcasting a DHCPREQUEST message "Sure, I'll take that one." (It is called request message because the client might deny the offer by requesting another IP address.)
4. Once receiving acceptance message from the client, the DHCP server seals the deal by broadcasting an acknowledgement message (DHCPACK) "Great! Have fun on the internet!".
When the DHCP client and DHCP server are not on the same subnet, either a router or a host on the DHCP client's subnet must act as a DHCP relay agent to support the forwarding of DHCP messages between the DHCP client and DHCP server.
CCNA Lab Video Tutorial 6 – Router as DHCP Server
Mini Lab on a PC:
shows the ip configurations
the output shows more options for command ipconfig.
- /all displays the full TCP/IP configuration for all adapters.
- /renew Renews DHCP configuration for all adapters.
- /release sends a DHCPRELEASE message to the DHCP server to release the current DHCP configuration and discard the IP address configuration for all adapters.
- /flushdns purges the DNS resolver cache.
- /registerdns refreshes all DHCP leases and re-registers DNS names.
- /displaydns displays the contents of the DNS resolver cache.
- /showclassid displays all the DHCP class IDs allowed for adapter.
- /setclassid modifies the DHCP class id.
shows the entire arp table
For more information, watch this cisco TV
ICND1 and ICND2 break down