Cisco的DHCP和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


实验拓补图:

Cisco的DHCP和VLAN综合实验

实验思路:

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

  2. R1上要为vlan30创建一个子接口。且每个子接口要指定封装模式和指定DHCP Server的IP地址。

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


实验配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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地址

Cisco的DHCP和VLAN综合实验

PC1使用DCHP请求IP

Cisco的DHCP和VLAN综合实验

PC1成功请求到IP。

Cisco的DHCP和VLAN综合实验

  蔡瑞

 

本文转自新网学会 51CTO博客,原文链接:http://blog.51cto.com/xwxhvip/1981723 ,如需转载请自行联系原作者