晴川综合网-西昌地区开办最早的个人网站之一

搜索
查看: 21489|回复: 0

交换机如何配置防止用户手动私设IP

[复制链接]
发表于 2020-6-20 21:07:53 | 显示全部楼层 |阅读模式
一、组网要求
    1)DHCP--二层交换机--客户机,DHCP服务器在三层交换机上,要求客户机只能通过DHCP获取地址上网,手动配置地址不允许上网。
    2)只允许192.168.1.2 这台电脑手动配置地址上网
二、组网拓扑
20138225463881.jpg
三、配置要点
  • 接入交换机全局开启dhcp snooping
  • 接入交换机的上连口(即连接到dhcp服务器的端口)配置信任口
  • 除上连口外的其他端口配置source guard功能
  • 此功能必须配合 dhcp snooping功能使用,即开此功能的前提是必须开启 dhcp snooping功能

四、配置步骤
注意:配置之前建议使用 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

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|晴川综合网(晴川论坛) 蜀ICP备12004085号-1

GMT+8, 2024-4-20 02:20 , Processed in 0.140400 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表