{"id":13340668,"url":"https://github.com/urpylka/vpn_utils","last_synced_at":"2025-03-11T18:31:34.846Z","repository":{"id":84352824,"uuid":"136654088","full_name":"urpylka/vpn_utils","owner":"urpylka","description":"It was merged into urpylka/docker-ipsec-vpn-server","archived":true,"fork":false,"pushed_at":"2018-09-05T12:24:44.000Z","size":9,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-24T06:28:46.616Z","etag":null,"topics":["client","configuration","connection","manager","server","vpn","xl2tpd"],"latest_commit_sha":null,"homepage":"https://github.com/urpylka/docker-ipsec-vpn-server","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/urpylka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-08T18:38:02.000Z","updated_at":"2023-01-28T15:38:15.000Z","dependencies_parsed_at":"2023-03-04T10:00:18.300Z","dependency_job_id":null,"html_url":"https://github.com/urpylka/vpn_utils","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urpylka%2Fvpn_utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urpylka%2Fvpn_utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urpylka%2Fvpn_utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urpylka%2Fvpn_utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/urpylka","download_url":"https://codeload.github.com/urpylka/vpn_utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243090399,"owners_count":20234798,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","configuration","connection","manager","server","vpn","xl2tpd"],"created_at":"2024-07-29T19:23:54.633Z","updated_at":"2025-03-11T18:31:34.840Z","avatar_url":"https://github.com/urpylka.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Доступ к дрону через интернет\n\nТак как в большинстве случаев сотовый модем, находящийся на дроне, не имеет белого IP адреса, а также существует необходимость объединять несколько агентов (дроны, зарядные станции, управляющий персонал) в единую сеть, доступ к дрону организован через VPN сервер.\n\n## Настройка\n\nНастройка состоит из двух частей: настройка сервера (серверная часть) и настройка дрона (клиентская часть).\n\n### Настройка серверной части\n\nВ качестве сервера было решено использовать libreswan (IPSec) + xl2tpd, т.к. в отличие от openvpn это решение поддерживается из коробки большинством операционных систем.\n\nДля настройки существует готовый проект (скрипт + руковдство для подключения) для настройки VPN сервера https://github.com/hwdsl2/setup-ipsec-vpn\n\nОднако в этом решении используется единый логин для подключения, а IP адреса выдаются из указанного диапазона. Данная концепция мб не совсем удобна, так как:\n1. IP адреса не привязаны к логинам, а значит одни и те же агенты могут произвольно менять свои адреса при смене сессии.\n2. Нет возможности разграничить доступ для групп пользователей. Чтобы одна группа не имела доступа к другой.\n\nДля решения этих проблем необходимо изменить ряд настроек:\n1. Заменить uniqueids=no в /etc/ipsec.conf на uniqueids=yes\n2. Удалить все записи /etc/ipsec.secrets со звездочкой вместо конкретного IP\n3. Удалить ip range = $L2TP_POOL в /etc/xl2tpd/xl2tpd.conf, local ip = $L2TP_LOCAL заменить на local ip = 192.168.254.254, добавить exclusive = yes и assign ip = no\n4. Удалить lcp-echo-failure 4 и lcp-echo-interval 30 из /etc/ppp/options.xl2tpd, заменить proxyarp на noproxyarp, добавить persist\n\nДалее для удобства управления пользователями написал вот этот скрипт https://github.com/urpylka/vpn_utils/blob/master/vpn-server-cli.sh\n\n### Настройка клиентской части\n\n```bash\nwget https://raw.githubusercontent.com/urpylka/vpn_utils/master/vpn-client-installer.sh\nchmod +x ./vpn-client-installer.sh\nwget https://raw.githubusercontent.com/urpylka/vpn_utils/master/vpn-manager.sh\nchmod +x ./vpn-manager.sh\nsudo ./vpn-client-installer.sh VPN_SERVER_IP VPN_IPSEC_PSK VPN_USER VPN_PASSWORD\n```\n\n### Настройка интернета через 4G модем\n\n```bash\nsudo apt install network-manager\nsudo nmcli connection add connection.type gsm connection.interface-name cdc-wdm0 \\\n  connection.id \"gsm\" gsm.username mts gsm.password mts gsm.apn \"internet.mts.ru\" ipv4.method auto ipv6.method ignore \\\n  connection.autoconnect yes\n```\n\n\u003e После включения network-manager Wi-Fi точка доступа настроенная в образе перестанет работать, единственное как можно подключиться к Raspberry - это через Ethernet к сети в которой работает DHCP сервер.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furpylka%2Fvpn_utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furpylka%2Fvpn_utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furpylka%2Fvpn_utils/lists"}