Wireguard on Mikrotik RouterOS 7

# add wg interface
/interface/wireguard/add listen-port=51820 mtu=1300

# add ip on wg interface
/ip/address/add address=10.100.10.1 interface=wg1

# adding peer
/interface/wireguard/peers/add name=10.100.10.2 private-key=auto endpoint-address=<ENDPOINT ADDRESS> endpoint-port=51820 allowed-address=10.100.10.2/32 preshared-key=auto persistent-keepalive=00:00:30

# allow wg port and traffic
/ip firewall filter
add action=accept chain=input dst-port=51820 protocol=udp
add action=accept chain=forward in-interface=wg1
add action=accept chain=input in-interface=wg1

# add nat from wg
/ip firewall nat
add action=masquerade chain=srcnat comment=wg out-interface=ether1 src-address=10.100.10.0/24

# add route
/ip route
add distance=10 dst-address=10.100.10.1/24 gateway=wg1
# make config like this
[Interface]
PrivateKey = your_autogenerated_private_key_from_peers
Address = 10.100.10.2/24
DNS = 10.100.10.1
MTU = 1300

[Peer]
PublicKey = your_MikroTik_public_KEY
AllowedIPs = 0.0.0.0/0
Endpoint = example.com:42000

Добавить комментарий

Этот сайт использует Akismet для борьбы со спамом. Узнайте, как обрабатываются ваши данные комментариев.