交换机
园区网交换机
数据中心与云计算交换机
中小网络精简型交换机
工业交换机
意图网络指挥官
无线
放装型无线接入点
墙面型无线接入点
智分无线接入点
室外无线接入点
场景化无线
无线控制器
小锐A系列
统一运维
身份管理
服务产品
运营商
政府
金融
互联网
电力能源
制造业
高教/职教
医疗卫生
交通
地产酒店文旅·连锁服务
公共安全
一、组网要求
1)DHCP--二层交换机--客户机,DHCP服务器在三层交换机上,要求客户机只能通过DHCP获取地址上网,手动配置地址不允许上网。
2)只允许192.168.1.2 这台电脑手动配置地址上网
二、组网拓扑
三、配置要点
四、配置步骤
注意:配置之前建议使用 Ruijie#show interface status查看接口名称,常用接口名称有FastEthernet(百兆)、GigabitEthernet(千兆)和TenGigabitEthernet(万兆),以下配置以百兆接口为例
1)在接入交换机上开启dhcp snooping功能
Ruijie>enable
Ruijie#configure terminal
Ruijie(config)#ip dhcp snooping ------> 开启DHCP snooping功能
2)连接DHCP服务器的接口配置为可信任口
Ruijie(config)#int FastEthernet0/24
Ruijie(config-FastEthernet 0/24)#ip dhcp snooping trust ------> 确认配置正确,保存配置开启DHCP snooping的交换机所有接口缺省为untrust口,交换机只转发从trust口收到的DHCP响应报文(offer、ACK、NAK)
3)除上连口外的其他端口配置source guard功能
Ruijie(config)# interface range FastEthernet 0/3-24 ------> 进入交换机的第3~24个百兆接口配置
Ruijie(config-if-range)#ip verify source port-security ------> 开启防止用户手动设置ip的功能
4)配置允许配置静态地址
Ruijie(config)#ip source binding 0027.1365.33db vlan 1 192.168.2.2 interface FastEthernet 0/1 ------> 允许交换机第一百兆接口下接属于vlan 1的mac地址为0027.1365.33db 的终端,可以配置为192.168.2.2的静态ip地址
5 )保存配置
Ruijie(config)#end
Ruijie#write ------> 确认配置正确,保存配置
五、验证命令:
通过此命令查看dhcp snooping功能开启状态,enable即开启。
Ruijie#show ip dhcp snooping
Switch DHCP snooping status : ENABLE
DHCP snooping Verification of hwaddr status : DISABLE
DHCP snooping database write-delay time : 0 seconds
DHCP snooping option 82 status : DISABLE
DHCP snooping Support bootp bind status : DISABLE
Interface Trusted Rate limit (pps)
------------------------ ------- ----------------
FastEthernet 0/24 YES unlimited
通过此命令查看dhcp snooping功能所形成的表项,包括用户mac +ip +释放时间+类型+vlan id+端口
Ruijie(config)#show ip dhcp snooping binding
Total number of bindings: 1
MacAddress IpAddress Lease(sec) Type VLAN Interface
------------------ --------------- ------------ ------------- ----- --------------------
bcae.c54b.ca8d 192.168.2.1 86341 dhcp-snooping 2 GigabitEthernet 0/24
查看已绑定表项
Ruijie(config)#show ip verify source
Interface Filter-type Filter-mode Ip-address Mac-address VLAN
-------------------- ----------- ----------- --------------- -------------- --------
GigabitEthernet 0/24 ip+mac active 192.168.2.1 bcae.c54b.ca8d 2
GigabitEthernet 0/24 ip+mac active deny-all deny-all
查看静态绑定表项
Ruijie(config)#show ip source binding
MacAddress IpAddress Lease(sec) Type VLAN Interface
----------------- --------------- ------------ ------------- ----- --------------------
0027.1365.33db 192.168.2.2 infinite static 1 FastEthernet 0/1