Forked from shaposhnikoff/gist:70bd00800546ed43cb2df1d7ceb20805
Created
September 19, 2023 06:19
-
-
Save Topper-crypto/2fcfaaae075e93f457d8692b22c03ab5 to your computer and use it in GitHub Desktop.
Mikrotik IPSEC L2TP for Android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Title: Настройка сервера VPN L2TP/IPSec на Mikrotik RoutersOS | |
| Date: 2013-05-31 17:25 | |
| Category: Mikrotik | |
| Tags: mikrotik, vpn | |
| Slug: mikrotik-lt2p-vpn | |
| Summary: Краткое описание настройки сервера VPN L2TP/IPSec на Mikrotik RoutersOS c возможностью подключения с помощью встроенных VPN клиентов Windows 7, Mac OS X и IOS. | |
|  | |
| **Замечение:** Если несколько клиентов находятся за NAT, то только одно L2TP/IPSec соединение может быть установлено. | |
| ## Базовая настройка | |
| ``` | |
| /ip address | |
| add address=91.219.55.10/24 interface=ether1 | |
| add address=10.20.0.1/24 interface=ether2 | |
| /ip route | |
| add gateway=91.219.55.1 | |
| /ip firewall nat | |
| add chain=srcnat action=masquerade out-interface=ether1 | |
| /ip dns | |
| set allow-remote-requests=yes servers=91.219.55.1,8.8.8.8 | |
| /ip pool | |
| add name=lan_dhcp ranges=10.20.0.100-10.20.0.199 | |
| /ip dhcp-server | |
| add name=lan_dhcp address-pool=lan_dhcp interface=ether2 disabled=no | |
| /ip dhcp-server network | |
| add address=10.20.0.0/24 dns-server=10.20.0.1 gateway=10.20.0.1 | |
| ``` | |
| ## Настройка L2TP | |
| Создадим еще один пул IP адресов из той-же подсети, который будет использоваться для VPN клиентов: | |
| ``` | |
| /ip pool add name=lan_vpn ranges=10.20.0.200-10.20.0.254 | |
| ``` | |
| Создайте новый PPP профиль: | |
| ``` | |
| /ppp profile add name=l2tp-vpn-lan local-address=10.20.0.1 \ | |
| remote-address=lan-vpn dns-server=10.20.0.1 | |
| ``` | |
| Включите L2TP сервер. Для наших целей достаточно только метода аутентификации *mschap2*. | |
| ``` | |
| /interface l2tp-server server set enabled=yes authentication=mschap2 \ | |
| default-profile=l2tp-vpn-lan | |
| ``` | |
| Создайте пользователя: | |
| ``` | |
| /ppp secret add name=userlogin password=userpassword service=l2tp \ | |
| profile=l2tp-vpn-lan | |
| ``` | |
| ## Настройка IPSec | |
| Созадем ipsec peer: | |
| ``` | |
| /ip ipsec peer add address=0.0.0.0/0 port=500 auth-method=pre-shared-key \ | |
| secret="shared_password_key" exchange-mode=main-l2tp send-initial-contact=yes \ | |
| nat-traversal=yes proposal-check=obey hash-algorithm=sha1 \ | |
| enc-algorithm=3des dh-group=modp1024 generate-policy=yes \ | |
| lifetime="1d 00:00:00" dpd-interval=120 dpd-maximum-failures=5 | |
| ``` | |
| Некоторые разъяснения: | |
| * ``address=0.0.0.0/0`` - разрешаем подключение с любого IP адреса; | |
| * ``auth-method=pre-shared-key`` - аутентификация компьютера с помощью общего ключа; | |
| * ``secret="shared_password_key"`` - пароль общего ключа; | |
| Созадем ipsec proposal | |
| ``` | |
| /ip ipsec proposal set default auth-algorithms=sha1 \ | |
| enc-algorithms=3des,aes-256 lifetime=30m pfs-group= | |
| ``` | |
| ## Включение Proxy-ARP | |
| Поскольку компьютеры в локальной сети и удаленные клиенты используют IP адреса из одной и той же подсети, необходимо включить proxy-arp на интерфейсе подключенном к локальной сети. В нашем примере это ``ether2``: | |
| ``` | |
| /interface ethernet | |
| set ether2 arp=proxy-arp | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment