L2L IPSec ××× over Router + PAT

拓撲以下:dom

wKioL1do7k_j5PhoAAC3gd-fvdw366.png

要求:ide

一、PC1能夠經過IPSec ×××與PC2通訊。加密

二、PC1和PC2經過邊界路由器的PAT與Internet上的ISP通訊。spa


配置說明:3d

在配置IPSec ×××前,要先解決三個路由問題,從加密設備角度看:orm

一、本地通信點路由;視頻

二、遠端加密點路由;server

三、遠端通信點路由。 //該路由的目的不是爲了讓本加密點與遠端通訊點實現通訊,是爲了確保數據包匹配IPSEC SA的感興趣流,從而撞擊出端口上的crypto map來實現加密。不然路由器不知道從哪一個端口送出數據包,也就沒法匹配crypto map的感興趣流。blog

wKiom1do-d7wNcB3AAPebIMUjvA292.png

(圖片來自現任明教教主***教學視頻)圖片


配置腳本:


ISP:

en
conf t
no ip domain-lookup
line console 0
logging synchronous
exec-timeout 0 0
exit
line vty 0 15
logging synchronous
exec-timeout 0 0
password cisco
exit
enable password password
ip subnet-zero
hostname ISP
int f1/0
ip add 1.1.1.2 255.255.255.252
no shut
int f0/0
ip add 2.2.2.1 255.255.255.252
no shut
exit
ip http server
end



R1:

en
conf t
no ip domain-lookup
line console 0
logging synchronous
exec-timeout 0 0
exit
line vty 0 15
logging synchronous
exec-timeout 0 0
password cisco
exit
ip subnet-zero
hostname R1
int f1/0
ip add 1.1.1.1 255.255.255.252
no shut
int f0/0
ip add 192.168.0.1 255.255.255.0
no shut
exit
ip route 0.0.0.0 0.0.0.0 1.1.1.2    //該條目同時解決了遠端加密點和遠端通信點的路由問題,本地通信點路由爲直連無需添加。
end
ping 1.1.1.2


L2L IPSec***配置:

conf t
crypto isakmp enable
crypto isakmp policy 10
encryption 3des
hash md5
group 2
authentication pre-share
exit
crypto isakmp key 0 cisco123 address 2.2.2.2
ip access-list extended l2l***
permit ip 192.168.0.0 0.0.0.255 10.0.0.0 0.0.0.255
exit
crypto ipsec transform-set l2ltrans esp-aes esp-sha-hmac
mode tunnel
exit
crypto map outmap 1 ipsec-isakmp
set peer 2.2.2.2
set transform-set l2ltrans
match address l2l***
exit
int f1/0
crypto map outmap
end

啓用PAT:

conf t
ip access-list extended PAT
deny ip 192.168.0.0 0.0.0.255 10.0.0.0 0.0.0.255        //注意:必須從PAT的流量中排除掉IPSEC SA流量,不然IPSEC SA流量沒法穿越IPSEC ***
permit ip 192.168.0.0 0.0.0.255 any
exit
int f1/0
ip nat outside
int f0/0
ip nat inside
exit
ip nat inside source list PAT interface f1/0 overload
end



R2:

en
conf t
no ip domain-lookup
line console 0
logging synchronous
exec-timeout 0 0
exit
line vty 0 15
logging synchronous
exec-timeout 0 0
password cisco
exit
ip subnet-zero
hostname R2
int f0/0
ip add 2.2.2.2 255.255.255.252
no shut
int f1/0
ip add 10.0.0.2 255.255.255.0
no shut
exit
ip route 0.0.0.0 0.0.0.0 2.2.2.1
end
ping 2.2.2.1


L2L IPSec***配置:

conf t
crypto isakmp enable
crypto isakmp policy 10
encryption 3des
hash md5
group 2
authentication pre-share
exit
crypto isakmp key 0 cisco123 address 1.1.1.1
ip access-list extended l2l***
permit ip 10.0.0.0 0.0.0.255 192.168.0.0 0.0.0.255
exit
crypto ipsec transform-set l2ltrans esp-aes esp-sha-hmac
mode tunnel
exit
crypto map outmap 1 ipsec-isakmp
set peer 1.1.1.1
set transform-set l2ltrans
match address l2l***
exit
int f0/0
crypto map outmap
end


啓用PAT:

conf t
ip access-list extended PAT
deny ip 10.0.0.0 0.0.0.255 192.168.0.0 0.0.0.255
permit ip 10.0.0.0 0.0.0.255 any
exit
int f0/0
ip nat outside
int f1/0
ip nat inside
exit
ip nat inside source list PAT interface f0/0 overload
end


PC1:

en
conf t
no ip domain-lookup
line console 0
logging synchronous
exec-timeout 0 0
exit
line vty 0 15
logging synchronous
exec-timeout 0 0
password cisco
exit
ip subnet-zero
hostname PC1
enable password password
int f0/0
ip add 192.168.0.5 255.255.255.0
no shut
exit
no ip routing
ip default-gateway 192.168.0.1
end
ping 192.168.0.1



PC2:

en
conf t
no ip domain-lookup
line console 0
logging synchronous
exec-timeout 0 0
exit
line vty 0 15
logging synchronous
exec-timeout 0 0
password cisco
exit
ip subnet-zero
hostname PC2
enable password password
int f0/0
ip add 10.0.0.5 255.255.255.0
no shut
exit
no ip routing
ip default-gateway 10.0.0.2
end
ping 10.0.0.2


驗證:

wKiom1do8HayhecwAABwAQd6rp0180.png


wKioL1do8NWgMF96AABd7xGCJPA153.png

抓包截圖:

wKioL1do8_XgzqBAAACHSatFwgs274.png

相關文章
相關標籤/搜索