7.DHCP Lab Guide
7.DHCP Lab Guide
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 172.16.1.200.
(4) In the address segment of the Sales Department, IP addresses after 172.16.2.200 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
114.114.114.114 and 8.8.8.8.
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 172.16.1.254 24
Ruijie-SW(config-if-VLAN 10)#exit
Ruijie-SW(config)#interface vlan 20
Ruijie-SW(config-if-VLAN 20)#ip address 172.16.2.254 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 172.16.1.0 255.255.255.0
Ruijie-SW(dhcp-config)#default-router 172.16.1.254
Ruijie-SW(dhcp-config)#dns-server 114.114.114.114 8.8.8.8
Ruijie-SW(dhcp-config)#lease 0 8 0
2
DHCP Lab Guide
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
(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
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 172.16.1.200.
(4) The addresses for connecting the DHCP server and SW are 12.0.0.1/30 and 12.0.0.2/30.
(5) In the address segment of the Sales Department, IP addresses after 172.16.2.200 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
114.114.114.114 and 8.8.8.8.
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 172.16.1.254 24
Ruijie-SW(config-if-VLAN 10)#inter vlan 20
Ruijie-SW(config-if-VLAN 20)#ip add 172.16.2.254 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 12.0.0.1 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 12.0.0.2 24
DHCP-Server(config)#ip route 0.0.0.0 0.0.0.0 gigabitEthernet 0/0
12.0.0.1
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 172.16.1.0 255.255.255.0
DHCP-Server(dhcp-config)#dns-server 114.114.114.114 8.8.8.8
DHCP-Server(dhcp-config)#default-router 172.16.1.254
6
DHCP Relay Lab Guide
DHCP-Server(dhcp-config)#lease 0 8 0
DHCP-Server(dhcp-config)#network 172.16.2.0 255.255.255.0
DHCP-Server(dhcp-config)#dns-server 114.114.114.114 8.8.8.8
DHCP-Server(dhcp-config)#default-router 172.16.2.254
Ruijie-SW(config)#inter vlan 20
Ruijie-SW(config-if-VLAN 20)#ip helper-address 12.0.0.2
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
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.