如图所示,交换机S1作为dhcp服务器,S2/S3/S4为dhcp客户端,
服务器分配的地址为10.1.1.0/24网段,其接口下的设备获取的地址为与该接口的id值相同,即S2地址为10.1.1.1,S3地址为10.1.1.4.S4地址为10.1.1.10.
2配置步骤
代码语言:javascript复制dhcp enable
dhcp snooping enable
#
dhcp class port1 //配置port1规则
if-match rule 1 option 82 hex 706f727431 offset 2 length 5
dhcp class port4
if-match rule 1 option 82 hex 706f727434 offset 2 length 5
dhcp class port8
if-match rule 1 option 82 hex 706f727438 offset 2 length 5
dhcp class port10
if-match rule 1 option 82 hex 706f72743130 offset 2 length 6
#
dhcp server ip-pool 10
gateway-list 10.1.1.254
network 10.1.1.0 mask 255.255.255.0
class port1 range 10.1.1.1 10.1.1.1
class port4 range 10.1.1.4 10.1.1.4
class port8 range 10.1.1.8 10.1.1.8
class port10 range 10.1.1.10 10.1.1.10
#
interface GigabitEthernet1/0/1 //接口需要获取dhcp snooping信息
dhcp snooping information enable
dhcp snooping information circuit-id string port1 //绑定dhcp class信息
#
interface GigabitEthernet1/0/4
dhcp snooping information enable
dhcp snooping information circuit-id string port4
#
interface GigabitEthernet1/0/8
dhcp snooping information enable
dhcp snooping information circuit-id string port8
#
interface GigabitEthernet1/0/10
dhcp snooping information enable
dhcp snooping information circuit-id string port10
#
结果