1、 31 更改-交换机DHCP中继功能的配置 精品文档 实训三十一 交换机DHCP中继功能的配置 一、 实训目的 1、 了解DHCP原理; 2、 熟练掌握交换机DHCP中继的配置方法; 3、 了解该功能的广泛应用。 二、 应用环境 当DHCP客户机和DHCP服务器不在同一个网段时,由DHCP中继传递DHCP报文。增加DHCP中继功能的好处是不必为每个网段都设置DHCP服务器,同一个DHCP服务器可以为很多个子网的客户机提供网络配置参数,即节约了成本又方便了管理。这就是DHCP中继的功能。 三、 实训设备 1. DCRS-5650-52CT交换机2台 2.
2、PC机1-3台 3. Console线1根 4. 直通网线若干 四、 实训拓扑 五、 实训要求 在交换机A上划分两个基于端口的VLAN:VLAN10,VLAN100。 VLAN IP 端口成员 10 192.168.1.1/24 1 100 10.1.157.100/24 24 交换机A的端口24连接一台DHCP服务器,服务器的地址为10.1.157.1/24; 交换机A的端口1连接交换机B的24口; 交换机B恢复出场设备,不作任何配置,当成HUB来用。 DHCP服务器的地址池中的地址范围为:192.168.1.10/24-192.168.1.10
3、0/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
4、 第二步:给交换机设置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)
5、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 h
6、elper-address 10.1.157.1 switch(Config-If-Vlan10)#exit switch(Config)# 第四步:验证实训。 使用“ipconfig/renew”命令在PC的dos命令行中检查是否得到了正确的IP. 七、 注意事项和排错 1、 若中间负责转发DHCP报文的交换机、路由器不具备DHCP中继功能,建议替换掉中间的设备或更新版本,使其具备DHCP中继功能,才能正确进行这个功能。 八、 配置序列 switch#show run ! no service password-encryption
7、 ! hostname switch ! ip forward-protocol udp 67 ! service dhcp ! vlan 1 ! vlan 10 ! vlan 100 ! Interface Ethernet0/0/1 switchport access vlan 10 ! Interface Ethernet0/0/2 ! Interface Ethernet0/0/3 ! Interface Ethernet0/0/4 ! Interface Ethernet0/0/5 ! Interface Eth
8、ernet0/0/6 ! Interface Ethernet0/0/7 ! Interface Ethernet0/0/8 ! Interface Ethernet0/0/9 ! Interface Ethernet0/0/10 ! Interface Ethernet0/0/11 ! Interface Ethernet0/0/12 ! Interface Ethernet0/0/13 ! Interface Ethernet0/0/14 ! Interface Ethernet0/0/15 ! Interface Ethernet0/0/16 !
9、 Interface Ethernet0/0/17 ! Interface Ethernet0/0/18 ! Interface Ethernet0/0/19 ! Interface Ethernet0/0/20 ! Interface Ethernet0/0/21 ! Interface Ethernet0/0/22 ! Interface Ethernet0/0/23 ! Interface Ethernet0/0/24 switchport access vlan 100 ! Interface Ethernet0/0/25 !
10、 Interface Ethernet0/0/26 ! Interface Ethernet0/0/27 ! Interface Ethernet0/0/28 ! interface Vlan10 ip address 192.168.1.1 255.255.255.0 !forward protocol udp 67(active)! ip helper-address 10.1.157.1 ! interface Vlan100 ip address 10.1.157.100 255.255.255.0 ! no login ! End swit
11、ch#
九、 相关配置命令详解
DHCP中继配置任务序列
1. 启动DHCP中继
2. 配置DHCP中继转发DHCP广播报文
3. 配置DHCP中继转发其他UDP广播报文
4. 禁止DHCP中继转发DHCP广播报文
启动DHCP中继
在前面15.2.1中曾讲到启动DHCP服务时即启动了DHCP服务器的功能,又启动了DHCP中继的功能。(详见15.1.2.1相关内容)
配置DHCP中继转发DHCP广播报文
命令
解释
全局配置模式
ip forward-protocol udp
12、发DHCP广播报文时,UDP端口号为67。
接口配置模式
ip helper-address






