DHCP Lab Guide
1 DHCP Lab Guide
1.1 Lab Introduction
1.1.1 Background
A company has about 40 employees in total. In order to allow employees to conveniently
work and search for information on the Internet, the company deploys a network in the office
area. Employees' PCs can access the Internet after connecting to the network.
Considering the convenience of employees to access the Internet, the network
administrator decides to enable the Dynamic Host Configuration Protocol (DHCP) function on
the switch to automatically assign IP addresses to PCs connected to the network, and assign a
fixed IP address to the printer. As the network administrator of the company, you need to perform
appropriate configurations to meet the requirements above.
1.1.2 Lab Purpose
(1) Understand and master the working principles of DHCP.
(2) Master how to configure DHCP.
1.1.3 Lab Topology
Figure 1-1 Topology of the DHCP Lab
1.1.4 Lab Requirements
(1) PC1 belongs to the Finance Department (VLAN 10), it is assigned to the IP address segment
[Link]/24, and its gateway is [Link].
(2) PC2 belongs to the Sales Department (VLAN 20), it is assigned to the IP address segment
[Link]/24, and its gateway is [Link]. The company's printer provides the printing
service for the whole company. Due to IP address planning, the printer is assigned to the
VLAN, to which the Finance Department belongs.
(3) SW, as the core switch of the company, serves as the gateway of PC1, PC2, and the printer.
It automatically assigns addresses to these terminals. The lease period of the IP addresses
1
DHCP Lab Guide
obtained by the terminals is 8 hours. Due to the special attributes of the printer, its IP address
is fixed to [Link].
(4) In the address segment of the Sales Department, IP addresses after [Link] are not
allowed to be assigned and must be reserved.
(5) The DNS addresses used by the company's terminals to access the Internet are
[Link] and [Link].
1.1.5 Configuration Ideas
(1) Configure VLAN 10 and VLAN 20 on the core switch, configure IP addresses for switch virtual
interfaces (SVIs), use them as the gateways of the terminals.
(2) Enable the DHCP service and complete basic DHCP configurations.
(3) Assign a fixed IP address to the printer.
(4) Check the IP addresses obtained by the terminals and the DHCP binding entries on the core
switch.
1.1.6 Procedure
(1) Configure VLAN 10 and VLAN 20 on the core switch, configure IP addresses for SVIs, use
them as the gateways of the terminals.
Ruijie-SW(config)#vlan range 10,20
Ruijie-SW(config)#vlan 10
Ruijie-SW(config-vlan)#add interface g0/0
Ruijie-SW(config-vlan)#add interface g0/2
Ruijie-SW(config-vlan)#exit
Ruijie-SW(config)#vlan 20
Ruijie-SW(config-vlan)#add interface g0/1
Ruijie-SW(config-vlan)#exit
Ruijie-SW(config)#interface vlan 10
Ruijie-SW(config-if-VLAN 10)#ip address [Link] 24
Ruijie-SW(config-if-VLAN 10)#exit
Ruijie-SW(config)#interface vlan 20
Ruijie-SW(config-if-VLAN 20)#ip address [Link] 24
Ruijie-SW(config-if-VLAN 20)#exit
(2) Enable the DHCP service and complete basic DHCP configurations.
Ruijie-SW(config)#service dhcp
Ruijie-SW(config)#ip dhcp pool Finance
Ruijie-SW(dhcp-config)#network [Link] [Link]
Ruijie-SW(dhcp-config)#default-router [Link]
Ruijie-SW(dhcp-config)#dns-server [Link] [Link]
Ruijie-SW(dhcp-config)#lease 0 8 0
Ruijie-SW(config)#ip dhcp pool Sales
Ruijie-SW(dhcp-config)#network [Link] [Link]
Ruijie-SW(dhcp-config)#default-router [Link]
Ruijie-SW(dhcp-config)#dns-server [Link] [Link]
Ruijie-SW(dhcp-config)#lease 0 8 0
Ruijie-SW(dhcp-config)#exit
(3) Assign a fixed IP address to the printer.
Ruijie-SW(config)#ip dhcp pool Printer
2
DHCP Lab Guide
Ruijie-SW(dhcp-config)#hardware-address 0c05.2859.3e01 //MAC
address of the router physical port
Ruijie-SW(dhcp-config)#host [Link] [Link]
Ruijie-SW(dhcp-config)#lease 0 8 0
Ruijie-SW(dhcp-config)#dns-server [Link] [Link]
Ruijie-SW(dhcp-config)#default-router [Link]
(4) In the address segment of the Sales Department, IP addresses after [Link] are not
allowed to be assigned and must be reserved.
Ruijie-SW(config)#ip dhcp excluded-address [Link]
[Link]
1.1.7 Result Verification
(1) Check IP addresses obtained by PC1 and PC2 (in the simulator environment, use a simulator
to simulate PCs and the printer, and run the ip address dhcp command on the ports to enable
them to obtain IP addresses automatically).
PC 1:
Ruijie-PC1(config)#interface gigabitEthernet 0/0
Ruijie-PC1(config-if-GigabitEthernet 0/0)#no switchport
Ruijie-PC1(config-if-GigabitEthernet 0/0)#ip address dhcp
PC2:
Ruijie-PC2(config)#interface gigabitEthernet 0/0
Ruijie-PC2(config-if-GigabitEthernet 0/0)#no switchport
Ruijie-PC2(config-if-GigabitEthernet 0/0)#ip address dhcp
(2) Check the IP address obtained by the printer.
Ruijie-Printer(config)#interface gigabitEthernet 0/0
Ruijie- Printer (config-if-GigabitEthernet 0/0)#no switchport
Ruijie- Printer (config-if-GigabitEthernet 0/0)#ip address dhcp
(3) Check DHCP binding entries on the core switch. The entries show that the three terminals
obtain expected IP addresses, the IP address obtained by the printer is manually configured,
and the IP addresses obtained by other PCs are automatically acquired.
3
DHCP Lab Guide
4
DHCP Relay Lab Guide
2 DHCP Relay Lab Guide
2.1 Lab Introduction
2.1.1 Background
A company has about 40 employees in total. In order to allow employees to conveniently work
and search for information on the Internet, the company deploys a network in the office area.
Employees' PCs can access the Internet after connecting to the network.
Considering the convenience of employees to access the Internet, the network administrator
decides to enable the DHCP function on the switch to automatically assign IP addresses to
PCs connected to the network and assign a fixed IP address to the printer.
To meet the above requirements, the company connects a dedicated DHCP server to the core
switch in bypass mode to assign IP addresses to terminals. As the network administrator of
the company, you need to perform appropriate configurations to meet these requirements.
2.1.2 Lab Purpose
(1) Master the working principles and application scenarios of the DHCP relay technology.
(2) Master configuration key points of DHCP relay.
2.1.3 Lab Topology
Figure 2-1 Topology of the DHCP Relay Lab
2.1.4 Lab Requirements
(1) PC1 belongs to the Finance Department (VLAN 10), it is assigned to the IP address segment
[Link]/24, and its gateway is [Link].
(2) PC2 belongs to the Sales Department (VLAN 20), it is assigned to the IP address segment
[Link]/24, and its gateway is [Link]. The company's printer provides the printing
service for the whole company. Due to IP address planning, the printer is assigned to the
VLAN, to which the Finance Department belongs.
(3) SW, as the core switch of the company, serves as the gateway of PC1, PC2, and the printer.
The DHCP server connected in bypass mode automatically assigns addresses to these
5
DHCP Relay Lab Guide
terminals. The lease period of the IP addresses obtained by the terminals is 8 hours. Due to
the special attributes of the printer, its IP address is fixed to [Link].
(4) The addresses for connecting the DHCP server and SW are [Link]/30 and [Link]/30.
(5) In the address segment of the Sales Department, IP addresses after [Link] are not
allowed to be assigned and must be reserved.
(6) The DNS addresses used by the company's terminals to access the Internet are
[Link] and [Link].
2.1.5 Configuration Ideas
(1) Configure VLAN 10 and VLAN 20 on the core switch, configure IP addresses for SVIs, use
them as the gateways of the terminals.
(2) On the DHCP server, enable the DHCP service and complete basic DHCP configurations,
including performing common DHCP configuration, assigning a fixed IP address to the printer,
and configuring the default route to SW.
(3) Enable the DHCP relay function on SW.
(4) Check the IP addresses obtained by the terminals and the DHCP binding entries on the core
switch.
2.1.6 Procedure
(1) Configure VLANs and IP addresses on the core switch.
Ruijie-SW(config)#vlan 10
Ruijie-SW(config-vlan)#add inter g0/0
Ruijie-SW(config-vlan)#add inter g0/2
Ruijie-SW(config-vlan)#vlan 20
Ruijie-SW(config-vlan)#add inter g0/1
Ruijie-SW(config)#inter vlan 10
Ruijie-SW(config-if-VLAN 10)#ip add [Link] 24
Ruijie-SW(config-if-VLAN 10)#inter vlan 20
Ruijie-SW(config-if-VLAN 20)#ip add [Link] 24
Ruijie-SW(config)#inter g0/3
Ruijie-SW(config-if-GigabitEthernet 0/3)#no switchport
Ruijie-SW(config-if-GigabitEthernet 0/3)#ip add [Link] 30
(2) On the DHCP server, complete DHCP configurations, including performing common DHCP
configuration and assigning a fixed IP address to the printer.
DHCP-Server(config)#inter g0/0
DHCP-Server(config-if-GigabitEthernet 0/0)#no switch
DHCP-Server(config-if-GigabitEthernet 0/0)#ip add [Link] 24
DHCP-Server(config)#ip route [Link] [Link] gigabitEthernet 0/0
[Link]
DHCP-Server(config)#service dhcp
DHCP-Server(config)#ip dhcp pool Finance
DHCP-Server(dhcp-config)#lease 0 8 0
DHCP-Server(dhcp-config)#network [Link] [Link]
DHCP-Server(dhcp-config)#dns-server [Link] [Link]
DHCP-Server(dhcp-config)#default-router [Link]
DHCP-Server(config)#ip dhcp pool Sales
6
DHCP Relay Lab Guide
DHCP-Server(dhcp-config)#lease 0 8 0
DHCP-Server(dhcp-config)#network [Link] [Link]
DHCP-Server(dhcp-config)#dns-server [Link] [Link]
DHCP-Server(dhcp-config)#default-router [Link]
DHCP-Server(config)#ip dhcp pool Printer
DHCP-Server(dhcp-config)#hardware-address 0c05.2859.3e01
DHCP-Server(dhcp-config)#host [Link] [Link]
DHCP-Server(dhcp-config)#lease 0 8 0
DHCP-Server(dhcp-config)#dns-server [Link] [Link]
(3) Enable the DHCP service and relay function on SW.
Ruijie-SW(config)#inter vlan 10
Ruijie-SW(config-if-VLAN 10)#ip helper-address [Link]
Ruijie-SW(config)#inter vlan 20
Ruijie-SW(config-if-VLAN 20)#ip helper-address [Link]
2.1.7 Result Verification
(1) Check IP addresses obtained by PC1 and PC2 (in the simulator environment, use a simulator
to simulate PCs and the printer, and run the ip address dhcp command on the ports to enable
them to obtain IP addresses automatically).
PC1:
Ruijie-PC1(config)#inter g0/0
Ruijie-PC1(config-if-GigabitEthernet 0/0)#no switch
Ruijie-PC1(config-if-GigabitEthernet 0/0)#ip add dhcp
PC 2:
Ruijie-PC2(config)#inter g0/0
Ruijie-PC2(config-if-GigabitEthernet 0/0)#no switch
Ruijie-PC2(config-if-GigabitEthernet 0/0)#ip add dhcp
(2) Check the IP address obtained by the printer.
Ruijie- Printer (config)#inter g0/0
Ruijie- Printer (config-if-GigabitEthernet 0/0)#no switch
Ruijie- Printer (config-if-GigabitEthernet 0/0)#ip add dhcp
7
DHCP Relay Lab Guide
(3) Check DHCP binding entries on DHCP-Server. The entries show that the three terminals
obtain expected IP addresses, and the IP address obtained by the printer is manually
configured, and the IP addresses obtained by other PCs are automatically acquired.
2.2 Key Points of the Lab
(1) The DHCP service must be enabled on both the core switch and DHCP server. Otherwise,
terminals cannot obtain IP addresses.
(2) The default route to the core switch needs to be configured on the DHCP server. If a
professional DHCP server is used such as a Linux or Windows DHCP server, you do not need
to configure this route.