当前位置导航:炫浪网>>网络学院>>网络应用>>组网建网教程

Cisco路由器安全配置方案

一、 路由器网络服务安全配置

  1 禁止CDP(Cisco Discovery Protocol)。如:Router(Config)#no cdp run Router(Config-if)# no cdp enable

  2 禁止其他的TCP、UDP Small服务。

  Router(Config)# no service tcp-small-servers Router(Config)# no service udp-samll-servers

  3 禁止Finger服务。

  Router(Config)# no ip finger Router(Config)# no service finger

  4 建议禁止HTTP服务。

  Router(Config)# no ip http server如果启用了HTTP服务则需要对其进行安全配置:设置用户名和密码;采用访问列表进行控制。

  5 禁止BOOTp服务。

  Router(Config)# no ip bootp server

  6 禁止IP Source Routing. Router(Config)# no ip source-route

  7 建议如果不需要ARP-Proxy服务则禁止它,路由器默认识开启的。

  Router(Config)# no ip proxy-arp Router(Config-if)# no ip proxy-arp

  8禁止IP Directed Broadcast. Router(Config)# no ip directed-broadcast

  9 禁止IP Classless. Router(Config)# no ip classless

  10 禁止ICMP协议的IP Unreachables, Redirects, Mask Replies. Router(Config-if)# no ip unreacheables Router(Config-if)# no ip redirects Router(Config-if)# no ip mask-reply

  11 建议禁止SNMP协议服务。在禁止时必须删除一些SNMP服务的默认配置。如:Router(Config)# no snmp-server community public Ro Router(Config)# no snmp-server community admin RW

  12 如果没必要则禁止WINS和DNS服务。

  Router(Config)# no ip domain-lookup如果需要则需要配置:Router(Config)# hostname Router Router(Config)# ip name-server 219.150.32.xxx

  13 明确禁止不使用的端口。如:Router(Config)# interface eth0/3 Router(Config)# shutdown</P><P>

二、路由器访问控制的安全配置(可选)

  路由器的访问控制是比较重要的安全措施,但是目前由于需求不明确,可以考虑暂时不实施。作为建议提供。

  1 建议不要远程访问路由器。即使需要远程访问路由器,建议使用访问控制列表和高强度的密码控制。

  2 严格控制CON端口的访问。配合使用访问控制列表控制对CON口的访问。

  配合使用访问控制列表控制对CON口的访问。


  如:Router(Config)#Access-list 1 permit 192.168.0.1 Router(Config)#line con 0 Router(Config-line)#Transport input none Router(Config-line)#Login local Router(Config-line)#Exec-timeoute 5 0 Router(Config-line)#access-class 1 in Router(Config-line)#end同时给CON口设置高强度的密码。
  3 如果不使用AUX端口,则禁止这个端口。默认是未被启用。禁止如:Router(Config)#line aux 0 Router(Config-line)#transport input none Router(Config-line)#no exec 4 建议采用权限分级策略。如:Router(Config)#username test privilege 10 xxxx Router(Config)#privilege EXEC level 10 telnet Router(Config)#privilege EXEC level 10 show ip access-list 5 为特权模式的进入设置强壮的密码。不要采用enable password设置密码。而要采用enable secret命令设置。并且要启用Service password-encryption. Router(config)#service password-encryption Router(config)#enable secret 6 控制对VTY的访问。如果不需要远程访问则禁止它。如果需要则一定要设置强壮的密码。由于VTY在网络的传输过程中为加密,所以需要对其进行严格的控制。如:设置强壮的密码;控制连接的并发数目;采用访问列表严格控制访问的地址;可以采用AAA设置用户的访问控制等。三、路由器路由协议安全配置1 建议启用IP Unicast Reverse-Path Verification.它能够检查源IP地址的准确性,从而可以防止一定的IP Spooling.但是它只能在启用CEF(Cisco Express Forwarding)的路由器上使用。
  uRPF有三种方式,strict方式、ACL方式和loose方式。在接入路由器上实施时,对于通过单链路接入网络的用户,建议采用strict方式;对于通过多条链路接入到网络的用户,可以采用ACL方式和loose方式。在出口路由器上实施时,采用loose方式。Strict方式:Router# config t! 启用CEF Router(Config)# ip cef!启用Unicast Reverse-Path Verification Router(Config)# interface eth0/1 Router(Config-if)# ip verify unicast reverse-path ACL方式:interface pos1/0 ip verify unicast reverse-path 190 access-list 190 permit ip {customer network} {customer network mask} any access-list 190 deny ip any any [log]这个功能检查每一个经过路由器的数据包的源地址,若是不符合ACL的,路由器将丢弃该数据包。
              Loose方式:interface pos 1/0 ip ver unicast source reachable-via any这个功能检查每一个经过路由器的数据包,在路由器的路由表中若没有该数据包源IP地址的路由,路由器将丢弃该数据包。2 启用OSPF路由协议的认证。默认的OSPF认证密码是明文传输的,建议启用MD5认证。并设置一定强度密钥(key,相对的路由器必须有相同的Key)。


