当前位置:文档之家› 交换机DHCP中继功能的配置

交换机DHCP中继功能的配置

交换机DHCP 中继功能的配置
一、 环境
当DHCP 客户机和DHCP 服务器不在同一个网段时,由DHCP 中继传递DHCP 报文。

增加
DHCP 中继功能的好处是不必为每个网段都设置DHCP 服务器,同一个DHCP 服务器可以为很
多个子网的客户机提供网络配置参数,即节约了成本又方便了管理。

这就是DHCP 中继的功
能。

二、 拓扑
switchA switchB Vlan10
DHCP Server
Vlan100
PC2
PC1 三、 实训要求
在交换机A
交换机A 的端口24连接一台DHCP 服务器,服务器的地址为10.1.157.1/24;
交换机A 的端口1连接交换机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.
五、注意事项和排错
1、若中间负责转发DHCP报文的交换机、路由器不具备DHCP中继功能,建议替换掉
中间的设备或更新版本,使其具备DHCP中继功能,才能正确进行这个功能。

六、配置序列
switch#show run
!
no service password-encryption
!
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 Ethernet0/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 !
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
!
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
switch#
七、相关配置命令详解
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广播报文
配置DHCP中继转发其他UDP广播报文
禁止DHCP中继转发DHCP广播报文。

相关主题