WireGuard config to MikroTik, OpenWrt and other routers

Paste the client's .conf, pick the router and take commands that work as they are: interface, peer, addresses, routes, NAT, MSS and DNS. All traffic or only the networks you name. For Linux and Docker it makes files, and for routers with a web interface it says which value goes into which field.

Runs in your browser, nothing is sent

What you have
Settings

Ready commands and files

File import and fields

What goes into the tunnel

MikroTik RouterOS 7

The result will show up here.

Everything is worked out in your browser: keys and addresses are not sent anywhere.

In Veli the same is set by sites and apps, without lists: what goes through the VPN and what goes direct. There is a package for OpenWrt routers. Free, no sign-up.

Download Veli

Reference

What each field of the file becomes

The names are from the documentation and source code of RouterOS, OpenWrt and systemd; the commands above use the same ones.

PrivateKey
RouterOS 7wireguard private-key
OpenWrtprivate_key
networkd[WireGuard] PrivateKey
Address
RouterOS 7/ip/address, /ipv6/address
OpenWrtaddresses
networkd[Network] Address
DNS
RouterOS 7/ip/dhcp-server/network dns-server
OpenWrtdns
networkd[Network] DNS
MTU
RouterOS 7wireguard mtu, change-mss
OpenWrtmtu, mtu_fix
networkd[NetDev] MTUBytes
ListenPort
RouterOS 7wireguard listen-port
OpenWrtlisten_port
networkd[WireGuard] ListenPort
PublicKey
RouterOS 7peers public-key
OpenWrtpublic_key
networkd[WireGuardPeer] PublicKey
PresharedKey
RouterOS 7peers preshared-key
OpenWrtpreshared_key
networkd[WireGuardPeer] PresharedKey
AllowedIPs
RouterOS 7peers allowed-address
OpenWrtallowed_ips, route_allowed_ips
networkd[WireGuardPeer] AllowedIPs, RouteTable
Endpoint
RouterOS 7peers endpoint-address, endpoint-port
OpenWrtendpoint_host, endpoint_port
networkd[WireGuardPeer] Endpoint
PersistentKeepalive
RouterOS 7peers persistent-keepalive
OpenWrtpersistent_keepalive
networkd[WireGuardPeer] PersistentKeepalive
Jc, Jmin, Jmax, S1, S2, H1–H4
RouterOS 7—
OpenWrtawg_jc … awg_h4 (proto amneziawg)
networkd—

Which router does what

MikroTik RouterOS 7
commands; its own wg-import reads the file, without routes and NAT
AmneziaWG: no
OpenWrt
uci commands over SSH; LuCI imports the file, without the firewall
AmneziaWG: with packages
NetworkManager
nmcli connection import, file name = interface name
AmneziaWG: no
systemd-networkd
a .netdev and a .network file
AmneziaWG: no
Docker Compose
linuxserver/wireguard, /config/wg_confs
AmneziaWG: no
Keenetic
file import in Other connections
AmneziaWG: by firmware version
UniFi
file import in VPN Client
AmneziaWG: no
GL.iNet
file import in WireGuard Client
AmneziaWG: by firmware version
ASUS (Merlin)
file import or fields, then VPN Director
AmneziaWG: no
pfSense
fields only, plus a gateway and NAT
AmneziaWG: no
OPNsense
fields only, plus a gateway and NAT
AmneziaWG: no

FAQ

How do I import a WireGuard config into MikroTik?

RouterOS 7 reads the file itself: /interface/wireguard/wg-import config-file=wg0.conf, and since 7.19 the text too, with config-string. Routes, NAT, MSS and DNS still have to be set by hand, and that's what people usually get stuck on. This tool gives all of it as commands, with an undo.

How do I set up a WireGuard client on OpenWrt from a .conf file?

Install wireguard-tools and luci-proto-wireguard, then run the commands over SSH: they add the interface, the peer, a firewall zone with NAT and MSS clamping, and forwarding from LAN. LuCI has “Import configuration” as well, but it doesn't set up the firewall.

The tunnel is up, but devices at home have no internet. Why?

Usually one of three: no NAT on the tunnel (the server only knows the tunnel's address, not your LAN), no route for LAN traffic, or no MSS clamping, when small pages open and big ones hang. The commands here include all three.

How do I send only some networks through the tunnel?

Choose “Only these networks” and list them in CIDR form. The router gets a route for each of them, and the rest of the traffic stays where it is. If the server's own address falls into a network on the list, it is taken out, so the tunnel doesn't route itself into itself.

Does it work with AmneziaWG?

On OpenWrt, yes: the commands use proto amneziawg and awg_jc to awg_h4; AmneziaWG 2.0 and 3.1 settings need a package build that knows them. Keenetic and GL.iNet read the file themselves. RouterOS, pfSense, OPNsense, UniFi, NetworkManager and systemd-networkd don't speak AmneziaWG, and the tool says so instead of making a config that won't connect.

Is it safe to paste a config with a private key?

The file is read in your browser and goes nowhere: no request carries it, and it isn't kept after you leave the page. Remember that the resulting commands contain the private key too.