在Cisco路由器上配置VRF-aware Site-to-Site IPsec VPN

日期: 2012-05-20 来源:TechTarget中国

  整个环境能够顺利进行,首先需要带有ASA的虚拟路由与Cisco 路由器建立VPN。这需要 VRF参与的IPsec。因此我需要一种方法能够实现完全一致的 isakmp 策略,一致的pre-shared keys, 一致的 crypto ACL, 也就是每个 VRF上的参数一致。实际的配置过程可能比我们想像的简单一些。下面我就来举例说明整个过程。

  首先是建立ISAKMP 策略:

  !

  crypto isakmp policy 10

   encr aes 256

   authentication pre-share

   group 2

  !

  在配置过程中,我们可以在八个VRF中使用相同的元素,因此只需要建立一个ISAKMP 策略。接下来建立crypto ACL 以及一个 IPsec transform set。

  ip access-list extended VPN

  permit ip 10.0.100.0 0.0.0.255 10.0.1.0 0.0.0.255

  crypto ipsec transform-set VPN-TRANS esp-aes esp-sha-hmac.

  接下来是建立 pre-shared key。在本例中我曾经使用过一个keyring 作为 预共享 key,因此我直接将其绑定到 VRF即可。

  crypto keyring POD1keys vrf POD1

  pre-shared-key address 192.168.1.2 key cisco123

  crypto keyring POD2keys vrf POD2

  pre-shared-key address 192.168.1.2 key cisco123

  crypto keyring POD3keys vrf POD3

  pre-shared-key address 192.168.1.2 key cisco123

  crypto keyring POD4keys vrf POD4

  pre-shared-key address 192.168.1.2 key cisco123

  crypto keyring POD5keys vrf POD5

  pre-shared-key address 192.168.1.2 key cisco123

  crypto keyring POD6keys vrf POD6

  pre-shared-key address 192.168.1.2 key cisco123

  crypto keyring POD7keys vrf POD7

  pre-shared-key address 192.168.1.2 key cisco123

  crypto keyring POD8keys vrf POD7

  pre-shared-key address 192.168.1.2 key cisco123

  !

  接下来建立 crypto-maps.

  !

  crypto map pod1 10 ipsec-isakmp

   set peer 192.168.1.2

   set transform-set VPN-TRANS

   set pfs group2

   match address VPN

  !

  crypto map pod2 10 ipsec-isakmp

   set peer 192.168.1.2

   set transform-set VPN-TRANS

   set pfs group2

   match address VPN

  !

  crypto map pod3 10 ipsec-isakmp

   set peer 192.168.1.2

   set transform-set VPN-TRANS

   set pfs group2

   match address VPN

  !

  crypto map pod4 10 ipsec-isakmp

   set peer 192.168.1.2

   set transform-set VPN-TRANS

   set pfs group2

   match address VPN

  !

  crypto map pod5 10 ipsec-isakmp

   set peer 192.168.1.2

   set transform-set VPN-TRANS

   set pfs group2

   match address VPN

  !

  crypto map pod6 10 ipsec-isakmp

   set peer 192.168.1.2

   set transform-set VPN-TRANS

   set pfs group2

   match address VPN

  !

  crypto map pod7 10 ipsec-isakmp

   set peer 192.168.1.2
  
   set transform-set VPN-TRANS

   set pfs group2

   set isakmp-profile pod7

   match address VPN

  !

  crypto map pod8 10 ipsec-isakmp

   set peer 192.168.1.2

   set transform-set VPN-TRANS

   set pfs group2

   match address VPN

  !

  一旦 crypto-maps 被合并到一起,就可以应用到接口上了。

  interface FastEthernet0/0.1

  crypto map pod1

  !

  interface FastEthernet0/0.2

  crypto map pod2

  !

  interface FastEthernet0/0.3

  crypto map pod3

  !

  interface FastEthernet0/0.4

  crypto map pod4

  !

  interface FastEthernet0/0.5

  crypto map pod5

  !

  interface FastEthernet0/0.6

  crypto map pod6

  !

  interface FastEthernet0/0.7

  crypto map pod7

  !

  interface FastEthernet0/0.8

  crypto map pod8

  !

  将其应用后,我们可以进行一个测试。如图A所示,我们ping加密的终端

  回到路由器端,我们可以看到我们测试的POD7 vrf的 ISAKMP SA 已经激活。

  BBR#sh crypto isa sa vrf POD7

  IPv4 Crypto ISAKMP SA

  dst             src             state          conn-id status

  192.168.1.1     192.168.1.2     QM_IDLE           1020 ACTIVE

  查看 IPsec SA,会发现受保护的VRF 是POD7。其它状态如下,在本文中我就不详细介绍了。

  BBR#sh crypto ipsec sa vrf POD7

  interface: FastEthernet0/0.7

      Crypto map tag: pod7, local addr 192.168.1.1

     protected vrf: POD7

     local  ident (addr/mask/prot/port): (10.0.100.0/255.255.255.0/0/0)

     remote ident (addr/mask/prot/port): (10.0.1.0/255.255.255.0/0/0)

     current_peer 192.168.1.2 port 500

       PERMIT, flags=

      #pkts encaps: 7, #pkts encrypt: 7, #pkts digest: 7

      #pkts decaps: 7, #pkts decrypt: 7, #pkts verify: 7

      #pkts compressed: 0, #pkts decompressed: 0

      #pkts not compressed: 0, #pkts compr. failed: 0

      #pkts not decompressed: 0, #pkts decompress failed: 0

      #send errors 0, #recv errors 0

       local crypto endpt.: 192.168.1.1, remote crypto endpt.: 192.168.1.2

       path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet0/0.7

       current outbound spi: 0xE2C2B7A6(3804411814)

       PFS (Y/N): Y, DH group: group2

       inbound esp sas:

        spi: 0x347E881(55044225)

          transform: esp-aes esp-sha-hmac ,

          in use settings =

          conn id: 2023, flow_id: NETGX:23, sibling_flags 80000046, crypto map: pod7

          sa timing: remaining key lifetime (k/sec): (4514155/3388)

          IV size: 16 bytes

          replay detection support: Y
  
        Status: ACTIVE

       inbound ah sas:

       inbound pcp sas:

       outbound esp sas:

        spi: 0xE2C2B7A6(3804411814)

          transform: esp-aes esp-sha-hmac ,

          in use settings =

          conn id: 2024, flow_id: NETGX:24, sibling_flags 80000046, crypto map: pod7

          sa timing: remaining key lifetime (k/sec): (4514155/3388)

          IV size: 16 bytes

          replay detection support: Y

          Status: ACTIVE

       outbound ah sas:

       outbound pcp sas:

  BBR#

  以上就是通过VRF的站点到站点的IPsec VPN。

我们一直都在努力坚持原创.......请不要一声不吭,就悄悄拿走。

我原创,你原创,我们的内容世界才会更加精彩!

【所有原创内容版权均属TechTarget,欢迎大家转发分享。但未经授权,严禁任何媒体(平面媒体、网络媒体、自媒体等)以及微信公众号复制、转载、摘编或以其他方式进行使用。】

微信公众号

TechTarget微信公众号二维码

TechTarget

官方微博

TechTarget中国官方微博二维码

TechTarget中国

电子邮件地址不会被公开。 必填项已用*标注

敬请读者发表评论,本站保留删除与本文无关和不雅评论的权力。

相关推荐