Jump to content

Настройка множественных подсетей для VPN-соединения IPsec типа "сеть–сеть"


Recommended Posts

Всех с наступающим!

Итак, в 4.0 появилась долгожданная, по крайней мере для меня фича, позволяющая дополнительно добавлять локальные и удаленные подсети. Туннель поднят в паре с Kerio Control. Его IPsec реализован на базе Strongswan. Первые попытки не увенчались успехом. То есть связность была исключительно между подсетями, которые были первыми в списке, доп. сети доступны не были, child SA not established, как говорится. А когда меняешь местами любые подсети, то доступ всё равно был у первых в списке. Покопавшись по форумам, у многих парней та же проблема. Сегодня удалось победить в своей тестовой среде. Описываю, что сделал.

1. Отключил шифры по умолчанию в Control и выставил такие: Фаза1 -  aes192-sha1-modp2048, Фаза2 - aes128-sha1. Затем в Кинетике соответственно.

001.jpg.1a30acdf438ccbc9aa5ef23449d93b67.jpg

2. Выставил в настройках обоих активный режим, то есть и Keenetic и Control стали инициаторами. Это произошло случайно, но туннель нормально поднялся.

002.jpg.81b421f1a7cd0c005c865402c11212b4.jpg

active.png.513c59a4e069d4ffec5ff5ec7d6c9bec.png

 

3. Подключился к Кинетику в консоль и вуаля:

(config)> show crypto map

       crypto_map, name = Control:
               config:
                       remote_peer: 10.0.0.3
                           enabled: yes
         crypto_ipsec_profile_name: Control
                              mode: tunnel

               status:
             primary_peer: true

                   phase1:
                         name: Control
                    unique_id: 309
                    ike_state: ESTABLISHED
               establish_time: 1703655957
                   rekey_time: 1703666725
                  reauth_time: 0
                   local_addr: 10.0.0.5
                  remote_addr: 10.0.0.3
                  ike_version: 1
                    local_spi: 1451d08a1e0249f9
                   remote_spi: f685e81611168d23
                   local_init: yes
                   ike_cypher: aes-cbc-192
                     ike_hmac: sha1
                 ike_dh_group: 14

           phase2_sa_list:
                    phase2_sa, index = 0:
                        unique_id: 1
                       request_id: 1
                         sa_state: INSTALLED
                             mode: TUNNEL
                         protocol: ESP
                    encapsulation: no
                        local_spi: ccb5ab7e
                       remote_spi: cccaff94
                     ipsec_cypher: esp-aes-128
                       ipsec_hmac: esp-sha1-hmac
                   ipsec_dh_group:
                         in_bytes: 166702
                       in_packets: 783
                          in_time: 1703658191
                        out_bytes: 169888
                      out_packets: 705
                         out_time: 1703658191
                       rekey_time: 1703659506
                         local_ts: 192.168.1.0/24
                        remote_ts: 10.100.88.0/24

                    phase2_sa, index = 1:
                        unique_id: 2
                       request_id: 2
                         sa_state: INSTALLED
                             mode: TUNNEL
                         protocol: ESP
                    encapsulation: no
                        local_spi: c25aec11
                       remote_spi: c8b74fe0
                     ipsec_cypher: esp-aes-128
                       ipsec_hmac: esp-sha1-hmac
                   ipsec_dh_group:
                         in_bytes: 1200
                       in_packets: 20
                          in_time: 1703658080
                        out_bytes: 1200
                      out_packets: 20
                         out_time: 1703658080
                       rekey_time: 1703659505
                         local_ts: 192.168.1.0/24
                        remote_ts: 10.15.20.0/24

                    phase2_sa, index = 2:
                        unique_id: 3
                       request_id: 3
                         sa_state: INSTALLED
                             mode: TUNNEL
                         protocol: ESP
                    encapsulation: no
                        local_spi: c75d44a2
                       remote_spi: c7cb5e43
                     ipsec_cypher: esp-aes-128
                       ipsec_hmac: esp-sha1-hmac
                   ipsec_dh_group:
                         in_bytes: 1200
                       in_packets: 20
                          in_time: 1703658087
                        out_bytes: 1200
                      out_packets: 20
                         out_time: 1703658087
                       rekey_time: 1703659525
                         local_ts: 192.168.1.0/24
                        remote_ts: 172.30.30.0/24

                    phase2_sa, index = 3:
                        unique_id: 4
                       request_id: 4
                         sa_state: INSTALLED
                             mode: TUNNEL
                         protocol: ESP
                    encapsulation: no
                        local_spi: cef01974
                       remote_spi: c79a10eb
                     ipsec_cypher: esp-aes-128
                       ipsec_hmac: esp-sha1-hmac
                   ipsec_dh_group:
                         in_bytes: 58740
                       in_packets: 979
                          in_time: 1703658100
                        out_bytes: 58740
                      out_packets: 979
                         out_time: 1703658101
                       rekey_time: 1703659503
                         local_ts: 192.168.1.0/24
                        remote_ts: 10.100.99.0/24

                    state: PHASE2_ESTABLISHED

