經典GRE Over IPSec配置 (

  • 2020 年 1 月 14 日
  • 筆記

本文繼上文繼續討論gre over ipsec,上次我們是在兩站點之間先建立IPSec連接(transport方式),然後再IPSec連接上再建立gre隧道,進行加密通訊;本次我們換種方式來配置與上文相同的效果。這裡我們用到了cisco路由器ipsec配置的一個技術:profile。

==============================R0配置==============================

crypto isakmp policy 1

encr 3des

hash md5

authentication pre-share

group 2

lifetime 3600

crypto isakmp key 1234 address 192.168.8.1

!

!

crypto ipsec transform-set 1 esp-3des esp-md5-hmac

mode transport

!

crypto ipsec profile 1                           //本文的精髓,配置Profile來代替map

set transform-set 1

set pfs group2

!

interface Tunnel1

ip address 192.168.10.1 255.255.255.0

tunnel source 192.168.1.1

tunnel destination 192.168.8.1

tunnel protection ipsec profile 1

!

interface Serial1/0

ip address 192.168.1.1 255.255.255.0

serial restart-delay 0

R0的路由:

Router#show ip route

C    192.168.10.0/24 is directly connected, Tunnel1

C    192.168.1.0/24 is directly connected, Serial1/0

S*   0.0.0.0/0 is directly connected, Serial1/0

===========================================================================

============================R2配置===============================

!

crypto isakmp policy 1

encr 3des

hash md5

authentication pre-share

group 2

lifetime 3600

crypto isakmp key 1234 address 192.168.1.1

!

!

crypto ipsec transform-set 1 esp-3des esp-md5-hmac

mode transport

!

crypto ipsec profile 1

set transform-set 1

set pfs group2

!

interface Tunnel1

ip address 192.168.10.2 255.255.255.0

tunnel source 192.168.8.1

tunnel destination 192.168.1.1

tunnel protection ipsec profile 1

!

interface Serial1/0

ip address 192.168.8.1 255.255.255.0

serial restart-delay 0

R2的路由:

Router#show ip route

C    192.168.8.0/24 is directly connected, Serial1/0

C    192.168.10.0/24 is directly connected, Tunnel1

S*   0.0.0.0/0 is directly connected, Serial1/0

=================================================================

看到這裡,我們在R0和R2的配置中沒有看到map,在介面上也沒有看到map的載入,這與我們傳統的ipsec的連接不一致,而且R0和R2的配置中均沒有看到感興趣流的配置,這與我們配置的傳統的ipsec配置不一致。

現在來看配置,首先我們在完成一系列的ipsec配置後(第一階段參數,預共享密鑰,第二段加密測試等),按流程應該配置map並將map運用到介面上;本處就以profile來代替。「Profile」中只有兩個參數「pfs」和「transport」,但並沒有感興趣流和加密介面。我們再看gre隧道的配置跟以往的配置的區別「tunnel protection ipsec profile 1」,顧名思義就是在gre隧道上配置ipsec保護,保護的具體策略就是profile1.

就因為在gre介面上我們配置了ipsec保護,我們就可以確定建立ipsec的兩個站點:tunnel source和tunnel destination(就相當於在source和destination上配置了map);加密的感興趣流就是tunnel source和tunnel destination之間的gre通訊,而且僅僅是gre通訊。

通過一個簡單的profile,我們就完成了整個的gre overipsec,該方法目前是非常流行的一種配置,被廣泛使用!

在完成配置之後,我們在R0上進行ping 192.168.10.2的操作,查看是否能夠pint通,及兩者之間的通訊是否已經被加密。

Router#ping 192.168.10.2

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.10.2, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 16/36/96 ms

可以ping成功,我們再來看兩者之間的加密:

通訊已被加密,我們的gre over ipsec建立成功!