当前位置: 首页 > news >正文

小结: Port Security,DHCP Snooping,IPSG,DAI,

以下是华为和思科在 IP Source Guard、Dynamic ARP Inspection、DHCP Snooping、Port Security 四个安全功能的配置指令对比:


1. Port Security(端口安全)

思科(Cisco)
# 进入接口模式
interface GigabitEthernet0/1
# 启用端口安全
switchport port-security
# 设置最大允许的MAC地址数量
switchport port-security maximum 5
# 配置违规处理方式(shutdown/restrict/protect)
switchport port-security violation shutdown
# 绑定静态MAC(可选)
switchport port-security mac-address 0000.1111.2222
华为(Huawei)
# 进入接口模式
interface GigabitEthernet0/0/1
# 启用端口安全
port-security enable
# 设置最大MAC地址数
port-security max-mac-num 5
# 配置违规动作(shutdown/restrict)
port-security protect-action restrict
# 绑定静态MAC(可选)
port-security mac-address sticky 0000-1111-2222

2. DHCP Snooping(DHCP监听)

思科(Cisco)
# 全局启用DHCP Snooping
ip dhcp snooping
# 指定信任接口(通常为DHCP服务器所在端口)
interface GigabitEthernet0/1
ip dhcp snooping trust
# 绑定到VLAN(可选)
ip dhcp snooping vlan 10
华为(Huawei)
# 全局启用DHCP Snooping
dhcp enable
dhcp snooping enable
# 进入接口并配置信任端口
interface GigabitEthernet0/0/1
dhcp snooping trusted
# 绑定到VLAN(可选)
vlan 10
dhcp snooping enable

3. Dynamic ARP Inspection(动态ARP检测)

思科(Cisco)
# 启用DAI并绑定到VLAN
ip arp inspection vlan 10
# 配置信任接口(通常为DHCP服务器所在端口)
interface GigabitEthernet0/1
ip arp inspection trust
# 绑定DHCP Snooping数据库
ip arp inspection validate src-mac dst-mac ip
华为(Huawei)
# 启用ARP防攻击功能(需结合DHCP Snooping)
arp anti-attack check user-bind enable
# 绑定DHCP Snooping表项到ARP检测
dhcp snooping enable
dhcp snooping binding record
# 在接口下启用ARP信任(可选)
interface GigabitEthernet0/0/1
arp trusted

4. IP Source Guard(IP源防护)

思科(Cisco)
# 启用IP Source Guard(基于DHCP Snooping表)
interface GigabitEthernet0/1
ip verify source port-security
华为(Huawei)
# 启用IP+MAC绑定检查(需先启用DHCP Snooping)
interface GigabitEthernet0/0/1
ip source check user-bind enable
# 或静态绑定IP+MAC
user-bind static ip-address 192.168.1.2 mac-address 0000-1111-2222

总结

  • 思科 的配置更依赖 ip 前缀的命令,且与VLAN绑定紧密。
  • 华为 的配置通常以功能模块(如 port-securitydhcp snooping)为核心,需全局启用后细化接口配置。
  • 两者均依赖 DHCP Snooping表 实现ARP检测和IP源防护,但命令语法差异较大。

华为设备配置(基于VRP系统)

# DHCP Snooping配置  
dhcp enable  
dhcp snooping enable  
vlan 10  dhcp snooping enable  
interface GigabitEthernet0/0/1    # 连接合法DHCP服务器的端口  dhcp snooping trusted  
quit  # Port Security配置  
interface GigabitEport0/0/2  port-security enable  port-security max-mac-num 5      # 允许的最大MAC地址数  port-security protect-action restrict  # 违规后限制并告警  port-security mac-address sticky  # 绑定合法MAC地址  
quit  # Dynamic ARP Inspection配置  
arp anti-attack entry-check enable  # 全局启用DAI  
arp anti-attack entry-check dhcp-snooping-vlan vlan 10  # 绑定VLAN和DHCP Snooping  # IP Source Guard配置  
interface GigabitEthernet0/0/2  ip source check user-bind enable  # 启用IP源检查  ipv6 source check user-bind enable  # 可选IPv6配置  
quit  

