- 论坛徽章:
- 0
|
一、 路由器网络服务安全配置\r\n1 禁止CDP(Cisco Discovery Protocol)。如:\r\nRouter(Config)#no cdp run \r\nRouter(Config-if)# no cdp enable\r\n2 禁止其他的TCP、UDP Small服务。\r\nRouter(Config)# no service tcp-small-servers\r\n\r\nRouter(Config)# no service udp-samll-servers\r\n3 禁止Finger服务。\r\nRouter(Config)# no ip finger\r\nRouter(Config)# no service finger\r\n4 建议禁止HTTP服务。\r\nRouter(Config)# no ip http server \r\n如果启用了HTTP服务则需要对其进行安全配置:设置用户名和密码;采用访问列表进行控制。\r\n5 禁止BOOTp服务。\r\nRouter(Config)# no ip bootp server\r\n6 禁止IP Source Routing。\r\nRouter(Config)# no ip source-route\r\n7 建议如果不需要ARP-Proxy服务则禁止它,路由器默认识开启的。\r\nRouter(Config)# no ip proxy-arp\r\nRouter(Config-if)# no ip proxy-arp\r\n8禁止IP Directed Broadcast。\r\nRouter(Config)# no ip directed-broadcast\r\n9 禁止IP Classless。\r\nRouter(Config)# no ip classless\r\n10 禁止ICMP协议的IP Unreachables, Redirects, Mask Replies。\r\nRouter(Config-if)# no ip unreacheables\r\nRouter(Config-if)# no ip redirects\r\nRouter(Config-if)# no ip mask-reply\r\n11 建议禁止SNMP协议服务。在禁止时必须删除一些SNMP服务的默认配置。如:\r\nRouter(Config)# no snmp-server community public Ro\r\nRouter(Config)# no snmp-server community admin RW\r\n12 如果没必要则禁止WINS和DNS服务。\r\nRouter(Config)# no ip domain-lookup\r\n如果需要则需要配置:\r\nRouter(Config)# hostname Router\r\nRouter(Config)# ip name-server 219.150.32.xxx\r\n13 明确禁止不使用的端口。如:\r\nRouter(Config)# interface eth0/3\r\nRouter(Config)# shutdown</P><P>二、路由器访问控制的安全配置(可选)\r\n路由器的访问控制是比较重要的安全措施,但是目前由于需求不明确,可以考虑暂时不实施。作为建议提供。\r\n1 建议不要远程访问路由器。即使需要远程访问路由器,建议使用访问控制列表和高强度的密码控制。\r\n2 严格控制CON端口的访问。\r\n配合使用访问控制列表控制对CON口的访问。\r\n如:Router(Config)#Access-list 1 permit 192.168.0.1\r\nRouter(Config)#line con 0\r\nRouter(Config-line)#Transport input none\r\nRouter(Config-line)#Login local\r\nRouter(Config-line)#Exec-timeoute 5 0\r\nRouter(Config-line)#access-class 1 in\r\nRouter(Config-line)#end\r\n同时给CON口设置高强度的密码。\r\n3 如果不使用AUX端口,则禁止这个端口。默认是未被启用。禁止如:\r\nRouter(Config)#line aux 0\r\nRouter(Config-line)#transport input none\r\nRouter(Config-line)#no exec\r\n4 建议采用权限分级策略。如:\r\nRouter(Config)#username test privilege 10 xxxx\r\nRouter(Config)#privilege EXEC level 10 telnet\r\nRouter(Config)#privilege EXEC level 10 show ip access-list\r\n5 为特权模式的进入设置强壮的密码。不要采用enable password设置密码。而要采用enable secret命令设置。并且要启用Service password-encryption。\r\nRouter(config)#service password-encryption\r\nRouter(config)#enable secret\r\n6 控制对VTY的访问。如果不需要远程访问则禁止它。如果需要则一定要设置强壮的密码。由于VTY在网络的传输过程中为加密,所以需要对其进行严格的控制。如:设置强壮的密码;控制连接的并发数目;采用访问列表严格控制访问的地址;可以采用AAA设置用户的访问控制等。</P><P>三、路由器路由协议安全配置\r\n1 建议启用IP Unicast Reverse-Path Verification。它能够检查源IP地址的准确性,从而可以防止一定的IP Spooling。但是它只能在启用CEF(Cisco Express Forwarding)的路由器上使用。\r\nuRPF有三种方式,strict方式、ACL方式和loose方式。在接入路由器上实施时,对于通过单链路接入网络的用户,建议采用strict方式;对于通过多条链路接入到网络的用户,可以采用ACL方式和loose方式。在出口路由器上实施时,采用loose方式。</P><P>Strict方式:\r\nRouter# config t\r\n! 启用CEF\r\nRouter(Config)# ip cef\r\n!启用Unicast Reverse-Path Verification\r\nRouter(Config)# interface eth0/1\r\nRouter(Config-if)# ip verify unicast reverse-path </P><P>ACL方式:\r\ninterface pos1/0\r\nip verify unicast reverse-path 190\r\naccess-list 190 permit ip {customer network} {customer network mask} any \r\naccess-list 190 deny ip any any [log] \r\n这个功能检查每一个经过路由器的数据包的源地址,若是不符合ACL的,路由器将丢弃该数据包。\r\n\r\nLoose方式:\r\ninterface pos 1/0\r\nip ver unicast source reachable-via any\r\n这个功能检查每一个经过路由器的数据包,在路由器的路由表中若没有该数据包源IP地址的路由,路由器将丢弃该数据包。</P><P>2 启用OSPF路由协议的认证。默认的OSPF认证密码是明文传输的,建议启用MD5认证。并设置一定强度密钥(key,相对的路由器必须有相同的Key)。\r\n3 RIP协议的认证。只有RIP-V2支持,RIP-1不支持。建议启用RIP-V2。并且采用MD5认证。普通认证同样是明文传输的。\r\n4 启用passive-interface命令可以禁用一些不需要接收和转发路由信息的端口。建议对于不需要路由的端口,启用passive-interface。但是,在RIP协议是只是禁止转发路由信息,并没有禁止接收。在OSPF协议中是禁止转发和接收路由信息。\r\n5 启用访问列表过滤一些垃圾和恶意路由信息,控制网络的垃圾信息流。如:\r\nRouter(Config)# access-list 10 deny 192.168.1.0 0.0.0.255\r\nRouter(Config)# access-list 10 permit any \r\n! 禁止路由器接收更新192.168.1.0网络的路由信息\r\nRouter(Config)# router ospf 100\r\nRouter(Config-router)# distribute-list 10 in\r\n!禁止路由器转发传播192.168.1.0网络的路由信息\r\nRouter(Config)# router ospf 100\r\nRouter(Config-router)# distribute-list 10 out</P><P>四、路由器其他安全配置\r\n1 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)。\r\nRouter(Config)# access-list 100 deny ip 127.0.0.0 0.255.255.255 any \r\nRouter(Config)# access-list 100 deny ip 192.168.0.0 0.0.255.255 any \r\nRouter(Config)# access-list 100 deny ip 172.16.0.0 0.15.255.255 any \r\nRouter(Config)# access-list 100 deny ip 10.0.0.0 0.255.255.255 any \r\nRouter(Config)# access-list 100 deny ip 169.254.0.0 0.0.255.255 any \r\nRouter(Config)# access-list 100 deny ip 192.0.2.0 0.0.0.255 any \r\nRouter(Config)# access-list 100 deny ip 224.0.0.0 15.255.255.255 any \r\nRouter(Config)# access-list 100 deny ip 20.20.20.0 0.0.0.255 any \r\nRouter(Config)# access-list 100 deny ip 204.152.64.0 0.0.2.255 any \r\nRouter(Config)# access-list 100 deny ip 0.0.0.0 0.255.255.255 any \r\nRouter(Config)# access-list 100 permit ip any any\r\nRouter(Config-if)# ip access-group 100 in</P><P>2 建议采用访问列表控制流出内部网络的地址必须是属于内部网络的。(可选)如:\r\nRouter(Config)# no access-list 101\r\nRouter(Config)# access-list 101 permit ip 192.168.0.0 0.0.255.255 any\r\nRouter(Config)# access-list 101 deny ip any any \r\nRouter(Config)# interface eth 0/1\r\nRouter(Config-if)# description “internet Ethernet”\r\nRouter(Config-if)# ip address 192.168.0.254 255.255.255.0\r\nRouter(Config-if)# ip access-group 101 in</P><P>其他可选项:\r\n1、 建议启用SSH,废弃掉Telnet。但只有支持并带有IPSec特征集的IOS才支持SSH。并且IOS12.0-IOS12.2仅支持SSH-V1。如下配置SSH服务的例子:\r\nRouter(Config)# config t\r\nRouter(Config)# no access-list 22\r\nRouter(Config)# access-list 22 permit 192.168.0.22\r\nRouter(Config)# access-list deny any\r\nRouter(Config)# username test privilege 10 ****\r\n! 设置SSH的超时间隔和尝试登录次数\r\nRouter(Config)# ip ssh timeout 90\r\nRouter(Config)# ip ssh anthentication-retries 2\r\nRouter(Config)# line vty 0 4\r\nRouter(Config-line)# access-class 22 in\r\nRouter(Config-line)# transport input ssh\r\nRouter(Config-line)# login local\r\nRouter(Config-line)# exit\r\n!启用SSH服务,生成RSA密钥对。\r\nRouter(Config)# crypto key generate rsa\r\nThe name for the keys will be: router.xxx \r\nChoose 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. \r\nHow many bits in the modulus[512]: 2048 \r\nGenerating RSA Keys... \r\n[OK] \r\nRouter(Config)#</P><P>2、 TCP SYN的防范。如:\r\nA: 通过访问列表防范。\r\nRouter(Config)# no access-list 106 \r\nRouter(Config)# access-list 106 permit tcp any 192.168.0.0 0.0.0.255 established\r\nRouter(Config)# access-list 106 deny ip any any \r\nRouter(Config)# interface eth 0/2\r\nRouter(Config-if)# description “external Ethernet”\r\nRouter(Config-if)# ip address 192.168.1.254 255.255.255.0\r\nRouter(Config-if)# ip access-group 106 in\r\nB:通过TCP截取防范。(这会给路由器产生一定负载)\r\nRouter(Config)# ip tcp intercept list 107\r\nRouter(Config)# access-list 107 permit tcp any 192.168.0.0 0.0.0.255\r\nRouter(Config)# access-list 107 deny ip any any \r\nRouter(Config)# interface eth0\r\nRouter(Config)# ip access-group 107 in</P><P>3、 LAND.C 进攻的防范。\r\nRouter(Config)# access-list 107 deny ip host 192.168.1.254 host 192.168.1.254 \r\nRouter(Config)# access-list 107 permit ip any any\r\nRouter(Config)# interface eth 0/2\r\nRouter(Config-if)# ip address 192.168.1.254 255.255.255.0\r\nRouter(Config-if)# ip access-group 107 in</P><P>4、 Smurf进攻的防范。\r\nRouter(Config)# access-list 108 deny ip any host 192.168.1.255 \r\nRouter(Config)# access-list 108 deny ip any host 192.168.1.0 \r\nRouter(Config)# access-list 108 permit ip any any\r\nRouter(Config-if)# ip access-group 108 in</P><P>5、 ICMP协议的安全配置。对于进入ICMP流,我们要禁止ICMP协议的ECHO、Redirect、Mask request。也需要禁止TraceRoute命令的探测。对于流出的ICMP流,我们可以允许ECHO、Parameter Problem、Packet too big。还有TraceRoute命令的使用。\r\n! outbound ICMP Control\r\nRouter(Config)# access-list 110 deny icmp any any echo \r\nRouter(Config)# access-list 110 deny icmp any any redirect \r\nRouter(Config)# access-list 110 deny icmp any any mask-request \r\nRouter(Config)# access-list 110 permit icmp any any \r\n! Inbound ICMP Control\r\nRouter(Config)# access-list 111 permit icmp any any echo\r\nRouter(Config)# access-list 111 permit icmp any any Parameter-problem\r\nRouter(Config)# access-list 111 permit icmp any any packet-too-big\r\nRouter(Config)# access-list 111 permit icmp any any source-quench\r\nRouter(Config)# access-list 111 deny icmp any any \r\n! Outbound TraceRoute Control\r\nRouter(Config)# access-list 112 deny udp any any range 33400 34400 \r\n! Inbound TraceRoute Control\r\nRouter(Config)# access-list 112 permit udp any any range 33400 34400 </P><P>6、 DDoS(Distributed Denial of Service)的防范。\r\n! The TRINOO DDoS system\r\nRouter(Config)# access-list 113 deny tcp any any eq 27665 \r\nRouter(Config)# access-list 113 deny udp any any eq 31335 \r\nRouter(Config)# access-list 113 deny udp any any eq 27444 \r\n! The Stacheldtraht DDoS system \r\nRouter(Config)# access-list 113 deny tcp any any eq 16660 \r\nRouter(Config)# access-list 113 deny tcp any any eq 65000 \r\n! The TrinityV3 System\r\nRouter(Config)# access-list 113 deny tcp any any eq 33270 \r\nRouter(Config)# access-list 113 deny tcp any any eq 39168 \r\n! The SubSeven DDoS system and some Variants\r\nRouter(Config)# access-list 113 deny tcp any any range 6711 6712 \r\nRouter(Config)# access-list 113 deny tcp any any eq 6776 \r\nRouter(Config)# access-list 113 deny tcp any any eq 6669 \r\nRouter(Config)# access-list 113 deny tcp any any eq 2222 \r\nRouter(Config)# access-list 113 deny tcp any any eq 7000 \r\nRouter(Config)# access-list 113 permit ip any any\r\nRouter(Config-if)# ip access-group 113 in</P><P>7、 Sql蠕虫的防范\r\nRouter(Config)# access-list 114 deny udp any any eq 1434\r\nRouter(Config)# access-list 114 permit ip any any\r\nRouter(Config-if)# ip access-group 114 in</P><P>8、 减少BGP的收敛时间,保证黑客攻击后网络能尽快恢复。\r\n建议增加如下配置:(需在所有运行BGP的路由器上增加)\r\n1、在每个BGP互连的接口上,增加hold-queue 1500命令,将接口的hold-queue由默认的75增加到1500。在做此配置之前需要先检查板卡的内存,确保其free memory至少为20M。\r\n2、增加以下有关TCP的配置,增强BGP的收敛性能。\r\nip tcp selective-ack\r\nip tcp mss 1460\r\nip tcp window-size 65535\r\nip tcp queuemax 50\r\nip tcp path-mtu-discovery\r\n3、在GSR上,增加ip cef linecard ipc memory 10000命令,提高download FIB的速度。</P><P>9、 启用CAR和系统日志等来增强(略)</P><P>其他注意事项:\r\n1,及时的升级IOS软件,并且要迅速的为IOS安装补丁。\r\n2,要严格认真的为IOS作安全备份。\r\n3,要为路由器的配置文件作安全备份。\r\n4,购买UPS设备,或者至少要有冗余电源。\r\n5,要有完备的路由器的安全访问和维护记录日志 |
|