3 RIP协议的认证。只有RIP-V2支持,RIP-1不支持。建议启用RIP-V2.并且采用MD5认证。普通认证同样是明文传输的。

  4 启用passive-interface命令可以禁用一些不需要接收和转发路由信息的端口。建议对于不需要路由的端口,启用passive-interface.但是,在RIP协议是只是禁止转发路由信息,并没有禁止接收。在OSPF协议中是禁止转发和接收路由信息。

  5 启用访问列表过滤一些垃圾和恶意路由信息,控制网络的垃圾信息流。如:Router(Config)# access-list 10 deny 192.168.1.0 0.0.0.255 Router(Config)# access-list 10 permit any! 禁止路由器接收更新192.168.1.0网络的路由信息Router(Config)# router ospf 100 Router(Config-router)# distribute-list 10 in!禁止路由器转发传播192.168.1.0网络的路由信息Router(Config)# router ospf 100 Router(Config-router)# distribute-list 10 out</P><P>四、路由器其他安全配置1 IP欺骗简单防护。如过滤非公有地址访问内部网络。过滤自己内部网络地址;回环地址(127.0.0.0/8);RFC1918私有地址;DHCP自定义地址(169.254.0.0/16);科学文档作者测试用地址(192.0.2.0/24);不用的组播地址(224.0.0.0/4);SUN公司的古老的测试地址(20.20.20.0/24;204.152.64.0/23);全网络地址(0.0.0.0/8)。

  Router(Config)# access-list 100 deny ip 127.0.0.0 0.255.255.255 any Router(Config)# access-list 100 deny ip 192.168.0.0 0.0.255.255 any Router(Config)# access-list 100 deny ip 172.16.0.0 0.15.255.255 any Router(Config)# access-list 100 deny ip 10.0.0.0 0.255.255.255 any Router(Config)# access-list 100 deny ip 169.254.0.0 0.0.255.255 any Router(Config)# access-list 100 deny ip 192.0.2.0 0.0.0.255 any Router(Config)# access-list 100 deny ip 224.0.0.0 15.255.255.255 any Router(Config)# access-list 100 deny ip 20.20.20.0 0.0.0.255 any Router(Config)# access-list 100 deny ip 204.152.64.0 0.0.2.255 any Router(Config)# access-list 100 deny ip 0.0.0.0 0.255.255.255 any Router(Config)# access-list 100 permit ip any any Router(Config-if)# ip access-group 100 in2 建议采用访问列表控制流出内部网络的地址必须是属于内部网络的。(可选)如:Router(Config)# no access-list 101 Router(Config)# access-list 101 permit ip 192.168.0.0 0.0.255.255 any Router(Config)# access-list 101 deny ip any any Router(Config)# interface eth 0/1 Router(Config-if)# description “internet Ethernet”
  Router(Config-if)# ip address 192.168.0.254 255.255.255.0 Router(Config-if)# ip access-group 101 in其他可选项:1、 建议启用SSH,废弃掉Telnet.但只有支持并带有IPSec特征集的IOS才支持SSH.并且IOS12.0-IOS12.2仅支持SSH-V1.如下配置SSH服务的例子:Router(Config)# config t Router(Config)# no access-list 22 Router(Config)# access-list 22 permit 192.168.0.22 Router(Config)# access-list deny any Router(Config)# username test privilege 10 ****! 设置SSH的超时间隔和尝试登录次数Router(Config)# ip ssh timeout 90 Router(Config)# ip ssh anthentication-retries 2 Router(Config)# line vty 0 4 Router(Config-line)# access-class 22 in Router(Config-line)# transport input ssh Router(Config-line)# login local Router(Config-line)# exit!启用SSH服务,生成RSA密钥对。
  Router(Config)# crypto key generate rsa The name for the keys will be: router.xxx Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys .Choosing a key modulus greater than 512 may take a few minutes. How many bits in the modulus[512]: 2048 Generating RSA Keys……
  [OK] Router(Config)#2、 TCP SYN的防范。如:A: 通过访问列表防范。
  Router(Config)# no access-list 106 Router(Config)# access-list 106 permit tcp any 192.168.0.0 0.0.0.255 established Router(Config)# access-list 106 deny ip any any Router(Config)# interface eth 0/2 Router(Config-if)# description “external Ethernet”
  Router(Config-if)# ip address 192.168.1.254 255.255.255.0 Router(Config-if)# ip access-group 106 in B:通过TCP截取防范。(这会给路由器产生一定负载)
  Router(Config)# ip tcp intercept list 107 Router(Config)# access-list 107 permit tcp any 192.168.0.0 0.0.0.255 Router(Config)# access-list 107 deny ip any any Router(Config)# interface eth0 Router(Config)# ip access-group 107 in3、 LAND.C 进攻的防范。
  Router(Config)# access-list 107 deny ip host 192.168.1.254 host 192.168.1.254 Router(Config)# access-list 107 permit ip any any Router(Config)# interface eth 0/2 Router(Config-if)# ip address 192.168.1.254 255.255.255.0 Router(Config-if)# ip access-group 107 in4、 Smurf进攻的防范。
  Router(Config)# access-list 108 deny ip any host 192.168.1.255 Router(Config)# access-list 108 deny ip any host 192.168.1.0 Router(Config)# access-list 108 permit ip any any Router(Config-if)# ip access-group 108 in5、 ICMP协议的安全配置。对于进入ICMP流,我们要禁止ICMP协议的ECHO、Redirect、Mask request.也需要禁止TraceRoute命令的探测。对于流出的ICMP流,我们可以允许ECHO、Parameter Problem、Packet too big.还有TraceRoute命令的使用。! outbound ICMP Control Router(Config)# access-list 110 deny icmp any any echo Router(Config)# access-list 110 deny icmp any any redirect Router(Config)# access-list 110 deny icmp any any mask-request Router(Config)# access-list 110 permit icmp any any! Inbound ICMP Control Router(Config)# access-list 111 permit icmp any any echo Router(Config)# access-list 111 permit icmp any any Parameter-problem Router(Config)# access-list 111 permit icmp any any packet-too-big Router(Config)# access-list 111 permit icmp any any source-quench Router(Config)# access-list 111 deny icmp any any! Outbound TraceRoute Control Router(Config)# access-list 112 deny udp any any range 33400 34400! Inbound TraceRoute Control Router(Config)# access-list 112 permit udp any any range 33400 34400 6、 DDoS(Distributed Denial of Service)的防范。! The TRINOO DDoS system Router(Config)# access-list 113 deny tcp any any eq 27665 Router(Config)# access-list 113 deny udp any any eq 31335 Router(Config)# access-list 113 deny udp any any eq 27444! The Stacheldtraht DDoS system Router(Config)# access-list 113 deny tcp any any eq 16660 Router(Config)# access-list 113 deny tcp any any eq 65000! The TrinityV3 System Router(Config)# access-list 113 deny tcp any any eq 33270 Router(Config)# access-list 113 deny tcp any any eq 39168! The SubSeven DDoS system and some Variants Router(Config)# access-list 113 deny tcp any any range 6711 6712 Router(Config)# access-list 113 deny tcp any any eq 6776 Router(Config)# access-list 113 deny tcp any any eq 6669 Router(Config)# access-list 113 deny tcp any any eq 2222 Router(Config)# access-list 113 deny tcp any any eq 7000 Router(Config)# access-list 113 permit ip any any Router(Config-if)# ip access-group 113 in7、 Sql蠕虫的防范Router(Config)# access-list 114 deny udp any any eq 1434 Router(Config)# access-list 114 permit ip any any Router(Config-if)# ip access-group 114 in8、 减少BGP的收敛时间,保证黑客攻击后网络能尽快恢复。
      


  

建议增加如下配置:(需在所有运行BGP的路由器上增加)

  1、在每个BGP互连的接口上,增加hold-queue 1500命令,将接口的hold-queue由默认的75增加到1500.在做此配置之前需要先检查板卡的内存,确保其free memory至少为20M.

  2、增加以下有关TCP的配置,增强BGP的收敛性能。

  ip tcp selective-ack ip tcp mss 1460 ip tcp window-size 65535 ip tcp queuemax 50 ip tcp path-mtu-discovery
  

 

  3、在GSR上,增加ip cef linecard ipc memory 10000命令,提高download FIB的速度。</P><P>9、 启用CAR和系统日志等来增强(略)</P><P>其他注意事项:

  1,及时的升级IOS软件,并且要迅速的为IOS安装补丁。

  2,要严格认真的为IOS作安全备份。

  3,要为路由器的配置文件作安全备份。

        4,购买UPS设备,或者至少要有冗余电源。

  5,要有完备的路由器的安全访问和维护记录日志。

 

相关内容
赞助商链接