Cisco's DHCP and VLAN synthesis experiment
Experimental content:
PC1 and PC2 need to obtain an IP address through DHCP Server . R1 do one-arm routing and DHCP Relay,R2 interface f2/0 IP address is 192.168.3.1. and PC1 belongs to Vlan10,PC2 belongsto Vlan20,R3(DHCP Server ) belongs to VLAN30.
PC1 belongs to 192.168.1.0 network segment, Gateway is 192.168.1.254 PC2 belongs to 192.168.2.0 network segment, Gateway is 192.168.2.254
Extension and Repair map:
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/14/96b4d679f9342a4c3be70f90ac891662.png-wh_500x0-wm_3 -wmp_4-s_3387517040.png "title=" topology map. png "style=" Float:none; "alt=" 96b4d679f9342a4c3be70f90ac891662.png-wh_ "/>
Experimental ideas:
in the VLAN 10,20,30 is configured on the S1, and the E0/2 port is a trunk port
R1 to Create a sub-interface for the VLAN30. And each sub-interface specifies the encapsulation mode and the IP address of the specified DHCP Server .
The default route to the host needs to be configured on the DHCP Server
Experiment Configuration:
s1 (config) #vlan 10 s1 (Config-vlan) #vlan 20s1 (Config-vlan) #vlan 30s1 (Config-vlan) #do show vlan See if it is created and is active S1 (config) #interface ETHERNET 0/0S1 (config-if) #switchport access vlan 10s1 (config-if) #inter e0/1s1 ( CONFIG-IF) #swi acc vlan 20s1 (config-if) #inter e0/3s1 (config-if) #swi ac vlan  30S1 (config-if) #inter e0/2s1 (config-if) #switchport trunk encapsulation dot1q Note Don't forget this step S1 (config-if) #switchport mode trunk
s1 (config-if) #do show inter e0/2 switchport See if 0/2 ports are trunk port R1 (config) #interface fastethernet 0/0.1r1 (config-subif) #encapsulation dot1Q 10 Specifies the encapsulation mode and the VlanR1 (CONFIG-SUBIF) #ip for the sub-interface add 192.168.1.254  255.255.255.0R1 (config-subif) #ip helper-address 192.168.3.1 Specify DHCP server IP address (relay Agent) R1 (config) #interface fastethernet 0/0.2r1 (config-subif) #encapsulation Dot1q 20
r1 (config-subif) #ip add 192.168.2.254 255.255.255.0r1 ( CONFIG-SUBIF) #ip helper-address 192.168.3.1 r1 (config) #interface fa0/0.3r1 ( CONFIG-SUBIF) #encapsulation dot1Q 30 Note: Here to create a sub-interface for Dhcp server R1 ( CONFIG-SUBIF) #ip add 192.168.3.254 255.255.255.0r1 (config-subif) #inter fa0/0 r1 ( CONFIG-IF) #no shutdown r2 (config) #ip dhcp excluded-address 192.168.1.200 192.168.1.255r2 (config) #ip dhcp excluded-address 192.168.2.200 192.168.2.255r2 (config) #ip  DHCP POOL PC1
R2 (dhcp-config) #network 192.168.1.0 255.255.255.0r2 (dhcp-config) #default-ROUTER 192.168.1.254R2 (dhcp-config) #dns-server 8.8.8.8r2 (dhcp-config) #lease 2 3 4r2 (config) #ip dhcp POOL PC2R2 (dhcp-config) #network 192.168.2.0 255.255.255.0r2 (dhcp-config) #default-router 192.168.2.254R2 (dhcp-config) #dns-server 8.8.8.8r2 (dhcp-config) #lease 2 3 4r2 (config) #ip route 0.0.0.0 0.0.0.0 192.168.3.254 Configure a default route to the host (otherwise PC gets ip failed) R2 (config) #inter fa2/0r2 (config-if) #ip add 192.168.3.1 255.255.255.0R2 (config-if) #no sh
Experimental validation:
Start PC1 no IP address
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/14/7a9826368f1e95392fd5809653251199.png-wh_500x0-wm_3 -wmp_4-s_2258166.png "style=" Float:none; "title=" No Ip.png "alt=" 7a9826368f1e95392fd5809653251199.png-wh_ "/>
PC1 use DHCP to obtain an IP address:
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/14/eb831063663dcffee8b41ec98e89e157.png-wh_500x0-wm_3 -wmp_4-s_911661480.png "style=" Float:none; "title=" Request Ip.png "alt=, Eb831063663dcffee8b41ec98e89e157.png-wh_"/>
PC1 successfully acquired the IP address:
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/14/84b55b0ad18413bc9411eac0255ab151.png-wh_500x0-wm_3 -wmp_4-s_3085239988.png "style=" Float:none; "title=" validates the result. png "alt=" 84b55b0ad18413bc9411eac0255ab151.png-wh_ "/>
This article from "I-Rookie" blog, declined reproduced!
Integrated use of DHCP and VLANs (CISCO)