Configure Router as DHCP server

In this article I describe the commands to configure router as DHCP server for CCNA exam. DHCP Dynamic Host Configuration Protocol is related to application layer of TCP/IP Suite model. The DHCP Dynamic Host Configuration Protocol assign the IP address to the devices connected in the network. DHCP Dynamic Host Configuration Protocol forward the packets for configuration of IP address in the network. The DHCP Dynamic Host Configuration Protocol is reliable so if any new device connected in the network, it will automatically got the IP address for communication with the network ID. A standard DHCP table is maintained by the DHCP servers for all connected devices in the network. A router can be used as DHCP server, you need to configure router as DHCP server to get the DHCP services from the router.

Before going to learn about DHCP Dynamic Host Configuration Protocol we need to remember the OSI suite and TCP/IP suite model and the types of memory used in router to save various files.

RAM

RAM is an acronym that stands for Random Access Memory. RAM of a router works like RAM of a computer. RAM is a volatile memory so it needs power all time. Router loads the IOS and the configuration file in RAM when the router is power on or reboot. It store the data like routing table and running config files. Data transfer speed of RAM of router is very fast. The running configuration remain save in the RAM or router until the power is available. Later these settings can be copied to start up configuration for future use. RAM stores data in power on condition of router. All data in RAM erased automatically if router is power off. The size of RAM in router is generally in MB. The size may be 16 MB, 32 MB.

RAM of a router keep the running configuration file, routing table and other information related to the interfaces of the router. When we works on CLI of a router actually we are working in the RAM of router. To take the back up configuration of Router, We need to copy the running configuration into startup configuration to save the current settings of the router. The startup configuration saved in the NVRAM which can be used later after rebooting the router.

ROM

ROM is acronym that stands for Read Only Memory. Data on ROM is write once only. After writing the data on ROM router can read the data but can not change it. ROM stores the bootstrap of IOS which is responsible to boot the router. Bootstrap find the IOS image file and run the IOS in RAM of router. ROM keep the instructions for POST process when router is power ON. ROM is chip on motherboard and it is programmed once only. ROM is just like the BIOS system of the computer. The booting process starts from the ROM of the router. ROM is a non volatile memory which does not require any power all the time to keep save the information in it. We can not do any changes in the ROM of a router. The settings of ROM configured by the firm so it is generally known as a firmware. The another internal component of router is NVRAM which is very similar to the ROM.

You may also like to read --  Back up configuration of Router

NVRAM

NVRAM keep the startup configuration file which is a backup copy of the running configuration. For back up configuration of Router we need to copy the running configuration to the startup configuration. Every time when the router power on the settings of startup configuration loaded into the RAM of the router. NVRAM is also a non volatile memory similar to ROM. In switches NVRAM stores the information of VLANs. When we configure VLAN in a switch the VLAN configuration saved into the NVRAM memory of the switch.

NVRAM stands for Nonvolatile Random Access Memory. NVRAM is like RAM but it is non volatile memory. It means NVRAM stores the data after power of the router. NVRAM stores the startup config file. Startup config file contains the routing table and other configuration which was copied from a running config file. The difference between NVRAM and ROM is that the content of ROM can not be changed but the content of NVRAM is changeable. When router is power on it search the startup config file in NVRAM only.

Flash Memory

Flash memory is a kind of EEPROM. EEPROM stands for Electrically Erasable Programmable Read-Only Memory. The content of Flash memory can not be change like ROM. Flash memory stores the IOS image. The data of Flash memory remain unchanged when the router is reboot or power off. We can say the operating system of router IOS saved in the flash memory. Every time when a router is power on the IOS loaded into the RAM from the Flash memory. The IOS checks all the interface of router when loaded first time in the RAM. To know all the functions or internal component of router you can read the full article related to booting sequence here.

You may also like to read --  Configure and verify Layer2 discovery protocol CDP

Configure Router as DHCP Server explained

