Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    OpenVPN как задать static ip клиенту?

    Scheduled Pinned Locked Moved Russian
    14 Posts 4 Posters 12.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • werterW
      werter
      last edited by

      2 derwin
      О, хабр! Инвайтиком поделитесь ? В ЛС  ::)

      1 Reply Last reply Reply Quote 0
      • D
        derwin
        last edited by

        @werter:

        2 derwin
        О, хабр! Инвайтиком поделитесь ? В ЛС  ::)

        у меня нет столько кармы чтобы дать инвайт.
        Могу от вашего имени оформить статью, в конце укажу авторство. После этого есть ненулевая вероятность что прилетит инвайт от НЛО или сообщества. Ну или как и все - сами через песочницу.

        1 Reply Last reply Reply Quote 0
        • U
          utilit23
          last edited by

          @derwin:

          моя статья https://habrahabr.ru/post/312528/

          Спасибо. Помогло

          @pigbrother:

          Тогда и я поделюсь постом.
          Использовать ifconfig-push мне показалось по ряду причин не самым удобным.
          Решение без ifconfig-push:
          https://forum.pfsense.org/index.php?topic=113424.msg630678#msg630678

          Не нашел у себя в настройках пункта  Strict User - CN Matching сборка PF 2.3

          1 Reply Last reply Reply Quote 0
          • P
            pigbrother
            last edited by

            Не нашел у себя в настройках пункта  Strict User - CN Matching сборка PF 2.3

            Его нет, если выбран Server mode - Peer to Peer (SSL/TLS).
            и есть, если выбран  Server mode - Remote Access.

            Если будете использовать ifconfig-push - его придется указывать для всех клиентов.

            1 Reply Last reply Reply Quote 0
            • U
              utilit23
              last edited by

              @pigbrother:

              Не нашел у себя в настройках пункта  Strict User - CN Matching сборка PF 2.3

              Его нет, если выбран Server mode - Peer to Peer (SSL/TLS).
              и есть, если выбран  Server mode - Remote Access.

              Если будете использовать ifconfig-push - его придется указывать для всех клиентов.

              Ага понял. У меня был выбран Remote Access (SSL/TLS) , а надо еще + User Auth тогда появляется.
              Но суть с ifconfig таже, просто вы вынесли в отдельный файл куда прописаны common name и ip. Немного упростили скажем так

              1 Reply Last reply Reply Quote 0
              • P
                pigbrother
                last edited by

                Основной смысл в резервировании IP.
                В ifconfig-push возможно получение адреса клиентом, для которого не задан IP ifconfig-push если тот, для кого задан ifconfig-push оффлайн. Поэтому приходится задавать его всем, для кого предполагается доступ.

                Ну и  User Auth - все же дополнительный элемент защиты на случай утери пользователем ключа и сертификата. Плюс задел для авторизации в АД\Радиус.

                И да,  вы уверены, что без  Strict User - CN Matching  ifconfig-pool-persist не работает?

                1 Reply Last reply Reply Quote 0
                • U
                  utilit23
                  last edited by

                  @pigbrother:

                  Основной смысл в резервировании IP.
                  В ifconfig-push возможно получение адреса клиентом, для которого не задан IP ifconfig-push если тот, для кого задан ifconfig-push оффлайн. Поэтому приходится задавать его всем, для кого предполагается доступ.

                  Ну и  User Auth - все же дополнительный элемент защиты на случай утери пользователем ключа и сертификата. Плюс задел для авторизации в АД\Радиус.

                  И да,  вы уверены, что без  Strict User - CN Matching  ifconfig-pool-persist не работает?

                  Да разобрался. В общем не обязательно выбирать в Server Mode  Remote Access (SSL/TLS)+User Auth и ставить галочку Strict User - CN Matching. В пути к файлу в конце стер ноль получилось ifconfig-pool-persist /var/games/ips.list;
                  Спасибо

                  1 Reply Last reply Reply Quote 0
                  • P
                    pigbrother
                    last edited by

                    Странно, что ноль мешал.
                    ; (точку с запятой) в
                    ifconfig-pool-persist /var/games/ips.list 0**;**
                    не забыли?

                    Мануал Open VPN говорит  следующее:

                    –ifconfig-pool-persist file [seconds]
                    Persist/unpersist ifconfig-pool data to file, at seconds intervals (default=600), as well as on program startup and shutdown.

                    The goal of this option is to provide a long-term association between clients (denoted by their common name) and the virtual IP address assigned  to  them from the ifconfig-pool.  Maintaining a long-term association is good for clients because it allows them to effectively use the –persist-tun option.

                    file is a comma-delimited ASCII file, formatted as <common-name>,<ip-address>.

                    If seconds = 0, file will be treated as read-only.  This is useful if you would like to treat file as a configuration file.

                    И, хотя, далее указывается:

                    Note that the entries in this file are treated by OpenVPN as suggestions only, based on past associations between a common name and IP  address.  They do not guarantee that the given common name will always receive the given IP address.  If you want guaranteed assignment, use
                                  –ifconfig-push

                    У меня все работет без проблем.</ip-address></common-name>

                    1 Reply Last reply Reply Quote 0
                    • U
                      utilit23
                      last edited by

                      @pigbrother:

                      Странно, что ноль мешал.
                      ; (точку с запятой) в
                      ifconfig-pool-persist /var/games/ips.list 0**;**
                      не забыли?

                      Мануал Open VPN говорит  следующее:

                      –ifconfig-pool-persist file [seconds]
                      Persist/unpersist ifconfig-pool data to file, at seconds intervals (default=600), as well as on program startup and shutdown.

                      The goal of this option is to provide a long-term association between clients (denoted by their common name) and the virtual IP address assigned  to  them from the ifconfig-pool.  Maintaining a long-term association is good for clients because it allows them to effectively use the –persist-tun option.

                      file is a comma-delimited ASCII file, formatted as <common-name>,<ip-address>.

                      If seconds = 0, file will be treated as read-only.  This is useful if you would like to treat file as a configuration file.

                      И, хотя, далее указывается:

                      Note that the entries in this file are treated by OpenVPN as suggestions only, based on past associations between a common name and IP  address.  They do not guarantee that the given common name will always receive the given IP address.  If you want guaranteed assignment, use
                                    –ifconfig-push

                      У меня все работет без проблем.</ip-address></common-name>

                      Не могу точно сказать причину почему не работало. Но убрал 0 заработало. Сейчас решил вернуть 0 и тоже работает.  ???

                      Тут еще назрели мысли. Имеется две клиентских машины и обе находятся в 1 подсети имея локальные IP 192.168.1.хх, но находятся в разных офисах. Одна машины не подключалась, оказалось, что она конфликтовала с ip адресом машины, которая находилась в локальной сети с серверов openVPN который так же имеет 1 подсеть.
                      На vpn клиентских машинах стоят базы и к ним подключается много ПОС-терминалов. Если менять ip, то везде придется, чего не хочется. Переводить в другую подсеть тоже не лучшая идея. Как бы так провернуть, чтобы и ip не менять и соединение было VPN клиентов с сервером. Может virtual ip поднять или vlan?

                      1 Reply Last reply Reply Quote 0
                      • werterW
                        werter
                        last edited by

                        Доброе.

                        Переводить в другую подсеть тоже не лучшая идея. Как бы так провернуть, чтобы и ip не менять и соединение было VPN клиентов с сервером. Может virtual ip поднять или vlan?

                        Попробуйте proxy arp:
                        http://xgu.ru/wiki/Proxy_ARP
                        http://olivier.cochard.me/reseaux/pfsense/case–solving-problem-with-nat

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.