In this tutorial, we will learn how to configure a router as DHCP server.
The project setup includes one 2621XM Routers, one 2650-24 Switch and 3 Generic End Devices.
Router’s interface fa0/0 are connected with Switch’s interface fa0/1 via a Copper Straight Through cable. The switch is connected with the PCs via Copper Straight Through cables. The ip address of the router's FastEthernet0/0 (fa0/0 in short) interface will be configured as 192.168.10.1 with subnet mask 255.255.255.0.
For this lab, you will enable the DHCP server for the 192.168.10.0/24 interface using a pool of addresses from 192.168.10.11 through 192.168.10.254 (by excluding addresses range from 192.168.10.1 through 192.168.10.10 from the pool). This router (with address 192.168.10.1/24) will be advertised as the default gateway to the clients.
We have walked through the dhcp configuration commands in tutorial 2 - dhcp, here I will explain the key steps.
To define the DHCP address pool, we need to firstly name it. we use the following command under global configuration mode:
R1(config)#ip dhcp pool POOLNAME
In our lab, the following command names the dhcp pool as "IP10", it also brings router to the dhcp configuration mode:
R1(config)#ip dhcp pool IP10
The IP address that the DHCP server assigns are drawn from a common pool that you configure by specifying a range of usable IP addresses. The range of the usable IP addresses is specified by firstly assign a chunk of addresses to the pool with command "net NETADDRESS NETMASK", then exclude some ip addresses from the pool with command "ip dhcp excluded-address STARTADDRESS ENDADRESS". Note that the address range that you specify must also be in the subnet as the IP address of the LAN interface (in our lab, the subnet is 192.168.10.0/24, where the FastEthernet 0/0 interface belongs to).
To set the IP addresses to be used by the address pool, use the following command under dhcp configuration mode:
R1(dhcp-config)#network NETADDRESS NETMASK
In this lab, the following command assigned all the 254 addresses of subnet 192.168.10.0/24 to the pool.
R1(dhcp-config)#net 192.168.10.0 255.255.255.0
To configurer the ip addresses to be excluded from the pool, use the following command under dhcp configuration mode:
R1(dhcp-config)#ip dhcp excluded-address STARTADDRESS ENDADRESS
In our lab, we excluded the addresses range from 192.168.10.1 through 192.168.10.10 from the dhcp pool:
R1(config)#ip dhcp exc 192.168.10.1 192.168.10.10
Optionally, we can also assign a default gateway to the clients. To provide the default gateway IP address, use the following command under dhcp configuration mode:
R1(dhcp-config)#default-router IPADDRESS
For example, the following command set 192.168.10.1 as the default gateway:
R1(dhcp-config)#default 192.168.10.1
Optionally, we can also assign dns servers to the clients. To provide a dns server's IP address, use the following command under dhcp configuration mode:
R1(dhcp-config)#dns-server IPADDRESS
In our lab, we set the dns-server address to 192.168.10.1:
R1(dhcp-config)#dns-server 192.168.10.1
On some cisco routers, you need to turn on the dhcp service with command:
R1(config)#service dhcp
To debug DHCP, use command:
R1(config)#debug ip dhcp server
To see if an address in the DHCP pool is already in use by another device, use command:
R1(config)#show ip dhcp conflict
To display address bindings on the cisco dhcp server, use command:
R1(config)#show ip dhcp binding
————————–the following is the CLI for this lab, some commands are slightly different from this video tutorial——————————
System Bootstrap, Version 12.1(3r)T2, RELEASE SOFTWARE (fc1)
Copyright (c) 2000 by cisco Systems, Inc.
cisco 2621 (MPC860) processor (revision 0x200) with 60416K/5120K bytes of memory
Self decompressing the image :
########################################################################## [OK]
Restricted Rights Legend
Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.
cisco Systems, Inc.
170 West Tasman Drive
San Jose, California 95134-1706
Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-I-M), Version 12.2(28), RELEASE SOFTWARE (fc5)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Wed 27-Apr-04 19:01 by miwang
cisco 2621 (MPC860) processor (revision 0x200) with 60416K/5120K bytes of memory
.
Processor board ID JAD05190MTZ (4292891495)
M860 processor: part number 0, mask 49
Bridging software.
X.25 software, Version 3.0.0.
2 FastEthernet/IEEE 802.3 interface(s)
32K bytes of non-volatile configuration memory.
16384K bytes of processor board System flash (Read/Write)
--- System Configuration Dialog ---
Continue with configuration dialog? [yes/no]: n
Press RETURN to get started!
Router>enable
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
side note: step 1, configure interface fa0/0.
R1(config)#interface FastEthernet0/0
R1(config-if)#ip address 192.168.10.1 255.255.255.0
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
side note: "no shutdown" brings up the fa0/0 interface, the red dots on the link between router and switch changed to green after about 30 seconds.
R1(config-if)#exit
side note: step 2, create a dhcp pool under global configuration mode.
R1(config)#ip dhcp ?
excluded-address Prevent DHCP from assigning certain addresses
pool Configure DHCP address pools
R1(config)#ip dhcp pool IP10
side note: step 3, configure the dhcp pool's range, default gateway, dns server under dhcp configuration mode.
R1(dhcp-config)#?
default-router Default routers
dns-server Set name server
exit Exit from DHCP pool configuration mode
network Network number and mask
no Negate a command or set its defaults
R1(dhcp-config)#network 192.168.10.1 255.255.255.0
R1(dhcp-config)#default-router 192.168.10.1
R1(dhcp-config)#dns-server 192.168.10.1
R1(dhcp-config)#exit
side note: step 4, configure excluded ip addresses from the dhcp pool.
R1(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.10
R1(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
side note: step 5, now check the running configurations and save them.
R1#show running-config
Building configuration...
Current configuration : 484 bytes
!
version 12.2
no service password-encryption
!
hostname R1
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
ip address 192.168.10.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
ip classless
!
!
!
ip dhcp excluded-address 192.168.10.1 192.168.10.10
!
ip dhcp pool IP10
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 192.168.10.1
!
line con 0
line vty 0 4
login
!
!
end
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
side note: step 6, check what ip addresses have been assigned to the clients. Since no client requires ip address at this point, we got an empty table.
R1#show ip dhcp binding
IP address Client-ID/ Lease expiration Type
Hardware address
side note: step 7, Now open the command line window in client PC0, make sure it has no ip address assigned to it with command "ipconfig /all". Require a new ip address for PC0 with command "ipconfig /renew".
Desktop commands |
side note: step 8, Go back to the router's CLI, issue command "show ip dhcp binding" again. Note that the ip address 192.168.10.11 has been associated to PC0's MAC address 00E0.B027.2B35.
R1#show ip dhcp binding
IP address Client-ID/ Lease expiration Type
Hardware address
192.168.10.11 00E0.B027.2B35 -- Automatic
R1#
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Cisco DHCP IOS command references
Here's another suplement video tutorial:
CCNA Lab Video Tutorial
if you want to try out your skill before take ccna exploration exam, -> http://ccnaexamstudy.com/category/practice-exam
ReplyDelete:)
its really very helpful
ReplyDelete