一、 路由器網絡服務安全配置
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

二、路由器訪問控制的安全配置(可選)
路由器的訪問控制是比較重要的安全措施,但是目前由於需求不明確,可以考慮暫時不實施。作為建議提供。
1 建議不要遠程訪問路由器。即使需要遠程訪問路由器,建議使用訪問控制列表和高強度的密碼控制。
2 嚴格控制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

四、路由器其他安全配置
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 in

2 建議採用訪問列表控制流出內部網絡的地址必須是屬於內部網絡的。(可選)如:
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 in

3、 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 in

4、 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 in

5、 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 in

7、 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 in

8、 減少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的速度。

9、 啟用CAR和系統日誌等來增強(略)

其他注意事項:
1,及時的升級IOS軟件,並且要迅速的為IOS安裝補丁。
2,要嚴格認真的為IOS作安全備份。
3,要為路由器的配置文件作安全備份。
4,購買UPS設備,或者至少要有冗餘電源。
5,要有完備的路由器的安全訪問和維護記錄日誌

資料來源 中國黑客聯盟 www.cnhacker.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 ivan0914 的頭像
    ivan0914

    I'n Blog 之萬象真藏

    ivan0914 發表在 痞客邦 留言(0) 人氣()