思科设备配置(基于IOS系统)

# DHCP Snooping配置  
ip dhcp snooping  
ip dhcp snooping vlan 10  
interface GigabitEthernet0/1     # 连接合法DHCP服务器的端口  ip dhcp snooping trust  
exit  # Port Security配置  
interface range GigabitEthernet0/2 - 4  switchport mode access  switchport port-security  switchport port-security maximum 5   # 允许的最大MAC地址数  switchport port-security violation restrict  # 违规后限制并告警  switchport port-security mac-address sticky  # 绑定合法MAC地址  
exit  # Dynamic ARP Inspection配置  
ip arp inspection vlan 10       # 基于VLAN启用DAI  
ip arp inspection validate src-mac dst-mac ip  # 可选:增强校验  # IP Source Guard配置  
interface GigabitEthernet0/2  ip verify source port-security  # 启用IP源检查  
exit  

配置说明

  1. DHCP Snooping

    • 华为:需全局和VLAN级别启用,并标记信任端口。
    • 思科:全局启用后绑定VLAN,信任端口需单独配置。
  2. Port Security

    • 华为:使用port-security系列命令,支持restrictshutdown动作。
    • 思科:通过switchport port-security配置,功能类似但命令语法不同。
  3. Dynamic ARP Inspection

    • 华为:需全局启用并结合DHCP Snooping表校验ARP。
    • 思科:直接基于VLAN启用,支持多种校验选项(如MAC/IP匹配)。
  4. IP Source Guard

    • 华为:通过ip source check实现,依赖DHCP Snooping表。
    • 思科:使用ip verify source,需结合Port Security或DHCP Snooping。

注意事项

  • 生产环境中建议启用日志监控(如华为的info-center enable或思科的logging)。
  • 违规策略可根据需求选择restrict(限制流量并告警)或shutdown(直接关闭端口)。
  • 确保所有非信任端口(如用户接入端口)均未标记为DHCP信任端口。

相关文章:

  • 《汽车软件升级通用技术要求》 GB 44496-2024——解读
  • RN 鸿蒙混合开发实践(踩坑)
  • 每日Prompt:超现实交互场景
  • 动态网站 LNMP
  • 基于LNMP架构的个人博客系统部署
  • 详解RabbitMQ工作模式之通配符模式
  • laravel 中使用的pdf 扩展包 laravel-snappy(已解决中文乱码)
  • 从零搭建AI工作站:Gemma3大模型本地部署+WebUI配置全套方案
  • 用 openssl 测试 tls 连接
  • C++23 views::slide (P2442R1) 深入解析
  • 奇次谐波和偶次谐波【EMC】
  • 扩展:React 项目执行 yarn eject 后的 scripts 目录结构详解
  • 数据结构与算法学习-JavaScript的Array.prototype.reduce()方法
  • 【K8S学习之探针】详细了解就绪探针 readinessProbe 和存活探针 livenessProbe 的配置
  • 【K8S学习之生命周期钩子】详细了解 postStart 和 preStop 生命周期钩子
  • JAVA EE_网络原理_数据链路层
  • 【网工第6版】第10章 网络规划和设计①
  • 【android bluetooth 框架分析 02】【Module详解 13】【CounterMetrics 模块介绍】
  • 【数据结构】双链表
  • 数据结构(六)——树和二叉树
  • 上海现有超12.3万名注册护士,本科及以上学历占一半
  • 张笑宇:物质极大丰富之后,我们该怎么办?
  • 农行深圳市分行原副行长王国彪涉嫌严重违纪违法被查
  • 俄总统新闻秘书:普京提议谈判表明俄寻求和平解决方案意愿
  • 演员发文抵制代拍获粉丝支持,媒体:追星“正确姿势”不妨多来点
  • 家电维修担心遇“李鬼”?上海推动“物业+专业服务”进社区