Now lets configure router as DHCP server with explanation step by step. DHCP is acronym for Dynamic Host Configure protocol. In a DHCP enabled LAN a new device automatically obtained the IP address. For example, when you connect your mobile phone with Wi-Fi, you don’t need to enter IP address manually. It is very difficult to assign IP address for each host in a large network. DHCP is very useful to avoid such things. Without router DHCP facility can also be achieved. You need a layer three switch of independent server to configure DHCP without router. in this article we discuss only to configure router as DHCP server.

Physical connectivity to configure router as DHCP server

We require a router with fast Ethernet port of gigabit Ethernet port. This port will work like gateway for LAN. A switch is connected with this port of router. any device connected to this switch will got the IP address according to DHCP configuration. Here we configure the whole LAN in a single network 192.168.1.0/24. We exclude some IP addresses for networking devices like printer, scanner etc. The excluded IP address will not be allotted to any host in the network.

configure router as DHCP server, ccna, ccna tutorials

I designed the above network with a router, switch for DHCP testing. During IP configuration of any device you need an IP address, subnet mask, default gateway and DNS server address. These four things are firstly required to decide. In Router we configure these four things.

Commands required to run in router to configure router as DHCP server

After connecting all device according to above image. Open the router CLI and assign IP address to the port which is connected with switch to Configure Router as DHCP server. Here the port is GigabitEthernet0/0/0. Run the following commands in router CLI to assign IP address and keep the port up.

 Firstly, change the hostname or router to easily identify it
  
 Router>enable
 Router#configure terminal
 Router(config)#hostname ccnatutorials
 ccnatutorials(config)#
  
 Hostname changed to ccnatutorials
  
 ccnatutorials(config)#interface GigabitEthernet0/0/0
 ccnatutorials(config-if)#no shutdown
 ccnatutorials(config-if)#ip address 192.168.1.1 255.255.255.0
 ccnatutorials(config-if)#exit 

After running the above commands, the Gigabitethernet0/0/0 port is up and IP address 192.168.1.1/24 assigned to it, this step is completed to Configure Router as DHCP server.

You may also like to read --  Restore configuration of Router

Commands to configure router as DHCP server

Firstly, we give a pool name to DHCP server. Then we exclude the IP address which will not allotted to the hosts. After that we define the network, default gateway and dns server etc.

 ccnatutorials (config)#ip dhcp excluded-address 192.168.10.1 192.168.10.10
 ccnatutorials(config)#ip dhcp pool ccna
 ccnatutorials(dhcp-config)#network 192.168.1.0 255.255.255.0
 ccnatutorials(dhcp-config)#default-router 192.168.1.1
 ccnatutorials(dhcp-config)#dns-server 192.168.1.1
 ccnatutorials(dhcp-config)#exit
 ccnatutorials(config)#end
 ccnatutorials#
 %SYS-5-CONFIG_I: Configured from console by console
  
 ccnatutorials#wr
 Building configuration...
 [OK]
 ccnatutorials#  

Adding a new host in the network

After configuration or above command, you can add a new host in the network. You don’t need to configure Its Ip address manually. You have to set the IP address with DHCP. It will automatically get the Ip address of the DHCP pool. You can check the devices connected in your LAN.

Check the hosts connected in LAN

To check the connected hosts in LAN you have to run the following command in router CLI. It will show you the hardware physical address and IP address allotted to the device. see the below example of above scenario.

configure router as DHCP server, ccna, ccna tutorials
 ccnatutorials#show ip dhcp binding 
 IP address                   Client-ID/                    Lease expiration Type
 Hardware address
 192.168.1.2                 0040.0B4D.CAD3       -- Automatic
 192.168.1.3                 000D.BDC9.2045        -- Automatic
 ccnatutorials# 

By running above command, we got that IP address 192.168.1.2 is allotted to the PC. The physical address of client host is 0040.0B4D.CAD3. similarly, another one.  

In this article I describe the configure router as DHCP server for CCNA Exam. I hope your found this article helpful. For any query or suggestion you may drop a comment below or contact us. Your suggestions are always welcome by us.

Share this article in your social circle :)
, ,

Leave a Reply

Your email address will not be published. Required fields are marked *