http://liangrui.blog.51cto.com/1510945/508939

这里我们就说下2层***安全.

***类型:1.交换机配置及其管理

                    2.mac层***

                    3.vlan***

                    4.stp cdp vtp 协议的***

防护措施:1.关闭不需要的服务

 关闭BOOTP服务 no ip bootp server
关闭CDP服务   no cdp run
关闭配置自动加载服务(默认关闭)no service config
关闭DNS服务 系统会自动向255.255.255.255广播查询dns 如果使用DNS一定要配置服务器名字ip name server add1   不用no ip domain-lookup
关闭FTP服务器 no ftp-server enable  no ftp-server write-enable
关闭finger服务    no ip finger   no service finge
关闭无根据的ARP no ipgratuitous-arps
关闭http        no ip http server
关闭ip无类别路由选择服务 no ip classless
关闭ip定向广播 int f0/0   no ip directed-broadcast 
关闭ip鉴别  no ip identd
关闭ICMP掩码应答 (默认关闭)int f0/0 no ip mask-relay
关闭路由重定向   int f0/0 no ip redirect 边界路由过滤
关闭ip源路由选项   no ip source-route
关闭ICMP不可达信息   int f0/0 no ip unreach
关闭NTP服务  int f0/0 ntp disable 
关闭pad服务    no service  pad(闭关)
关闭代理ARP    在边界路由外部网络接口  no ip proxy-arp
关闭SNMP     
关闭小服务   no service tcp-small-servers
启用keeplive    service tcp-keeplives-in    service tcp-keeplives-out
关闭tftp   no tftp-server flash device:filename  
2. 防止非法授权访问

SW(config-t)#enable secret 
SW(config-t)#no enable password 
SW(config-t)#service password-encryption
SW(config-t)#line vty 0 4 
SW(config-line)#exec-timeout 10 0
access-list 110 permit ip 192.168.1.110 0.0.0.0 192.168.1.254 0.0.0.0 log 
line vty 0 4
access-class 101 in 
exec-timeout 5  0
SW(config-t)#username admin pass 5 434535e2 
SW(config-t)#aaa new-model 
SW(config-t)#radius-server host 192.168.1.254 key key-string 
SW(config-t)#aaa authentication login neteng group radius local 
SW(config-t)#line vty 0 4 
SW(config-line)#login authen neteng

3.端口安全cisco提供了5种保护特性

1.基于主机MAC的允许流量

2.基于主机MAC的限制流量

3.在端口堵塞单播扩散

4.避免MAC地址扩散***

5.避免MAC地址欺骗***

 

int f0/1

sw

switchport mode acc

sw port-security

sw port-se mac-add 0000.0000.0005

sw port-se maximun 1

sw port-se aging static (也可指定学习时间)

sw port-se violation shutdown

在vlan2中过滤掉 0000.0010.0100 单播流量(对组播多播没有用)

mac-add-table static 0000.0010.0100 vlan2 drop

我们还可以在接口下过滤单播和多播的流量 (可解决NLB的单播问题)

int f0/1

sw block unicast

sw block multicast

4.关于vlan的***防御

1.dhcp监听

 

我们通过把端口设为信任和非信任(推荐在分布层和接入层之间设为信任,客户端设为非信任)交换机只接受信任端口的DHCP报文

ip dhcp snooping

ip dhcp snooping  vlan 20

ip dhcp snooping information option

int f0/5

ip dhcp snooping trust

int range f0/6 -15

ip dhcp snooping limit rate 80

我们还可以通过vlan acl 做访问控制阻止无赖dhcp

ip access-list  extended  permiter

permit udp host 192.1.1.254 any eq 68      192.1.1.254为dhcp服务器

permit udp host 192.1.1.110  any eq 68

deny udp any any eq  68

permit ip  any any  log

还有一点我们在dmz或者服务器集中区配置pvlan

5.STP防护

spanning-tree uplinkfast

spanning-tree portfast bpduguard

spanning-tree guard root

综合概述:

1.对所有中继端口使用相同的vlan

2.避免使用vlan1

3.对用户端口部署端口安全

4.启用stp安全防护

5.服务器部署pvlan

6.对vtp进行加密

7.不需要的地方禁用cdp

8禁用所有不用的端口放在统一vlan下

9.部署dhcpsnooping

当然还有其他的方法保护2层安全 如802.1x  aaa认证   等!安全工程师要做的是在适当的地点部署合理的安全方案,这里需要我们来共同探究!

 

本文出自 “cisco network” 博客,转载请与作者联系!