Все хосты всех подсетей пингуются в обе стороны, всё rulezzz!

Subnets.thumb.png.350c5c5095e8ea01cd7e98d551b50620.pngTunnel.thumb.png.35d45f81f83aef556eda989efa6d7c1f.png

 

 

 

 

Edited by Deadlock
Link to comment
Share on other sites

01.thumb.jpg.a6b94d1729e836ea7b8a68eae9f66cd0.jpg

(config)> show crypto map

       crypto_map, name = NAME:
               config:
                       remote_peer: X.X.X.X
                           enabled: yes
         crypto_ipsec_profile_name: NAME
                              mode: tunnel

               status:
             primary_peer: true

                   phase1:
                         name: NAME
                    unique_id: 7
                    ike_state: ESTABLISHED
               establish_time: 1703703886
                   rekey_time: 1703707459
                  reauth_time: 0
                   local_addr: X.X.X.X
                  remote_addr: X.X.X.X
                  ike_version: 1
                    local_spi: 43ca6407325cd286
                   remote_spi: eafd36a4278464ad
                   local_init: no
                   ike_cypher: aes-cbc-128
                     ike_hmac: sha1
                 ike_dh_group: 14

           phase2_sa_list:
                    phase2_sa, index = 0:
                        unique_id: 4
                       request_id: 1
                         sa_state: INSTALLED
                             mode: TUNNEL
                         protocol: ESP
                    encapsulation: no
                        local_spi: c210adf4
                       remote_spi: c0e23e49
                     ipsec_cypher: esp-3des
                       ipsec_hmac: esp-sha1-hmac
                   ipsec_dh_group:
                         in_bytes: 981400
                       in_packets: 1813
                          in_time: 1703704750
                        out_bytes: 161331
                      out_packets: 1396
                         out_time: 1703704751
                       rekey_time: 1703707435
                         local_ts: 10.1.20.0/24
                        remote_ts: 10.4.0.0/24

                    phase2_sa, index = 1:
                        unique_id: 5
                       request_id: 2
                         sa_state: INSTALLED
                             mode: TUNNEL
                         protocol: ESP
                    encapsulation: no
                        local_spi: c54516a7
                       remote_spi: cbfc8e88
                     ipsec_cypher: esp-3des
                       ipsec_hmac: esp-sha1-hmac
                   ipsec_dh_group:
                         in_bytes: 0
                       in_packets: 0
                          in_time: 0
                        out_bytes: 0
                      out_packets: 0
                         out_time: 0
                       rekey_time: 1703707431
                         local_ts: 10.1.20.0/24
                        remote_ts: 10.2.1.0/24

                    phase2_sa, index = 2:
                        unique_id: 6
                       request_id: 3
                         sa_state: INSTALLED
                             mode: TUNNEL
                         protocol: ESP
                    encapsulation: no
                        local_spi: c9fcfd9e
                       remote_spi: cd9a16cc
                     ipsec_cypher: esp-3des
                       ipsec_hmac: esp-sha1-hmac
                   ipsec_dh_group:
                         in_bytes: 0
                       in_packets: 0
                          in_time: 0
                        out_bytes: 0
                      out_packets: 0
                         out_time: 0
                       rekey_time: 1703707437
                         local_ts: 10.1.20.0/24
                        remote_ts: 10.2.2.0/24

                    phase2_sa, index = 3:
                        unique_id: 7
                       request_id: 4
                         sa_state: INSTALLED
                             mode: TUNNEL
                         protocol: ESP
                    encapsulation: no
                        local_spi: cb612c76
                       remote_spi: c1b0b068
                     ipsec_cypher: esp-3des
                       ipsec_hmac: esp-sha1-hmac
                   ipsec_dh_group:
                         in_bytes: 0
                       in_packets: 0
                          in_time: 0
                        out_bytes: 0
                      out_packets: 0
                         out_time: 0
                       rekey_time: 1703707436
                         local_ts: 10.1.20.0/24
                        remote_ts: 10.2.4.0/24

                    phase2_sa, index = 4:
                        unique_id: 8
                       request_id: 5
                         sa_state: INSTALLED
                             mode: TUNNEL
                         protocol: ESP
                    encapsulation: no
                        local_spi: c9038fe3
                       remote_spi: cdca499d
                     ipsec_cypher: esp-3des
                       ipsec_hmac: esp-sha1-hmac
                   ipsec_dh_group:
                         in_bytes: 0
                       in_packets: 0
                          in_time: 0
                        out_bytes: 0
                      out_packets: 0
                         out_time: 0
                       rekey_time: 1703707431
                         local_ts: 10.1.20.0/24
                        remote_ts: 10.2.7.0/24

                    phase2_sa, index = 5:
                        unique_id: 9
                       request_id: 6
                         sa_state: INSTALLED
                             mode: TUNNEL
                         protocol: ESP
                    encapsulation: no
                        local_spi: c627d595
                       remote_spi: c2b460ad
                     ipsec_cypher: esp-3des
                       ipsec_hmac: esp-sha1-hmac
                   ipsec_dh_group:
                         in_bytes: 240
                       in_packets: 4
                          in_time: 1703704123
                        out_bytes: 240
                      out_packets: 4
                         out_time: 1703704123
                       rekey_time: 1703707445
                         local_ts: 10.1.20.0/24
                        remote_ts: 10.2.8.0/24

                    phase2_sa, index = 6:
                        unique_id: 10
                       request_id: 7
                         sa_state: INSTALLED
                             mode: TUNNEL
                         protocol: ESP
                    encapsulation: no
                        local_spi: c4f3665d
                       remote_spi: cac9e4a1
                     ipsec_cypher: esp-3des
                       ipsec_hmac: esp-sha1-hmac
                   ipsec_dh_group:
                         in_bytes: 1466876
                       in_packets: 1579
                          in_time: 1703704750
                        out_bytes: 207930
                      out_packets: 768
                         out_time: 1703704750
                       rekey_time: 1703707436
                         local_ts: 10.1.20.0/24
                        remote_ts: 10.1.40.0/24

                    state: PHASE2_ESTABLISHED

 

Link to comment
Share on other sites

10 часов назад, MajoR сказал:

Всё равно больше 7-ми сетей не работает.

Возможно. Но если добавить вторую подсеть в локальные, то индексов в phase2_sa_list станет в два раза больше)

Link to comment
Share on other sites

Уточняющие нюансы. Если кинетик включить на ожидание удаленного пира, то Керио ругается на отсутствие необходимых пакетов шифрования. Хотя все естесственно согласовано мной в настройках. Согласование SA и хождение трафика по первым сетям происходило, если Кинетик инициатор, а Керио на приеме.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...