1 DMZ 非军事区
DMZ 不能主动去访问外网
2 MAC 层***
1 )原理:发送大量虚假的 MAC 来冲击交换机的 MAC 表,导致交换机没有学习正常的 MAC
导致数据在交换机上采取 flooding 动作
2 )解决:
1 )基于已知 MAC 允许
配置
sw port-security 启用 默认只学习 1 MAC
若超时一个 MAC 就会将端口置 err-disable=shutdown
sw5#sh int f0/20
FastEthernet0/20 is down, line protocol is down (err-disabled)
sw5(config-if)#sw port-security ?
 aging        老化
 mac-address  指定授权的 MAC
 maximum      多少个 MAC
 violation    违反动作后如何处理
sw5(config-if)#sw mode acc
sw5(config-if)#sw port-security
sw5(config-if)#sw port-securit violation ?
 protect   drop
 restrict  丢包 +alarm
 shutdown 
sw5(config-if)#sw port-security mac-address ?
 H.H.H   静态指定
 sticky  动态学习 --> 粘贴   ( 需要粘贴 ) ,在配置中
          动态学习
测试
R1(config-if)#mac-address 00e0.1e60.4f26
sw5(config)#errdisable recovery cause psecure-violation
sw5(config)#errdisable recovery interval 30
2 )基于已知 MAC 不允许
sw5(config)#mac address-table static 00e0.1e60.4f26 vlan 1 drop
来自源 MAC 00e0.1e60.4f26 数据包被丢掉
3 )拦截未知单播
sw5(config-if)#switchport block ?
 multicast Block unknown multicast addresses
 unicast    Block unknown unicast addresses
未知的单播 / 组播不会往启用了 port-security 的端口发送
3 DHCP
1 DHCP 工作原理
discovery
offer
request
ack
cisco 设备中都是以广播方式发送,在 REDHAT WINDOWS offer ack 是单播
2)DHCP ***
DOS *** ---> 耗光服务器 IP
服务器冒充 -->
3) 几点解释
1 DHCP 服务器是 根据网关 IP 来判断分配那个地址池的地址给客户
2 DHCP 为什么 不分配相同的 IP :会通过 ping 测试,如果没有响应就表明没有人使用这个 IP
4 DHCP snooping
1 )启用后把端口置为 unstrust trust
untrust: 不能接收 offer ack---> 用于连接 pc
trust: 所有 ----> 连接服务器
配置:
R2(config)#ip dhcp pool p
R2(dhcp-config)#netw 12.1.1.0 /24
R2(dhcp-config)#default-router 12.1.1.2
R2(config)#ip dhcp excluded-address 12.1.1.2
R1(config-if)#ip add dhcp
sw5(config)#ip dhcp snooping         启用
sw5(config)#ip dhcp snooping vlan 1 对那个 vlan (没有这条命令则不起作用)
sw5(config)#int f0/22
sw5(config-if)#ip dhcp snooping trust
-----------------------------------------------------------------
就算信任了也获取不了
问题分析:
·    SW 开启 dhcp snooping 功能后,会 默认插入 option 82 字段
·    Cisco IOS DHCP Server 收到了含有 option 82 字段的 DHCP 请求包。但是发现该报文的 giaddr 字段为 0.0.0.0 giaddr 字段意思为该报文做经过的第一个 DHCP 中继代理的 IP 地址)。所以认为该报文是 非法 ,从而将此 DHCP 请求报文丢弃。
解决方案:
·    SW1(config)#no ip dhcp snooping information option
此时交换机不会再对 DHCP 请求报文插入 option 82 字段,这样 IOS DHCP Server 就会收到标准的 DHCP 请求报文,从而解决问题。但是不建议使用此方法。
·    DHCP(config)#ip dhcp relay information trust-all (对路由器上所有接口都起作用)
DHCP(config-if)#ip dhcp relay information trusted
此时 IOS DHCP Server 会允许 giaddr 字段为 0.0.0.0 的请求报文通过
 
-----------------------------------------------------------------
R2(config-if)#ip dhcp relay information trusted
relay information option exists, but giaddr is zero
sw5#show ip dhcp snooping binding
MacAddress        IpAddress   Lease(sec) Type           VLAN Interface
-------------------------- ------------- ---- ---------
00:E0:1E:60:4F:25 12.1.1.1    86351       dhcp-snooping   1 FastEthernet0/20
 
如果没有 DHCP ,那么可以 手工写 snooping
sw5(config)#ip source binding aaa.aaa.aaa vlan 1 12.1.1.10 int f0/1
sw5#sh ip source binding
MacAddress          IpAddress        Lease(sec) Type           VLAN Interface
------------------ --------------- ---------- ------------- ---- ---------
-----------
00:E0:1E:60:4F:25   12.1.1.1         86278       dhcp-snooping   1    
FastEthernet0/20
0A:AA:0A:AA:0A:AA   12.1.1.10        infinite    static          1    
FastEthernet0/1
 
snooping 表:
vlan+port+ip+mac
1 )限制 DHCP 包的速率
2 DHCP 消息合法性 非法释放其它主机的 IP
3 option 82 用户的 MAC 是从哪个交换机 /port 上来,方便做策略
4 DOS
5) 防止用户改 MAC IP---ip source guard
1 )防止改 IP
sw5(config-if)#ip verify source
2 )防止改 IP+MAC
sw5(config-if)#switchport port-security
sw5(config-if)#ip verify source port-security
 
6)DAI 动态 ARP 检测 检测非法的 ARP
DAI (动态 ARP 监控)
1 DHCP Snooping 环境
Switch (config-if)#ip arp inspection trust
Switch (config)#ip arp ipspection vlan 5-10
2 、其他环境(自定义 ARP ACL 检查)
Switch (config)#arp access-list arpacl
Switch (config-arp-acl)#permit ip host 10.0.0.1 mac host 0011.0011.0011
Switch (config)#ip arp inspection filter arpacl vlan 5  // 应用到 vlan5
Switch (config-if)#ip arp inspection trust  // 把该接口设为信任接口,不受 ARP 监控
 
------------------------ 镜像接口 ----------------------------
monitor session 1 source interface Fa0/1 - 18 , Fa0/20 - 24
monitor session 1 destination interface Fa0/19
rx :入方向     tx :出方向     both