1. 程式人生 > >Cisco的DHCP和VLAN綜合實驗

Cisco的DHCP和VLAN綜合實驗

dhcp cisco vlan

Cisco的DHCP和VLAN綜合實驗


實驗內容:

PC1PC2需要通過DHCP Server獲取IP地址。R1做單臂路由和DHCP RelayR2接口f2/0IP地址為192.168.3.1。且PC1屬於vlan10PC2屬於vlan20R3DHCP Server)屬於VLAN30

PC1屬於192.168.1.0網段,網關為192.168.1.254 PC2屬於192.168.2.0網段,網關為192.168.2.254


實驗拓補圖:

技術分享


實驗思路:

  1. 在S1上配置vlan 10,20,30,且e0/2口為trunk口

  2. R1上要為vlan30創建一個子接口。且每個子接口要指定封裝模式和指定DHCP Server的IP地址。

  3. DHCP Server上需要配置去往主機的默認路由


實驗配置:

S1(config)#vlan 10 
S1(config-vlan)#vlan 20
S1(config-vlan)#vlan 30
S1(config-vlan)#do show vlan  查看是否已創建且是否為活動狀態
S1(config)#interface ethernet 0/0
S1(config-if)#switchport access vlan 10
S1(config-if)#inter e0/1
S1(config-if)#swi acc vlan 20
S1(config-if)#inter e0/3
S1(config-if)#swi ac vlan 30
S1(config-if)#inter e0/2
S1(config-if)#switchport trunk encapsulation dot1q 
S1(config-if)#switchport mode trunk 
S1(config-if)#do show inter e0/2 switchport  查看0/2口是否為trunk口

R1(config)#interface fastEthernet 0/0.1
R1(config-subif)#encapsulation dot1Q 10
R1(config-subif)#ip add 192.168.1.254 255.255.255.0
R1(config-subif)#ip helper-address 192.168.3.1  
R1(config)#interface fastEthernet 0/0.2
R1(config-subif)#encapsulation dot1Q 20
R1(config-subif)#ip add 192.168.2.254 255.255.255.0
R1(config-subif)#ip helper-address 192.168.3.1  
R1(config)#interface fa0/0.3
R1(config-subif)#encapsulation dot1Q 30
R1(config-subif)#ip add 192.168.3.254 255.255.255.0
R1(config-subif)#inter fa0/0 
R1(config-if)#no shutdown 

R2(config)#ip dhcp excluded-address 192.168.1.200 192.168.1.255
R2(config)#ip dhcp excluded-address 192.168.2.200 192.168.2.255
R2(config)#ip dhcp pool pc1 
R2(dhcp-config)#network 192.168.1.0 255.255.255.0
R2(dhcp-config)#default-router 192.168.1.254
R2(dhcp-config)#dns-server 8.8.8.8
R2(dhcp-config)#lease 2 3 4
R2(config)#ip dhcp pool pc2
R2(dhcp-config)#network 192.168.2.0 255.255.255.0
R2(dhcp-config)#default-router 192.168.2.254
R2(dhcp-config)#dns-server 8.8.8.8
R2(dhcp-config)#lease 2 3 4
R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.3.254
R2(config)#inter fa2/0
R2(config-if)#ip add 192.168.3.1 255.255.255.0
R2(config-if)#no sh

實驗驗證:

開始PC1沒有IP地址

技術分享

PC1使用DCHP請求IP

技術分享

PC1成功請求到IP。

技術分享


本文出自 “新網學會博客” 博客,請務必保留此出處http://xwxhvip.blog.51cto.com/13020757/1981723

Cisco的DHCP和VLAN綜合實驗