公司最近增長一臺CISCO ASA 5510-K8 防火牆設備,也算是初次接觸吧,一波三折,折騰了一個多星期也算基本摸清,現爲這一個多星期的折騰記錄一下,往後少作一些無用功。此次ASA主要用於遠程接入及一部分服務器外網訪問,按此需求也列出如下ASA需配置的項目:
一、遠程接入,IPSec *** 或SSL *** ,因購買此型號的防火牆SSL ***受權只有兩個,只有選擇IPsec ***使用了;
二、作NAT 實現外網訪問,相關ACL控制指定服務器鏈接外網;
三、端口映射,把相關須要使用的服務器端口映射到公網使用,如2五、110等。ios
簡單拓撲圖以下:web
h3c s5500-ei 配置主要點:sql
ip route-static 0.0.0.0 0.0.0.0 172.65.3.1 description to asa
ip route-static 10.0.0.0 255.0.0.0 192.168.193.1 description to qq
ip route-static 172.0.0.0 255.0.0.0 192.168.193.1 description overto qq
ip route-static 192.0.0.0 255.0.0.0 192.168.193.1 description to qq安全
ASA配置:服務器
ciscoasa(config)# sh run
: Saved
:
ASA Version 8.2(5)
!
hostname ciscoasa
enable password 2KFQnbNIdI.2KYOU encrypted
passwd 2KFQnbNIdI.2KYOU encrypted
names
!
interface Ethernet0/0
nameif outside
security-level 0
ip address xxx.xxx.xxx.xxx 255.255.255.248 \\外網接口IP
!
interface Ethernet0/1
nameif inside
security-level 100
ip address 172.65.3.1 255.255.255.0 \\內網接口IP
!
interface Ethernet0/2
shutdown
no nameif
no security-level
no ip address
!
interface Ethernet0/3
shutdown
no nameif
no security-level
no ip address
!
interface Management0/0
shutdown
no nameif
no security-level
no ip address
!
ftp mode passive
clock timezone CST 8
access-list test***_splitTunnelAcl standard permit 172.65.0.0 255.255.0.0 網絡
\\***接入時上述IP流量作隧道分割,如不開啓隧道分割技術***接入的用戶就不能使用本地internet了。這裏需注意的
access-list permitwww extended permit ip host 172.65.12.24 any \\控制部分服務器訪問外網
access-list permitwww extended permit icmp any any \\icmp 流量允許經過
access-list inside_nat0_outbound extended permit ip 172.65.0.0 255.255.0.0 172.65.3.0 255.255.255.0 \\nat免除,表示從172.65.0.0/16網段經過172.65.3.0/24時不進行nat轉換
pager lines 24
logging enable
logging asdm informational
mtu outside 1500
mtu inside 1500
ip local pool ipsecpool 172.65.3.100-172.65.3.200 mask 255.255.255.0 \\接入***客戶端地址池
icmp unreachable rate-limit 1 burst-size 1
asdm p_w_picpath disk0:/asdm-645.bin \\asdm 加載鏡像,asdm是個好東西,把asa配置簡化了好多
no asdm history enable
arp timeout 14400
global (outside) 1 interface \\配置單個地址爲outside接口地址,若有多個公網IP也能夠配置爲一個地址池
nat (inside) 0 access-list inside_nat0_outbound
nat (inside) 1 172.65.0.0 255.255.0.0 \\與上述 global對應使用,即把172.65.0.0/16這個網段的地址轉換爲外網接口IP地址。
access-group permitwww in interface inside \\控制部分服務器外網訪問,此條access-list 在inside
route outside 0.0.0.0 0.0.0.0 xxx.xxx.xxx.xxx 1 \\公網網關 ,默認路由且只有一跳
route inside 172.65.0.0 255.255.0.0 172.65.3.254 1 \\內網網關
timeout xlate 3:00:00
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
timeout tcp-proxy-reassembly 0:01:00
timeout floating-conn 0:00:00
dynamic-access-policy-record DfltAccessPolicy
aaa authentication http console LOCAL \\設置AAA驗證方式。此處爲LOCAL本地用戶驗證
aaa authentication telnet console LOCAL \\同上
aaa authentication serial console LOCAL \\同上
http server enable \\開啓http服務
http 172.65.0.0 255.255.0.0 inside \\充許此網段經過http鏈接上來
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart
crypto ipsec transform-set ESP-3DES-SHA esp-3des esp-sha-hmac
crypto ipsec transform-set ESP-AES-256-MD5 esp-aes-256 esp-md5-hmac
crypto ipsec transform-set ESP-DES-SHA esp-des esp-sha-hmac
crypto ipsec transform-set ESP-DES-MD5 esp-des esp-md5-hmac
crypto ipsec transform-set ESP-AES-192-MD5 esp-aes-192 esp-md5-hmac
crypto ipsec transform-set ESP-3DES-MD5 esp-3des esp-md5-hmac
crypto ipsec transform-set ESP-AES-256-SHA esp-aes-256 esp-sha-hmac
crypto ipsec transform-set ESP-AES-128-SHA esp-aes esp-sha-hmac
crypto ipsec transform-set ESP-AES-192-SHA esp-aes-192 esp-sha-hmac
crypto ipsec transform-set ESP-AES-128-MD5 esp-aes esp-md5-hmac
crypto ipsec security-association lifetime seconds 28800
crypto ipsec security-association lifetime kilobytes 4608000
crypto dynamic-map SYSTEM_DEFAULT_CRYPTO_MAP 65535 set pfs group1
crypto dynamic-map SYSTEM_DEFAULT_CRYPTO_MAP 65535 set transform-set ESP-AES-128-SHA ESP-AES-128-MD5 ESP-AES-192-SHA ESP-AES-192-MD5 ESP-AES-256-SHA ESP-AES-256-MD5 ESP-3DES-SHA ESP-3DES-MD5 ESP-DES-SHA ESP-DES-MD5
crypto map outside_map 65535 ipsec-isakmp dynamic SYSTEM_DEFAULT_CRYPTO_MAP
crypto map outside_map interface outside
crypto ca trustpoint _SmartCallHome_ServerCA
crl configure
crypto ca certificate chain _SmartCallHome_ServerCA
certificate ca 6ecc7aa5a7032009b8cebcf4e952d491
quit
crypto isakmp enable outside
crypto isakmp policy 10
authentication pre-share
encryption 3des
hash sha
group 2
lifetime 86400
telnet 172.65.0.0 255.255.0.0 inside \\容許此網段進行telnet管理
telnet timeout 5 \\超時限制
ssh 172.65.0.0 255.255.0.0 inside \\容許此網段進行ssh登陸管理
ssh timeout 5 \\超時限制
console timeout 0
threat-detection basic-threat
threat-detection statistics access-list
threat-detection statistics tcp-intercept rate-interval 30 burst-rate 400 average-rate 200
web*** \\進入web*** 模式
group-policy test*** internal \\設置一個名爲test*** 的策略組,選項爲internal
group-policy test*** attributes \\設置組策略屬性
dns-server value 172.65.0.10 172.65.0.11 \\***接入的客戶端的dns設置
***-tunnel-protocol IPSec
split-tunnel-policy tunnelspecified \\啓用隧道分離,且只有訪問公司內網時才用。隧道分離有三種方式,這是其中一種。tunnelspecified:容許客戶端訪問客戶端本地網絡以及internet,只有到公司內網的數據流才走分離隧道;excludespecified :僅容許客戶端訪問客戶端本地的網絡,internet和到公司內網的數據流都走分離隧道;tunnelall: 客戶端全部全部流量都走分離隧道
split-tunnel-network-list value test***_splitTunnelAcl \\隧道分離保護的數據, 此處test***_splitTunnelAcl爲上面定義的隧道分離列訪問列表
default-domain value test.com
username admin password sadP6m1bnmnzbmnX encrypted
username test password c2I40Rrw1iizALuA encrypted privilege 0 \\接入***用戶名
username test attributes
***-group-policy test***
tunnel-group test*** type remote-access
tunnel-group test*** general-attributes
address-pool ipsecpool
default-group-policy test***
tunnel-group test*** ipsec-attributes
pre-shared-key *****
!
class-map inspection_default
match default-inspection-traffic
!
!
policy-map type inspect dns preset_dns_map
parameters
message-length maximum client auto
message-length maximum 512
policy-map global_policy
class inspection_default
inspect dns preset_dns_map
inspect ftp
inspect h323 h225
inspect h323 ras
inspect ip-options
inspect netbios
inspect rsh
inspect rtsp
inspect skinny
inspect esmtp
inspect sqlnet
inspect sunrpc
inspect tftp
inspect sip
inspect xdmcp
!
service-policy global_policy global
prompt hostname context
call-home reporting anonymous
call-home
profile CiscoTAC-1
no active
destination address http https://tools.cisco.com/its/service/oddce/services/DDCEService
destination address email callhome@cisco.com
destination transport-method http
subscribe-to-alert-group diagnostic
subscribe-to-alert-group environment
subscribe-to-alert-group inventory periodic monthly
subscribe-to-alert-group configuration periodic monthly
subscribe-to-alert-group telemetry periodic daily
Cryptochecksum:54014531b7373a1bcfb4b3700064302e
: enddom
ASDM設置ipsec 操做步驟(配置asa大多數在asdm下進行,有必要對其有必定的瞭解)ssh
一、Remote Access ***設置:tcp
二、ide
三、共享密鑰,及組策略名
四、選擇驗證方式
五、新增用戶
六、***地址池
七、***鏈接客戶端dns等配置
八、默認K8版本是沒有3DES選項的,需到cisco官網去激活開啓,詳細能夠查看用戶操做說明書說明:
九、開啓隧道分離技術
十、完成前確認:
結束!
***client 設置:
一、connection Entry 爲本身自定義名稱,host爲asa外網ip,group authentication name 爲*** group 名:test***,password爲共享密鑰。
二、點擊鏈接
三、輸入***用戶名密碼。
附錄:
部分ASA初始化的基本配置:
一、安全級別:
outside 默認爲0安全性級別最低,最不信任的!
inside 默認爲100 最信任的安全級別最高
DMZ 1-99安全級別
二、防火牆的默認策略:
Outbound (由高往底) 的流量默認容許 ,如inside到outside
Inbound (由底往高)的流量默認禁止
三、初始化防火牆:
int g0
ip add 202.100.1.10 255.255.255.0
no sh
nameif outside
其它inside 及DMZ接口同理
四、配置ASDM
ASA(config)#username ccie password ccie // 配置用戶名和密碼
ASA(config)#http server enable //啓用https功能
ASA(config)#aaa authentication http console LOCAL //HTTPS認證類型爲本地認證
ASA(config)#http 172.16.1.0 255.255.255.0 inside // 容許來排自inside的流量經過HTTPS網管ASA
五、基本NAT介紹
ASA(config)#object network Inside.traffic //建立一個內部地址名稱traffic
ASA(config-network-object)#subnet 172.16.1.0 255.255.255.0 //定義其地址範圍
ASA(config-network-object)#nat (inside,outside) dynamic interface //完成nat轉換
例:建立一個outside telnet 到DMZ裏的http服務器natASA(config)#object network Inside.telnet //建立一個內部地址名稱DMZ.telnetASA(config-network-object)#subnet host 192.168.1.100 //定義DMZ.telnet的主機地址ASA(config)#object network Outside.telnet //建立一個內部地址名稱outside.telnetASA(config-network-object)#subnet host 202.100.1.100 //定義outside.telnet的主機地址ASA(config-network-object)#nat (DMZ,outside) static Outside.telnet service tcp telnet telnet //完成nat轉換,安全級別需從高流向低