Router(Config)# no snmp-server community public Ro Router(Config)# no snmp-server community admin RW Router(Config)# no access-list 70 Router(Config)# access-list 70 deny any Router(Config)# snmp-server community MoreHardPublic Ro 70 Router(Config)# no snmp-server enable traps Router(Config)# no snmp-server system-shutdown Router(Config)# no snmp-server trap-anth Router(Config)# no snmp-server Router(Config)# end
Router(Config)# access-list 100 deny ip 192.168.0.0 0.0.0.255 any log Router(Config)# access-list 100 deny ip 127.0.0.0 0.255.255.255 any log Router(Config)# access-list 100 deny ip 192.168.0.0 0.0.255.255 any log Router(Config)# access-list 100 deny ip 172.16.0.0 0.15.255.255 any log Router(Config)# access-list 100 deny ip 10.0.0.0 0.255.255.255 any log Router(Config)# access-list 100 deny ip 169.254.0.0 0.0.255.255 any log Router(Config)# access-list 100 deny ip 192.0.2.0 0.0.0.255 any log 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 log Router(Config)# access-list 100 deny ip 204.152.64.0 0.0.2.255 any log Router(Config)# access-list 100 deny ip 0.0.0.0 0.255.255.255 any log
8.建议采用访问列表控制流出内部网络的地址必须是属于内部网络的。 如:
Router(Config)# no access-list 101 Router(Config)# access-list 101 permit ip 192.168.0.0 0.0.0.255 any Router(Config)# access-list 101 deny ip any any log 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
9.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 log 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 log Router(Config)# interface eth0 Router(Config)# ip access-group 107 in
10.LAND.C 进攻的防范。
Router(Config)# access-list 107 deny ip host 192.168.1.254 host 192.168.1.254 log Router(Config)# access-list 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 in
11.Smurf进攻的防范。
Router(Config)# access-list 108 deny ip any host 192.168.1.255 log
Router(Config)# access-list 108 deny ip any host 192.168.1.0 log
12.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 log Router(Config)# access-list 110 deny icmp any any redirect log Router(Config)# access-list 110 deny icmp any any mask-request log 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 log ! 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
13.DDoS(Distributed Denial of Service)的防范。
! The TRINOO DDoS system Router(Config)# access-list 113 deny tcp any any eq 27665 log Router(Config)# access-list 113 deny udp any any eq 31335 log Router(Config)# access-list 113 deny udp any any eq 27444 log ! The Stacheldtraht DDoS system Router(Config)# access-list 113 deny tcp any any eq 16660 log Router(Config)# access-list 113 deny tcp any any eq 65000 log ! The TrinityV3 System Router(Config)# access-list 113 deny tcp any any eq 33270 log Router(Config)# access-list 113 deny tcp any any eq 39168 log ! The SubSeven DDoS system and some Variants Router(Config)# access-list 113 deny tcp any any range 6711 6712 log Router(Config)# access-list 113 deny tcp any any eq 6776 log Router(Config)# access-list 113 deny tcp any any eq 6669 log Router(Config)# access-list 113 deny tcp any any eq 2222 log Router(Config)# access-list 113 deny tcp any any eq 7000 log
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 BluShin privilege 10 G00dPa55w0rd ! 设置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.blushin.org 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)# !