DHCP (Dynamic Host Configuration Protocol) servers provide all the basic information the client wants to operate on the network, including DNS address, Default Gateway, IP addresses, subnet masks, and many more in detail.
In this lab, we have one switch and 16 PCs. Our task is to assign all the PCs to their VLANs and configure the DHCP server for all VLANs. Ultimately, ensure all the PCs get their IP addresses from the DHCP server.
SW-dhcp-(config)#vlan 20
SW-dhcp-(config-vlan)#name vlan20
SW-dhcp-(config-vlan)#exit
SW-dhcp-(config)#vlan 30
SW-dhcp-(config-vlan)#name vlan30
SW-dhcp-(config-vlan)#exit
SW-dhcp-(config)#vlan 40
SW-dhcp-(config-vlan)#name vlan40
SW-dhcp-(config-vlan)#exit
SW-dhcp-(config)#interface range ethernet 1/0-3
SW-dhcp-(config-if-range)#switchport
SW-dhcp-(config-if-range)#switchport mode access
SW-dhcp-(config-if-range)#switchport access vlan 20
SW-dhcp-(config-if-range)#exit
- configure the topology as per the diagram
- configure VLAN 10,20,30, and 40
- assign ports to their VLANs
- configure IP addresses for VLANs
- VLAN 10 192.168.1.1/24
- VLAN 20 192.168.2.1/24
- VLAN 30 192.168.3.1/24
- VLAN 40 192.168.4.1/24
- configure DHCP server for all VLANs
- ensure that all PCs get IPs
- verify with show commands
- configure IP routing command
SW-dhcp-(config)#vlan 10
SW-dhcp-(config-vlan)#name vlan10
SW-dhcp-(config-vlan)#exit
SW-dhcp-(config-vlan)#name vlan10
SW-dhcp-(config-vlan)#exit
SW-dhcp-(config)#vlan 20
SW-dhcp-(config-vlan)#name vlan20
SW-dhcp-(config-vlan)#exit
SW-dhcp-(config)#vlan 30
SW-dhcp-(config-vlan)#name vlan30
SW-dhcp-(config-vlan)#exit
SW-dhcp-(config)#vlan 40
SW-dhcp-(config-vlan)#name vlan40
SW-dhcp-(config-vlan)#exit
SW-dhcp-(config)#interface range ethernet 0/0-3
SW-dhcp-(config-if-range)#switchport
SW-dhcp-(config-if-range)#switchport mode access
SW-dhcp-(config-if-range)#switchport access vlan 10
SW-dhcp-(config-if-range)#exit
SW-dhcp-(config-if-range)#switchport
SW-dhcp-(config-if-range)#switchport mode access
SW-dhcp-(config-if-range)#switchport access vlan 10
SW-dhcp-(config-if-range)#exit
SW-dhcp-(config)#interface range ethernet 1/0-3
SW-dhcp-(config-if-range)#switchport
SW-dhcp-(config-if-range)#switchport mode access
SW-dhcp-(config-if-range)#switchport access vlan 20
SW-dhcp-(config-if-range)#exit
SW-dhcp-(config)#interface range ethernet 2/0-3
SW-dhcp-(config-if-range)#switchport
SW-dhcp-(config-if-range)#switchport mode access
SW-dhcp-(config-if-range)#switchport access vlan 30
SW-dhcp-(config-if-range)#exit
SW-dhcp-(config-if-range)#switchport
SW-dhcp-(config-if-range)#switchport mode access
SW-dhcp-(config-if-range)#switchport access vlan 30
SW-dhcp-(config-if-range)#exit
SW-dhcp-(config)#interface range ethernet 3/0-3
SW-dhcp-(config-if-range)#switchport
SW-dhcp-(config-if-range)#switchport mode access
SW-dhcp-(config-if-range)#switchport access vlan 40
SW-dhcp-(config-if-range)#exit
SW-dhcp-#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active
10 vlan10 active Et0/0, Et0/1, Et0/2, Et0/3
20 vlan20 active Et1/0, Et1/1, Et1/2, Et1/3
30 vlan30 active Et2/0, Et2/1, Et2/2, Et2/3
40 vlan40 active Et3/0, Et3/1, Et3/2, Et3/3
SW-dhcp-(config)#interface vlan 10
SW-dhcp-(config-if)#ip address 192.168.1.1 255.255.255.0
SW-dhcp-(config-if)#no shutdown
SW-dhcp-(config-if)#exit
SW-dhcp-(config)#interface vlan 20
SW-dhcp-(config-if)#ip address 192.168.2.1 255.255.255.0
SW-dhcp-(config-if)#no shutdown
SW-dhcp-(config-if)#exit
SW-dhcp-(config)#interface vlan 30
SW-dhcp-(config-if)#ip address 192.168.3.1 255.255.255.0
SW-dhcp-(config-if)#no shutdown
SW-dhcp-(config-if)#exit
SW-dhcp-(config)#interface vlan 40
SW-dhcp-(config-if)#ip address 192.168.4.1 255.255.255.0
SW-dhcp-(config-if)#no shutdown
SW-dhcp-(config-if)#exit
SW-dhcp-(config)#end
SW-dhcp-#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Vlan10 192.168.1.1 YES manual up up
Vlan20 192.168.2.1 YES manual up up
Vlan30 192.168.3.1 YES manual up up
Vlan40 192.168.4.1 YES manual up up
SW-dhcp-(config)#service dhcp
SW-dhcp-(config)#ip dhcp pool vlan10
SW-dhcp-(dhcp-config)#network 192.168.1.2 255.255.255.0
SW-dhcp-(dhcp-config)#default-router 192.168.1.1
SW-dhcp-(dhcp-config)#dns-server 8.8.8.8
SW-dhcp-(dhcp-config)#exit
SW-dhcp-(config)#service dhcp
SW-dhcp-(config)#ip dhcp pool vlan20
SW-dhcp-(dhcp-config)#network 192.168.2.2 255.255.255.0
SW-dhcp-(dhcp-config)#default-router 192.168.2.1
SW-dhcp-(dhcp-config)#dns-server 8.8.8.8
SW-dhcp-(dhcp-config)#exit
SW-dhcp-(config-if-range)#switchport
SW-dhcp-(config-if-range)#switchport mode access
SW-dhcp-(config-if-range)#switchport access vlan 40
SW-dhcp-(config-if-range)#exit
SW-dhcp-#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active
10 vlan10 active Et0/0, Et0/1, Et0/2, Et0/3
20 vlan20 active Et1/0, Et1/1, Et1/2, Et1/3
30 vlan30 active Et2/0, Et2/1, Et2/2, Et2/3
40 vlan40 active Et3/0, Et3/1, Et3/2, Et3/3
SW-dhcp-(config)#interface vlan 10
SW-dhcp-(config-if)#ip address 192.168.1.1 255.255.255.0
SW-dhcp-(config-if)#no shutdown
SW-dhcp-(config-if)#exit
SW-dhcp-(config)#interface vlan 20
SW-dhcp-(config-if)#ip address 192.168.2.1 255.255.255.0
SW-dhcp-(config-if)#no shutdown
SW-dhcp-(config-if)#exit
SW-dhcp-(config)#interface vlan 30
SW-dhcp-(config-if)#ip address 192.168.3.1 255.255.255.0
SW-dhcp-(config-if)#no shutdown
SW-dhcp-(config-if)#exit
SW-dhcp-(config)#interface vlan 40
SW-dhcp-(config-if)#ip address 192.168.4.1 255.255.255.0
SW-dhcp-(config-if)#no shutdown
SW-dhcp-(config-if)#exit
SW-dhcp-(config)#end
SW-dhcp-#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Vlan10 192.168.1.1 YES manual up up
Vlan20 192.168.2.1 YES manual up up
Vlan30 192.168.3.1 YES manual up up
Vlan40 192.168.4.1 YES manual up up
SW-dhcp-(config)#service dhcp
SW-dhcp-(config)#ip dhcp pool vlan10
SW-dhcp-(dhcp-config)#network 192.168.1.2 255.255.255.0
SW-dhcp-(dhcp-config)#default-router 192.168.1.1
SW-dhcp-(dhcp-config)#dns-server 8.8.8.8
SW-dhcp-(dhcp-config)#exit
SW-dhcp-(config)#service dhcp
SW-dhcp-(config)#ip dhcp pool vlan20
SW-dhcp-(dhcp-config)#network 192.168.2.2 255.255.255.0
SW-dhcp-(dhcp-config)#default-router 192.168.2.1
SW-dhcp-(dhcp-config)#dns-server 8.8.8.8
SW-dhcp-(dhcp-config)#exit
SW-dhcp-(config)#service dhcp
SW-dhcp-(config)#ip dhcp pool vlan30
SW-dhcp-(dhcp-config)#network 192.168.3.2 255.255.255.0
SW-dhcp-(dhcp-config)#default-router 192.168.3.1
SW-dhcp-(dhcp-config)#dns-server 8.8.8.8
SW-dhcp-(dhcp-config)#exit
SW-dhcp-(config)#ip dhcp pool vlan30
SW-dhcp-(dhcp-config)#network 192.168.3.2 255.255.255.0
SW-dhcp-(dhcp-config)#default-router 192.168.3.1
SW-dhcp-(dhcp-config)#dns-server 8.8.8.8
SW-dhcp-(dhcp-config)#exit
SW-dhcp-(config)#service dhcp
SW-dhcp-(config)#ip dhcp pool vlan40
SW-dhcp-(dhcp-config)#network 192.168.4.2 255.255.255.0
SW-dhcp-(dhcp-config)#default-router 192.168.4.1
SW-dhcp-(dhcp-config)#dns-server 8.8.8.8
SW-dhcp-(dhcp-config)#exit
SW-dhcp-(config)#ip routing
SW-dhcp-(config)#exit
SW-dhcp-#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type State Interface
Hardware address/
User name
192.168.1.2 0100.5079.6668.00 Dec 15 2024 11:16 AM Automatic Active Vlan10
192.168.1.3 0100.5079.6668.01 Dec 15 2024 11:16 AM Automatic Active Vlan10
192.168.1.4 0100.5079.6668.02 Dec 15 2024 11:16 AM Automatic Active Vlan10
192.168.1.5 0100.5079.6668.03 Dec 15 2024 11:16 AM Automatic Active Vlan10
192.168.2.2 0100.5079.6668.04 Dec 15 2024 11:17 AM Automatic Active Vlan20
192.168.2.3 0100.5079.6668.05 Dec 15 2024 11:17 AM Automatic Active Vlan20
192.168.2.4 0100.5079.6668.06 Dec 15 2024 11:17 AM Automatic Active Vlan20
192.168.2.5 0100.5079.6668.07 Dec 15 2024 11:17 AM Automatic Active Vlan20
192.168.3.2 0100.5079.6668.0d Dec 15 2024 11:17 AM Automatic Active Vlan30
192.168.3.3 0100.5079.6668.0c Dec 15 2024 11:17 AM Automatic Active Vlan30
192.168.3.4 0100.5079.6668.0b Dec 15 2024 11:17 AM Automatic Active Vlan30
192.168.3.5 0100.5079.6668.0a Dec 15 2024 11:18 AM Automatic Active Vlan30
192.168.4.2 0100.5079.6668.14 Dec 15 2024 11:16 AM Automatic Active Vlan40
192.168.4.3 0100.5079.6668.15 Dec 15 2024 11:16 AM Automatic Active Vlan40
192.168.4.4 0100.5079.6668.16 Dec 15 2024 11:17 AM Automatic Active Vlan40
192.168.4.5 0100.5079.6668.17 Dec 15 2024 11:17 AM Automatic Active Vlan40
SW-dhcp-(config)#ip dhcp pool vlan40
SW-dhcp-(dhcp-config)#network 192.168.4.2 255.255.255.0
SW-dhcp-(dhcp-config)#default-router 192.168.4.1
SW-dhcp-(dhcp-config)#dns-server 8.8.8.8
SW-dhcp-(dhcp-config)#exit
SW-dhcp-(config)#ip routing
SW-dhcp-(config)#exit
SW-dhcp-#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type State Interface
Hardware address/
User name
192.168.1.2 0100.5079.6668.00 Dec 15 2024 11:16 AM Automatic Active Vlan10
192.168.1.3 0100.5079.6668.01 Dec 15 2024 11:16 AM Automatic Active Vlan10
192.168.1.4 0100.5079.6668.02 Dec 15 2024 11:16 AM Automatic Active Vlan10
192.168.1.5 0100.5079.6668.03 Dec 15 2024 11:16 AM Automatic Active Vlan10
192.168.2.2 0100.5079.6668.04 Dec 15 2024 11:17 AM Automatic Active Vlan20
192.168.2.3 0100.5079.6668.05 Dec 15 2024 11:17 AM Automatic Active Vlan20
192.168.2.4 0100.5079.6668.06 Dec 15 2024 11:17 AM Automatic Active Vlan20
192.168.2.5 0100.5079.6668.07 Dec 15 2024 11:17 AM Automatic Active Vlan20
192.168.3.2 0100.5079.6668.0d Dec 15 2024 11:17 AM Automatic Active Vlan30
192.168.3.3 0100.5079.6668.0c Dec 15 2024 11:17 AM Automatic Active Vlan30
192.168.3.4 0100.5079.6668.0b Dec 15 2024 11:17 AM Automatic Active Vlan30
192.168.3.5 0100.5079.6668.0a Dec 15 2024 11:18 AM Automatic Active Vlan30
192.168.4.2 0100.5079.6668.14 Dec 15 2024 11:16 AM Automatic Active Vlan40
192.168.4.3 0100.5079.6668.15 Dec 15 2024 11:16 AM Automatic Active Vlan40
192.168.4.4 0100.5079.6668.16 Dec 15 2024 11:17 AM Automatic Active Vlan40
192.168.4.5 0100.5079.6668.17 Dec 15 2024 11:17 AM Automatic Active Vlan40
PC1> ip dhcp
DDORA IP 192.168.1.2/24 GW 192.168.1.1
PC1> show ip
NAME : PC1[1]
IP/MASK : 192.168.1.2/24
GATEWAY : 192.168.1.1
DNS : 8.8.8.8
DHCP SERVER : 192.168.1.1
DHCP LEASE : 84926, 86400/43200/75600
MAC : 00:50:79:66:68:00
LPORT : 10018
RHOST:PORT : 127.0.0.1:10019
MTU: : 1500
No comments:
Post a Comment