实验、交换机DHCP服务器的配置
一、 实验目的
1、 了解DHCP原理;
2、 熟练掌握交换机作为DHCP服务器的配置方法; 3、 了解该功能的广泛应用。
二、 应用环境
大型网络一般都采用DHCP协议作为地址分配的方法,需要为网络购置多台DHCP服务器放置在网络的不同位置。为减轻网络管理员和用户的配置负担,我们可以将支持DHCP的交换机配置成DHCP服务器。
三、 实验设备
1、 DCRS-5650交换机1台(SoftWare version is DCRS-5650-28_5.2.1.0) 2、 PC机1-3台 3、 Console线1根 4、 直通网线若干
四、 实验拓扑
PC1vlan10五、 实验要求
PC2vlan10PC3vlan20
为处于不同VLAN的PC机设置DHCP服务器。
在交换机上划分两个基于端口的VLAN:VLAN10,VLAN20。 VLAN 10 24 IP 192.168.10.1/端口成员 1~8 20 24 配置两个地址池:
PoolA (network 192.168.10.0/24) 设备 缺省网关 DNS服务器 Lease Ip地址 192.168.10.1 192.168.1.1 8小时 192.168.20.1/9~16 PoolB (network 192.168.20.0/24 ) 设备 缺省网关 DNS服务器 Lease Ip地址 192.168.20.1 192.168.1.1 1小时 其中在VLAN10处,因为工作的需要,特地将一台MAC地址为00-A0-D1-D1-07-FF的机器分配固定的IP地址192.168.10.88。
六、 实验步骤
第一步:交换机全部恢复出厂设置,创建vlan100和vlan200。
switch(Config)#
switch(Config)#vlan 10
switch(Config-Vlan10)#switchport interface ethernet 0/0/1-8 !给vlan10加入端口1-8
Set the port Ethernet0/0/1 access vlan 100 successfully Set the port Ethernet0/0/2 access vlan 100 successfully Set the port Ethernet0/0/3 access vlan 100 successfully Set the port Ethernet0/0/4 access vlan 100 successfully Set the port Ethernet0/0/5 access vlan 100 successfully Set the port Ethernet0/0/6 access vlan 100 successfully Set the port Ethernet0/0/7 access vlan 100 successfully Set the port Ethernet0/0/8 access vlan 100 successfully switch(Config-Vlan10)#exit switch(Config)#vlan 20
switch(Config-Vlan20)#switchport interface ethernet 0/0/9-16 !给vlan20加入端口9-16
Set the port Ethernet0/0/9 access vlan 200 successfully Set the port Ethernet0/0/10 access vlan 200 successfully Set the port Ethernet0/0/11 access vlan 200 successfully Set the port Ethernet0/0/12 access vlan 200 successfully Set the port Ethernet0/0/13 access vlan 200 successfully Set the port Ethernet0/0/14 access vlan 200 successfully Set the port Ethernet0/0/15 access vlan 200 successfully Set the port Ethernet0/0/16 access vlan 200 successfully switch(Config-Vlan20)#exit switch(Config)#
第二步:给交换机设置IP地址。
switch(Config)#interface vlan 1
switch(Config-If-Vlan1)#ip address 192.168.1.1 255.255.255.0 switch(Config-If-Vlan1)#no shutdown switch(Config)#interface vlan 10
switch(Config-If-Vlan10)#ip address 192.168.10.1 255.255.255.0 switch(Config-If-Vlan100)#no shutdown
switch(Config)#interface vlan 20
switch(Config-If-Vlan20)#ip address 192.168.20.1 255.255.255.0 switch(Config-If-Vlan20)#no shutdown
第三步:配置DHCP
switch(Config)#service dhcp !启用DHCP switch(Config)#ip dhcp pool testA !定义地址池
switch(dhcp-testA-config)#network-address 192.168.10.0 24 switch(dhcp-testA-config)#lease 0 8
switch(dhcp-testA-config)#default-router 192.168.10.1 switch(dhcp-testA-config)#dns-server 192.168.1.1 switch(dhcp-testA-config)#exit
switch(Config)#ip dhcp pool testB
switch(dhcp-testB-config)#network-address 192.168.20.0 24 switch(dhcp-testB-config)#lease 0 1
switch(dhcp-testB-config)#default-router 192.168.20.1 switch(dhcp-testB-config)#dns-server 192.168.1.1 switch(dhcp-testB-config)#exit switch(Config)# 第四步:验证实验。
使用“ipconfig/renew”命令在PC的dos命令行中检查是否得到了正确的IP 设备 PC1 PC2 PC3 位置 1-8端口 1-8端口 9-16端口 动作 Ipconfig/renew Ipconfig/renew Ipconfig/renew 结果 192.168.10.2/24 192.168.10.3/24 192.168.20.2/24 第五步:为特殊的PC配置地址池
switch(Config)#ip dhcp excluded-address 192.168.10.77 192.168.10.99 !设定排除地址池中的不用于动态分配的地址 switch(Config)#ip dhcp pool testC
switch(dhcp-testC-config)#host 192.168.100.88 !手工绑定地址时,分配给指定客户机的用户的IP地址
switch(dhcp-testC-config)#hardware-address 00-a0-d1-d1-07-ff !手工分配地址时,指定用户的硬件地址
switch(dhcp-testC-config)#default-router 192.168.10.1 switch(dhcp-testC-config)#exit 第六步:验证实验。
使用“ipconfig/renew”命令在PC的dos命令行中检查是否得到了正确的IP
设备 PC1 PC2 位置 1-8端口 1-8端口 动作 Ipconfig/renew Ipconfig/renew 结果 192.168.100.88/24 192.168.100.3/24 PC3
9-16端口 Ipconfig/renew 192.168.200.2/24 实验、交换机DHCP中继功能的配置
一、实验目的
1、了解DHCP原理;
2、熟练掌握交换机DHCP中继的配置方法; 3、了解该功能的广泛应用。
二、应用环境
当DHCP客户机和DHCP服务器不在同一个网段时,由DHCP中继传递DHCP报文。增加DHCP中继功能的好处是不必为每个网段都设置DHCP服务器,同一个DHCP服务器可以为很多个子网的客户机提供网络配置参数,即节约了成本又方便了管理。这就是DHCP中继的功能。
三、实验设备
1、DCRS-5650交换机2台(SoftWare version is DCRS-5650-28_5.2.1.0) 2、PC机1-3台 3、Console线1根 4、直通网线若干
四、实验拓扑
switchAVlan100PC1PC2DHCP ServerswitchBVlan10
五、实验要求
在交换机A上划分两个基于端口的VLAN:VLAN10,VLAN100。 VLAN 10 4 100 10.1.157.100/24 IP 192.168.1.1/2端口成员 1 24
交换机A的端口24连接一台DHCP服务器,服务器的地址为10.1.157.1/24; 交换机A的端口2连接交换机B的24口;
交换机B恢复出场设备,不作任何配置,当成HUB来用。
DHCP服务器的地址池中的地址范围为:192.168.1.10/24-192.168.1.100/24.
六、实验步骤
第一步:交换机全部恢复出厂设置,创建vlan10和vlan100。
switch(Config)#
switch(Config)#vlan 10
switch(Config-Vlan10)#switchport interface Ethernet 0/0/1 switch(Config-Vlan10)#exit switch(Config)#vlan 100
switch(Config-Vlan100)#switchport interface Ethernet 0/0/24 switch(Config-Vlan100)#exit 第二步:给交换机设置IP地址。
switch(Config)#interface vlan 10
switch(Config-If-Vlan10)#ip address 192.168.1.1 255.255.255.0 switch(Config-If-Vlan10)#no shutdown
switch(Config)#interface vlan 100
switch(Config-If-Vlan100)#ip address 10.1.157.100 255.255.255.0 switch(Config-If-Vlan100)#no shutdown
第三步:配置DHCP中继
switch(Config)#service dhcp
switch(Config)#ip forward-protocol udp bootps switch(Config)#interface vlan 10
switch(Config-If-Vlan10)#ip helper-address 10.1.157.1 switch(Config-If-Vlan10)#exit switch(Config)#
第四步:验证实验。
使用“ipconfig/renew”命令在PC的dos命令行中检查是否得到了正确的IP.