一.概述:網絡
LAN-to-LAN IPSEC ×××若是兩端內網地址重疊,互相不能訪問,須要配置NAT,每端把對方當作是另一個網絡才能互訪。路由器沒法調整靜態NAT和動態PAT優先級,致使配置靜態NAT以後沒法上公網,只能藉助PBR,利用兩種不一樣的配置NAT方法,把PAT上公網的流量與×××的靜態NAT流量分開。ASA8.3以後有twice NAT,能指定源和目的,本次測試ASA8.4如何用twice NAT來解決地址重疊的問題,參考連接:https://supportforums.cisco.com/docs/DOC-13429 。app
通過測試,若是PIX8.0與路由器創建L2L IPSec ×××,只能經過PIX這側解決地址重疊問題,這時PIX內部的設備是沒法經過PIX上公網的,主要緣由在於跟路由器相似,靜態NAT優先級很高,而PIX又沒法配置PBR,把流量打到loopback口(pix8.0就根本沒法配置loopback口)。
ide
二.基本思路:oop
A.利用NAT優先於IPSEC特性,配置ASA8.4的twice NAT,使得兩端內網能夠互訪。測試
B.由於twice NAT的目標地址爲對方轉換後的私網地址,因此PAT上公網與twice NAT能同時共存。spa
三.測試拓撲:orm
四.基本配置:server
A.總部server路由器:blog
interface Ethernet0/0
ip address 10.1.1.2 255.255.255.0
no shutip
ip route 0.0.0.0 0.0.0.0 10.1.1.1
B.總部ASA842防火牆:
interface GigabitEthernet0
nameif Inside
security-level 100
ip address 10.1.1.1 255.255.255.0
no shut
interface GigabitEthernet1
nameif Outside
security-level 0
ip address 202.100.1.1 255.255.255.0
no shut
route Outside 0.0.0.0 0.0.0.0 202.100.1.10
C.Internet路由器:
interface Ethernet0/0
ip address 202.100.1.10 255.255.255.0
no shut
interface Ethernet0/1
ip address 202.100.2.10 255.255.255.0
no shut
D.分支Branch路由器:
interface Ethernet0/0
ip address 10.1.1.1 255.255.255.0
no shut
interface Ethernet0/1
ip address 202.100.2.1 255.255.255.0
no shut
ip route 0.0.0.0 0.0.0.0 202.100.2.10
E.分支Inside路由器:
interface Ethernet0/0
ip address 10.1.1.2 255.255.255.0
no shut
ip route 0.0.0.0 0.0.0.0 10.1.1.1
五.L2L IPSEC ×××配置:
A.總部ASA842防火牆:
①第一階段策略:
crypto ikev1 policy 10
authentication pre-share
encryption des
hash md5
group 2
tunnel-group 202.100.2.1 type ipsec-l2l
tunnel-group 202.100.2.1 ipsec-attributes
ikev1 pre-shared-key cisco
crypto ikev1 enable Outside
crypto isakmp identity address
②第二階段轉換集:
crypto ipsec ikev1 transform-set transet esp-des esp-md5-hmac
③感興趣流:
access-list *** extended permit ip 172.16.1.0 255.255.255.0 10.1.1.0 255.255.255.0
---注意源地址爲本地內網網絡在ASA上映射後的地址,目標地址爲對方的實際地址
④配置cryto map並應用:
crypto map crymap 10 match address ***
crypto map crymap 10 set peer 202.100.2.1
crypto map crymap 10 set ikev1 transform-set transet
crypto map crymap 10 set reverse-route
crypto map crymap interface Outside
B.分支Branch路由器:
①第一階段策略:
crypto isakmp policy 10
hash md5
authentication pre-share
group 2
en des
crypto isakmp key cisco address 202.100.1.1
②第二階段轉換集:
crypto ipsec transform-set transet esp-des esp-md5-hmac
③感興趣流:
ip access-list extended ***
permit ip 10.1.1.0 0.0.0.255 172.16.1.0 0.0.0.255
---注意爲本地的真實地址到對方映射後的地址,兩邊互爲鏡像。
④配置cryto map並應用:
crypto map crymap 10 ipsec-isakmp
set peer 202.100.1.1
set transform-set transet
match address ***
interface E0/1
crypto map crymap
六.NAT配置:
---L2L IPSEC ×××由於感興趣流爲NAT以後的地址,這時×××還不能通。
A.PAT上公網配置:
①總部ASA842防火牆:
object network Inside-pat
subnet 10.1.1.0 255.255.255.0
nat (Inside,Outside) dynamic interface
測試:
對icmp進行審查:
policy-map global_policy
class inspection_default
inspect icmp
Server#ping 202.100.1.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 202.100.1.10, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/62/132 m
②分支Branch路由器:
interface E0/0
ip nat enable
interface e0/1
ip nat enable
ip access-list extended Internet
deny ip 10.1.1.0 0.0.0.255 172.16.1.0 0.0.0.255
permit ip 10.1.1.0 0.0.0.255 any
ip nat source list Internet interface Ethernet0/1 overload
測試:
Inside#ping 202.100.2.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 202.100.2.10, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/93/188 ms
B.總部ASA842的twice NAT配置:
object network Inside_Real
subnet 10.1.1.0 255.255.255.0
object network Inside_Mapped
subnet 172.16.1.0 255.255.255.0
object network Branch_Real
subnet 10.1.1.0 255.255.255.0
object network Branch_Mapped
subnet 192.168.1.0 255.255.255.0
nat (Inside,Outside) source static Inside_Real Inside_Mapped destination static Branch_Mapped Branch_Real
七.測試:
------總部的Server路由器既能上公網,又能訪問對方。
Server#ping 192.168.1.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:.!!!!Success rate is 80 percent (4/5), round-trip min/avg/max = 48/104/148 msServer#ping 202.100.1.10Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 202.100.1.10, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 12/61/132 msServer#