MikroTik Solutions

Hex Artifact Content
Login

Hex Artifact Content

Artifact 324919f2d37b5ba7cd6f6257eedf2f884948c3887f8ac708bab4b4887bed0347:

Wiki page [WireGuard Configuration] by tangent 2024-08-27 10:33:35.
0000: 44 20 32 30 32 34 2d 30 38 2d 32 37 54 31 30 3a  D 2024-08-27T10:
0010: 33 33 3a 33 35 2e 33 38 38 0a 4c 20 57 69 72 65  33:35.388.L Wire
0020: 47 75 61 72 64 5c 73 43 6f 6e 66 69 67 75 72 61  Guard\sConfigura
0030: 74 69 6f 6e 0a 4e 20 74 65 78 74 2f 78 2d 6d 61  tion.N text/x-ma
0040: 72 6b 64 6f 77 6e 0a 50 20 66 62 35 61 64 64 63  rkdown.P fb5addc
0050: 66 32 36 39 34 30 66 33 63 33 65 33 34 30 37 61  f26940f3c3e3407a
0060: 31 30 30 37 61 65 36 37 33 62 32 63 61 66 66 62  1007ae673b2caffb
0070: 32 63 66 35 32 61 34 30 36 30 31 31 36 31 30 34  2cf52a4060116104
0080: 64 36 35 37 33 35 32 63 64 0a 55 20 74 61 6e 67  d657352cd.U tang
0090: 65 6e 74 0a 57 20 35 39 38 32 0a 23 23 20 4d 6f  ent.W 5982.## Mo
00a0: 74 69 76 61 74 69 6f 6e 0d 0a 0d 0a 59 6f 75 20  tivation....You 
00b0: 63 61 6e 20 66 69 6e 64 20 6d 61 6e 79 20 57 69  can find many Wi
00c0: 72 65 47 75 61 72 64 20 63 6f 6e 66 69 67 75 72  reGuard configur
00d0: 61 74 69 6f 6e 20 67 75 69 64 65 73 20 66 6f 72  ation guides for
00e0: 20 52 6f 75 74 65 72 4f 53 20 37 2c 20 69 6e 63   RouterOS 7, inc
00f0: 6c 75 64 69 6e 67 20 5b 6d 64 75 63 68 61 72 6d  luding [mducharm
0100: 65 27 73 20 66 69 6e 65 20 72 6f 61 64 2d 77 61  e's fine road-wa
0110: 72 72 69 6f 72 20 63 6f 6e 66 69 67 75 72 61 74  rrior configurat
0120: 69 6f 6e 5d 28 68 74 74 70 73 3a 2f 2f 66 6f 72  ion](https://for
0130: 75 6d 2e 6d 69 6b 72 6f 74 69 6b 2e 63 6f 6d 2f  um.mikrotik.com/
0140: 76 69 65 77 74 6f 70 69 63 2e 70 68 70 3f 70 3d  viewtopic.php?p=
0150: 38 39 39 34 30 36 23 70 38 35 33 30 32 38 29 2c  899406#p853028),
0160: 20 62 75 74 20 49 20 6e 65 65 64 65 64 20 73 6f   but I needed so
0170: 6d 65 74 68 69 6e 67 20 61 20 62 69 74 20 64 69  mething a bit di
0180: 66 66 65 72 65 6e 74 2e 20 4d 79 20 75 73 65 20  fferent. My use 
0190: 63 61 73 65 20 69 73 20 74 68 61 74 20 74 68 65  case is that the
01a0: 20 57 69 72 65 47 75 61 72 64 20 73 65 72 76 65   WireGuard serve
01b0: 72 20 69 73 20 61 20 5b 43 52 53 33 32 38 5d 28  r is a [CRS328](
01c0: 68 74 74 70 73 3a 2f 2f 6d 69 6b 72 6f 74 69 6b  https://mikrotik
01d0: 2e 63 6f 6d 2f 70 72 6f 64 75 63 74 2f 63 72 73  .com/product/crs
01e0: 33 32 38 5f 32 34 70 5f 34 73 5f 72 6d 29 20 62  328_24p_4s_rm) b
01f0: 65 68 69 6e 64 20 61 20 74 68 69 72 64 2d 70 61  ehind a third-pa
0200: 72 74 79 20 49 6e 74 65 72 6e 65 74 20 72 6f 75  rty Internet rou
0210: 74 65 72 20 72 61 74 68 65 72 20 74 68 61 6e 20  ter rather than 
0220: 61 20 64 69 72 65 63 74 6c 79 20 49 6e 74 65 72  a directly Inter
0230: 6e 65 74 2d 66 61 63 69 6e 67 20 4d 69 6b 72 6f  net-facing Mikro
0240: 54 69 6b 20 72 6f 75 74 65 72 2e 0d 0a 0d 0a 0d  Tik router......
0250: 0a 23 23 20 52 6f 75 74 65 72 4f 53 20 43 6f 6e  .## RouterOS Con
0260: 66 69 67 75 72 61 74 69 6f 6e 0d 0a 0d 0a 49 20  figuration....I 
0270: 61 64 64 65 64 20 64 6f 75 62 6c 65 2d 4e 41 54  added double-NAT
0280: 20 74 6f 20 6d 64 75 63 68 61 72 6d 65 27 73 20   to mducharme's 
0290: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2c 20 74  configuration, t
02a0: 68 65 6e 20 73 69 6d 70 6c 69 66 69 65 64 20 69  hen simplified i
02b0: 74 20 61 20 62 69 74 3a 0d 0a 0d 0a 0d 0a 60 60  t a bit:......``
02c0: 60 20 73 68 65 6c 6c 0d 0a 2f 69 6e 74 65 72 66  ` shell../interf
02d0: 61 63 65 20 77 69 72 65 67 75 61 72 64 0d 0a 61  ace wireguard..a
02e0: 64 64 20 6c 69 73 74 65 6e 2d 70 6f 72 74 3d 31  dd listen-port=1
02f0: 32 33 34 35 20 6d 74 75 3d 31 34 32 30 20 6e 61  2345 mtu=1420 na
0300: 6d 65 3d 77 67 31 0d 0a 2f 69 6e 74 65 72 66 61  me=wg1../interfa
0310: 63 65 20 77 69 72 65 67 75 61 72 64 20 70 65 65  ce wireguard pee
0320: 72 73 0d 0a 61 64 64 20 61 6c 6c 6f 77 65 64 2d  rs..add allowed-
0330: 61 64 64 72 65 73 73 3d 31 39 32 2e 31 36 38 2e  address=192.168.
0340: 37 37 2e 32 2f 33 32 20 69 6e 74 65 72 66 61 63  77.2/32 interfac
0350: 65 3d 77 67 31 20 70 75 62 6c 69 63 2d 6b 65 79  e=wg1 public-key
0360: 3d 22 69 50 68 6f 6e 65 2d 70 75 62 6b 65 79 22  ="iPhone-pubkey"
0370: 0d 0a 61 64 64 20 61 6c 6c 6f 77 65 64 2d 61 64  ..add allowed-ad
0380: 64 72 65 73 73 3d 31 39 32 2e 31 36 38 2e 37 37  dress=192.168.77
0390: 2e 33 2f 33 32 20 69 6e 74 65 72 66 61 63 65 3d  .3/32 interface=
03a0: 77 67 31 20 70 75 62 6c 69 63 2d 6b 65 79 3d 22  wg1 public-key="
03b0: 69 50 61 64 2d 70 75 62 6b 65 79 22 0d 0a 2f 69  iPad-pubkey"../i
03c0: 70 20 61 64 64 72 65 73 73 0d 0a 61 64 64 20 61  p address..add a
03d0: 64 64 72 65 73 73 3d 31 39 32 2e 31 36 38 2e 37  ddress=192.168.7
03e0: 37 2e 31 2f 32 34 20 69 6e 74 65 72 66 61 63 65  7.1/24 interface
03f0: 3d 77 67 31 0d 0a 2f 69 70 20 66 69 72 65 77 61  =wg1../ip firewa
0400: 6c 6c 20 6e 61 74 0d 0a 61 64 64 20 61 63 74 69  ll nat..add acti
0410: 6f 6e 3d 73 72 63 2d 6e 61 74 20 63 68 61 69 6e  on=src-nat chain
0420: 3d 73 72 63 6e 61 74 20 73 72 63 2d 61 64 64 72  =srcnat src-addr
0430: 65 73 73 3d 31 39 32 2e 31 36 38 2e 37 37 2e 30  ess=192.168.77.0
0440: 2f 32 34 20 74 6f 2d 61 64 64 72 65 73 73 65 73  /24 to-addresses
0450: 3d 31 39 32 2e 31 36 38 2e 38 38 2e 31 0d 0a 60  =192.168.88.1..`
0460: 60 60 0d 0a 0d 0a 54 68 69 73 20 65 78 61 6d 70  ``....This examp
0470: 6c 65 20 75 73 65 73 20 74 68 65 20 4d 69 6b 72  le uses the Mikr
0480: 6f 54 69 6b 20 64 65 66 61 75 6c 74 20 6f 66 20  oTik default of 
0490: 31 39 32 2e 31 36 38 2e 38 38 2e 30 2f 32 34 20  192.168.88.0/24 
04a0: 66 6f 72 20 74 68 65 20 4c 41 4e 20 e2 80 94 20  for the LAN — 
04b0: 77 69 74 68 20 74 68 65 20 72 6f 75 74 65 72 20  with the router 
04c0: 61 73 20 2e 31 20 e2 80 94 20 61 6e 64 20 74 68  as .1 — and th
04d0: 65 20 6e 65 61 72 62 79 20 31 39 32 2e 31 36 38  e nearby 192.168
04e0: 2e 37 37 2e 30 2f 32 34 20 73 75 62 6e 65 74 20  .77.0/24 subnet 
04f0: 66 6f 72 20 57 69 72 65 47 75 61 72 64 2e 0d 0a  for WireGuard...
0500: 0d 0a 41 6c 74 68 6f 75 67 68 20 70 6f 72 74 20  ..Although port 
0510: 31 33 32 33 31 20 73 65 65 6d 73 20 70 6f 70 75  13231 seems popu
0520: 6c 61 72 20 66 6f 72 20 57 69 72 65 47 75 61 72  lar for WireGuar
0530: 64 2c 20 74 68 65 72 65 27 73 20 6e 6f 74 68 69  d, there's nothi
0540: 6e 67 20 61 62 6f 75 74 20 74 68 65 20 70 72 6f  ng about the pro
0550: 74 6f 63 6f 6c 20 74 68 61 74 20 72 65 71 75 69  tocol that requi
0560: 72 65 73 20 69 74 2e 20 49 20 70 72 65 66 65 72  res it. I prefer
0570: 20 74 6f 20 70 75 74 20 69 74 20 73 6f 6d 65 77   to put it somew
0580: 68 65 72 65 20 72 61 6e 64 6f 6d 2c 20 6d 61 6b  here random, mak
0590: 69 6e 67 20 69 74 20 68 61 72 64 65 72 20 66 6f  ing it harder fo
05a0: 72 20 62 6f 74 73 20 74 6f 20 74 61 72 67 65 74  r bots to target
05b0: 2e 20 49 27 6d 20 75 73 69 6e 67 20 31 32 33 34  . I'm using 1234
05c0: 35 20 69 6e 20 74 68 69 73 20 65 78 61 6d 70 6c  5 in this exampl
05d0: 65 2c 20 62 75 74 20 69 6e 20 6d 79 20 61 63 74  e, but in my act
05e0: 75 61 6c 20 63 6f 6e 66 69 67 20 49 20 75 73 65  ual config I use
05f0: 64 20 61 20 72 61 6e 64 6f 6d 20 6e 75 6d 62 65  d a random numbe
0600: 72 20 67 65 6e 65 72 61 74 6f 72 20 69 6e 20 74  r generator in t
0610: 68 65 20 31 30 32 34 2d 34 39 31 35 31 20 72 61  he 1024-49151 ra
0620: 6e 67 65 20 61 6e 64 20 74 68 65 6e 20 75 73 65  nge and then use
0630: 64 20 74 68 61 74 20 65 76 65 72 79 77 68 65 72  d that everywher
0640: 65 2e 0d 0a 0d 0a 53 69 6e 63 65 20 6d 79 20 56  e.....Since my V
0650: 50 4e 20 65 6e 64 70 6f 69 6e 74 20 69 73 20 62  PN endpoint is b
0660: 65 68 69 6e 64 20 61 6e 6f 74 68 65 72 20 72 6f  ehind another ro
0670: 75 74 65 72 2c 20 49 20 5b 66 6f 72 77 61 72 64  uter, I [forward
0680: 65 64 20 74 68 69 73 20 55 44 50 20 70 6f 72 74  ed this UDP port
0690: 5d 28 68 74 74 70 73 3a 2f 2f 70 6f 72 74 66 6f  ](https://portfo
06a0: 72 77 61 72 64 2e 63 6f 6d 2f 68 6f 77 2d 74 6f  rward.com/how-to
06b0: 2d 70 6f 72 74 2d 66 6f 72 77 61 72 64 2f 29 20  -port-forward/) 
06c0: 74 6f 20 69 74 2e 20 49 66 20 79 6f 75 27 72 65  to it. If you're
06d0: 20 72 75 6e 6e 69 6e 67 20 57 69 72 65 47 75 61   running WireGua
06e0: 72 64 20 6f 6e 20 61 20 52 6f 75 74 65 72 4f 53  rd on a RouterOS
06f0: 20 62 6f 78 20 61 63 74 69 6e 67 20 61 73 20 79   box acting as y
0700: 6f 75 72 20 49 6e 74 65 72 6e 65 74 20 67 61 74  our Internet gat
0710: 65 77 61 79 20 69 6e 73 74 65 61 64 2c 20 79 6f  eway instead, yo
0720: 75 27 64 20 6e 65 65 64 20 74 6f 20 61 64 64 20  u'd need to add 
0730: 61 6e 20 22 60 61 63 74 69 6f 6e 3d 61 63 63 65  an "`action=acce
0740: 70 74 60 22 20 66 69 72 65 77 61 6c 6c 20 72 75  pt`" firewall ru
0750: 6c 65 20 66 6f 72 20 74 68 61 74 20 70 6f 72 74  le for that port
0760: 20 69 6e 73 74 65 61 64 2e 20 28 43 6f 6e 76 65   instead. (Conve
0770: 72 73 65 6c 79 2c 20 49 20 64 6f 6e 27 74 20 68  rsely, I don't h
0780: 61 76 65 20 61 20 66 69 72 65 77 61 6c 6c 20 6f  ave a firewall o
0790: 6e 20 6d 79 20 4c 41 4e 27 73 20 52 6f 75 74 65  n my LAN's Route
07a0: 72 4f 53 20 62 6f 78 65 73 2c 20 73 69 6e 63 65  rOS boxes, since
07b0: 20 74 68 65 79 27 72 65 20 6d 61 69 6e 6c 79 20   they're mainly 
07c0: 61 63 74 69 6e 67 20 61 73 20 73 6d 61 72 74 20  acting as smart 
07d0: 73 77 69 74 63 68 65 73 2e 29 0d 0a 0d 0a 54 68  switches.)....Th
07e0: 65 20 60 73 72 63 6e 61 74 60 20 72 75 6c 65 20  e `srcnat` rule 
07f0: 61 74 20 74 68 65 20 65 6e 64 20 69 73 20 74 68  at the end is th
0800: 65 20 6e 6f 76 65 6c 20 62 69 74 2e 20 57 69 74  e novel bit. Wit
0810: 68 6f 75 74 20 69 74 2c 20 74 68 65 20 63 6c 69  hout it, the cli
0820: 65 6e 74 73 20 63 61 6e 20 63 6f 6e 6e 65 63 74  ents can connect
0830: 20 74 6f 20 69 6e 74 65 72 6e 61 6c 20 4c 41 4e   to internal LAN
0840: 20 68 6f 73 74 73 2c 20 62 75 74 20 74 68 65 79   hosts, but they
0850: 20 63 61 6e 27 74 20 67 65 74 20 62 61 63 6b 20   can't get back 
0860: 6f 75 74 20 74 6f 20 74 68 65 20 49 6e 74 65 72  out to the Inter
0870: 6e 65 74 2e 20 54 68 61 74 20 6d 61 79 20 69 6e  net. That may in
0880: 20 66 61 63 74 20 62 65 20 66 69 6e 65 20 66 6f   fact be fine fo
0890: 72 20 73 6f 6d 65 20 75 73 65 20 63 61 73 65 73  r some use cases
08a0: 2c 20 62 75 74 20 6f 6e 65 20 6f 66 20 6d 79 20  , but one of my 
08b0: 75 73 65 73 20 66 6f 72 20 61 20 56 50 4e 20 69  uses for a VPN i
08c0: 73 20 74 6f 20 65 6e 63 72 79 70 74 20 6d 79 20  s to encrypt my 
08d0: 49 6e 74 65 72 6e 65 74 20 74 72 61 66 66 69 63  Internet traffic
08e0: 20 6f 76 65 72 20 70 6f 74 65 6e 74 69 61 6c 6c   over potentiall
08f0: 79 20 68 6f 73 74 69 6c 65 20 4c 41 4e 73 2e 20  y hostile LANs. 
0900: 28 43 6f 66 66 65 65 20 73 68 6f 70 20 61 6e 64  (Coffee shop and
0910: 20 68 6f 74 65 6c 20 74 79 70 65 20 63 61 73 65   hotel type case
0920: 73 2e 29 20 54 68 65 20 63 6f 6e 73 65 71 75 65  s.) The conseque
0930: 6e 63 65 20 69 73 20 74 68 61 74 20 5b 64 6f 75  nce is that [dou
0940: 62 6c 65 2d 4e 41 54 20 6d 61 79 20 62 65 20 61  ble-NAT may be a
0950: 20 70 72 6f 62 6c 65 6d 5d 28 68 74 74 70 73 3a   problem](https:
0960: 2f 2f 73 75 70 65 72 75 73 65 72 2e 63 6f 6d 2f  //superuser.com/
0970: 71 2f 35 32 31 30 31 35 2f 31 34 39 32 37 29 2c  q/521015/14927),
0980: 20 73 6f 20 69 74 27 73 20 62 65 74 74 65 72 20   so it's better 
0990: 74 6f 20 74 65 72 6d 69 6e 61 74 65 20 57 69 72  to terminate Wir
09a0: 65 47 75 61 72 64 20 6f 6e 20 74 68 65 20 49 6e  eGuard on the In
09b0: 74 65 72 6e 65 74 20 62 6f 72 64 65 72 20 67 61  ternet border ga
09c0: 74 65 77 61 79 20 72 6f 75 74 65 72 20 69 66 20  teway router if 
09d0: 79 6f 75 20 63 61 6e 2c 20 6c 65 74 74 69 6e 67  you can, letting
09e0: 20 79 6f 75 20 64 72 6f 70 20 74 68 61 74 20 72   you drop that r
09f0: 75 6c 65 2e 0d 0a 0d 0a 54 68 65 20 70 72 6f 74  ule.....The prot
0a00: 6f 63 6f 6c 73 20 74 68 61 74 20 74 65 6e 64 20  ocols that tend 
0a10: 74 6f 20 66 61 69 6c 20 77 69 74 68 20 64 6f 75  to fail with dou
0a20: 62 6c 65 2d 4e 41 54 20 74 65 6e 64 20 74 6f 20  ble-NAT tend to 
0a30: 62 65 20 6f 6c 64 2c 20 65 76 65 6e 20 6f 62 73  be old, even obs
0a40: 6f 6c 65 74 65 2e 20 4d 61 6e 79 20 6d 6f 64 65  olete. Many mode
0a50: 72 6e 20 49 6e 74 65 72 6e 65 74 20 70 72 6f 74  rn Internet prot
0a60: 6f 63 6f 6c 73 20 75 73 65 20 5b 63 6c 65 76 65  ocols use [cleve
0a70: 72 20 4e 41 54 20 74 72 61 76 65 72 73 61 6c 20  r NAT traversal 
0a80: 6d 65 74 68 6f 64 73 5d 28 68 74 74 70 73 3a 2f  methods](https:/
0a90: 2f 74 61 69 6c 73 63 61 6c 65 2e 63 6f 6d 2f 62  /tailscale.com/b
0aa0: 6c 6f 67 2f 68 6f 77 2d 6e 61 74 2d 74 72 61 76  log/how-nat-trav
0ab0: 65 72 73 61 6c 2d 77 6f 72 6b 73 2f 29 20 74 68  ersal-works/) th
0ac0: 61 74 20 77 69 6c 6c 20 77 6f 72 6b 20 74 68 72  at will work thr
0ad0: 6f 75 67 68 20 64 6f 75 62 6c 65 2d 4e 41 54 2c  ough double-NAT,
0ae0: 20 73 6f 20 69 74 20 69 73 20 6e 6f 74 20 61 6c   so it is not al
0af0: 77 61 79 73 20 61 20 70 72 6f 62 6c 65 6d 20 69  ways a problem i
0b00: 6e 20 70 72 61 63 74 69 63 65 2e 0d 0a 0d 0a 0d  n practice......
0b10: 0a 23 23 20 69 4f 53 20 57 69 72 65 47 75 61 72  .## iOS WireGuar
0b20: 64 2e 61 70 70 20 43 6f 6e 66 69 67 75 72 61 74  d.app Configurat
0b30: 69 6f 6e 0d 0a 0d 0a 54 68 65 20 63 75 72 72 65  ion....The curre
0b40: 6e 74 20 69 4f 53 20 57 69 72 65 47 75 61 72 64  nt iOS WireGuard
0b50: 20 63 6c 69 65 6e 74 20 73 65 65 6d 73 20 74 6f   client seems to
0b60: 20 68 61 76 65 20 71 75 69 74 65 20 61 20 6c 6f   have quite a lo
0b70: 74 20 6f 66 20 55 49 20 64 69 66 66 65 72 65 6e  t of UI differen
0b80: 63 65 73 20 72 65 6c 61 74 69 76 65 20 74 6f 20  ces relative to 
0b90: 77 68 61 74 20 6d 64 75 63 68 61 72 6d 65 20 64  what mducharme d
0ba0: 6f 63 75 6d 65 6e 74 65 64 2c 20 73 6f 20 66 6f  ocumented, so fo
0bb0: 72 20 63 6f 6d 70 6c 65 74 65 6e 65 73 73 2c 20  r completeness, 
0bc0: 68 65 72 65 27 73 20 6d 79 20 73 61 6e 69 74 69  here's my saniti
0bd0: 7a 65 64 20 69 50 68 6f 6e 65 20 63 6f 6e 66 69  zed iPhone confi
0be0: 67 75 72 61 74 69 6f 6e 3a 0d 0a 0d 0a 60 60 60  guration:....```
0bf0: 20 69 6e 69 0d 0a 4e 61 6d 65 3a 20 48 6f 6d 65   ini..Name: Home
0c00: 20 28 76 61 6c 75 65 20 64 6f 65 73 6e 27 74 20   (value doesn't 
0c10: 6d 61 74 74 65 72 29 0d 0a 0d 0a 50 72 69 76 61  matter)....Priva
0c20: 74 65 20 6b 65 79 3a 20 67 65 6e 65 72 61 74 65  te key: generate
0c30: 64 20 62 79 20 61 70 70 0d 0a 50 75 62 6c 69 63  d by app..Public
0c40: 20 6b 65 79 3a 20 64 69 74 74 6f 0d 0a 0d 0a 41   key: ditto....A
0c50: 64 64 72 65 73 73 65 73 3a 20 31 39 32 2e 31 36  ddresses: 192.16
0c60: 38 2e 37 37 2e 32 2f 33 32 0d 0a 44 4e 53 20 73  8.77.2/32..DNS s
0c70: 65 72 76 65 72 73 3a 20 31 39 32 2e 31 36 38 2e  ervers: 192.168.
0c80: 38 38 2e 39 39 0d 0a 0d 0a 50 65 65 72 3a 0d 0a  88.99....Peer:..
0c90: 20 20 50 75 62 6c 69 63 20 6b 65 79 3a 20 70 75    Public key: pu
0ca0: 62 6c 69 63 2d 6b 65 79 20 6c 69 6e 65 20 6f 66  blic-key line of
0cb0: 20 2f 69 6e 74 65 72 66 61 63 65 2f 77 69 72 65   /interface/wire
0cc0: 67 75 61 72 64 2f 70 72 69 6e 74 20 6f 75 74 70  guard/print outp
0cd0: 75 74 0d 0a 20 20 45 6e 64 70 6f 69 6e 74 3a 20  ut..  Endpoint: 
0ce0: 6d 79 2e 64 79 6e 61 6d 69 63 2e 64 6e 73 2e 65  my.dynamic.dns.e
0cf0: 78 61 6d 70 6c 65 2e 63 6f 6d 3a 31 32 33 34 35  xample.com:12345
0d00: 0d 0a 20 20 41 6c 6c 6f 77 65 64 20 49 50 73 3a  ..  Allowed IPs:
0d10: 20 30 2e 30 2e 30 2e 30 2f 30 2c 20 3a 3a 30 2f   0.0.0.0/0, ::0/
0d20: 30 0d 0a 60 60 60 0d 0a 0d 0a 4e 6f 74 65 73 3a  0..```....Notes:
0d30: 0d 0a 0d 0a 31 2e 20 43 6f 70 79 20 74 68 65 20  ....1. Copy the 
0d40: 70 75 62 6c 69 63 20 6b 65 79 20 76 61 6c 75 65  public key value
0d50: 20 69 6e 74 6f 20 74 68 65 20 60 2f 69 6e 74 65   into the `/inte
0d60: 72 66 61 63 65 2f 77 69 72 65 67 75 61 72 64 2f  rface/wireguard/
0d70: 70 65 65 72 73 20 e2 80 a6 20 70 75 62 6c 69 63  peers … public
0d80: 2d 6b 65 79 3d 22 22 60 20 62 69 74 20 69 6e 20  -key=""` bit in 
0d90: 74 68 65 20 52 6f 75 74 65 72 4f 53 20 63 6f 6e  the RouterOS con
0da0: 66 69 67 75 72 61 74 69 6f 6e 2e 0d 0a 31 2e 20  figuration...1. 
0db0: 54 68 65 20 60 41 64 64 72 65 73 73 65 73 60 20  The `Addresses` 
0dc0: 6c 69 6e 65 20 69 73 20 74 68 65 20 73 61 6d 65  line is the same
0dd0: 20 61 73 20 60 61 6c 6c 6f 77 65 64 2d 61 64 64   as `allowed-add
0de0: 72 65 73 73 60 20 69 6e 20 74 68 65 20 52 6f 75  ress` in the Rou
0df0: 74 65 72 4f 53 20 63 6f 6e 66 69 67 75 72 61 74  terOS configurat
0e00: 69 6f 6e 2e 0d 0a 31 2e 20 54 68 65 20 60 44 4e  ion...1. The `DN
0e10: 53 20 73 65 72 76 65 72 73 60 20 6c 69 6e 65 20  S servers` line 
0e20: 70 6f 69 6e 74 73 20 74 6f 20 61 20 70 72 69 76  points to a priv
0e30: 61 74 65 20 4c 41 4e 20 44 4e 53 20 73 65 72 76  ate LAN DNS serv
0e40: 65 72 20 69 6e 20 74 68 69 73 20 65 78 61 6d 70  er in this examp
0e50: 6c 65 2c 20 62 75 74 20 69 74 20 63 6f 75 6c 64  le, but it could
0e60: 20 69 6e 73 74 65 61 64 20 62 65 20 74 68 65 20   instead be the 
0e70: 62 6f 72 64 65 72 20 67 61 74 65 77 61 79 20 72  border gateway r
0e80: 6f 75 74 65 72 27 73 20 49 50 20 69 66 20 69 74  outer's IP if it
0e90: 27 73 20 72 75 6e 6e 69 6e 67 20 61 20 44 4e 53  's running a DNS
0ea0: 20 63 61 63 68 65 2c 20 61 20 70 75 62 6c 69 63   cache, a public
0eb0: 20 44 4e 53 20 73 65 72 76 65 72 20 73 75 63 68   DNS server such
0ec0: 20 61 73 20 38 2e 38 2e 38 2e 38 2c 20 65 74 63   as 8.8.8.8, etc
0ed0: 2e 0d 0a 31 2e 20 49 20 72 65 63 6f 6d 6d 65 6e  ...1. I recommen
0ee0: 64 20 75 73 69 6e 67 20 61 20 64 79 6e 61 6d 69  d using a dynami
0ef0: 63 20 44 4e 53 20 73 65 72 76 69 63 65 20 73 75  c DNS service su
0f00: 63 68 20 61 73 20 5b 4d 69 6b 72 6f 54 69 6b 20  ch as [MikroTik 
0f10: 43 6c 6f 75 64 5d 28 68 74 74 70 73 3a 2f 2f 77  Cloud](https://w
0f20: 69 6b 69 2e 6d 69 6b 72 6f 74 69 6b 2e 63 6f 6d  iki.mikrotik.com
0f30: 2f 77 69 6b 69 2f 4d 61 6e 75 61 6c 3a 49 50 2f  /wiki/Manual:IP/
0f40: 43 6c 6f 75 64 29 20 72 61 74 68 65 72 20 74 68  Cloud) rather th
0f50: 61 6e 20 61 20 73 74 61 74 69 63 20 49 50 20 6f  an a static IP o
0f60: 6e 20 74 68 65 20 60 45 6e 64 70 6f 69 6e 74 60  n the `Endpoint`
0f70: 20 6c 69 6e 65 2e 0d 0a 31 2e 20 54 68 65 20 70   line...1. The p
0f80: 6f 72 74 20 6e 75 6d 62 65 72 20 6f 6e 20 74 68  ort number on th
0f90: 65 20 60 45 6e 64 70 6f 69 6e 74 60 20 6c 69 6e  e `Endpoint` lin
0fa0: 65 20 69 73 20 74 68 65 20 73 61 6d 65 20 72 61  e is the same ra
0fb0: 6e 64 6f 6d 20 70 6f 72 74 20 49 20 72 65 63 6f  ndom port I reco
0fc0: 6d 6d 65 6e 64 65 64 20 79 6f 75 20 70 69 63 6b  mmended you pick
0fd0: 20 61 62 6f 76 65 2e 0d 0a 31 2e 20 57 65 20 73   above...1. We s
0fe0: 65 74 20 61 20 77 69 64 65 2d 6f 70 65 6e 20 60  et a wide-open `
0ff0: 41 6c 6c 6f 77 65 64 20 49 50 73 60 20 6c 69 6e  Allowed IPs` lin
1000: 65 20 74 6f 20 61 6c 6c 6f 77 20 74 68 65 20 63  e to allow the c
1010: 6c 69 65 6e 74 20 74 6f 20 61 63 74 20 61 73 20  lient to act as 
1020: 61 6e 79 20 4c 41 4e 20 63 6c 69 65 6e 74 2c 20  any LAN client, 
1030: 75 73 69 6e 67 20 61 6c 6c 20 72 65 73 6f 75 72  using all resour
1040: 63 65 73 20 66 72 65 65 6c 79 2c 20 62 6f 74 68  ces freely, both
1050: 20 4c 41 4e 20 61 6e 64 20 57 41 4e 2e 0d 0a 0d   LAN and WAN....
1060: 0a 45 76 65 72 79 74 68 69 6e 67 20 65 6c 73 65  .Everything else
1070: 20 77 65 20 6c 65 61 76 65 20 61 74 20 74 68 65   we leave at the
1080: 69 72 20 64 65 66 61 75 6c 74 73 2e 20 57 69 74  ir defaults. Wit
1090: 68 20 74 68 69 73 20 63 6f 6e 66 69 67 75 72 61  h this configura
10a0: 74 69 6f 6e 20 79 6f 75 20 63 61 6e 20 73 65 65  tion you can see
10b0: 20 4c 41 4e 20 72 65 73 6f 75 72 63 65 73 2c 20   LAN resources, 
10c0: 61 6e 64 20 65 76 65 72 79 74 68 69 6e 67 20 65  and everything e
10d0: 6c 73 65 20 67 65 74 73 20 73 72 63 6e 61 74 74  lse gets srcnatt
10e0: 65 64 20 61 6e 64 20 73 65 6e 74 20 61 73 20 69  ed and sent as i
10f0: 66 20 69 74 20 77 61 73 20 63 6f 6d 69 6e 67 20  f it was coming 
1100: 66 72 6f 6d 20 74 68 65 20 57 69 72 65 47 75 61  from the WireGua
1110: 72 64 20 73 65 72 76 65 72 2c 20 73 75 62 6a 65  rd server, subje
1120: 63 74 20 74 6f 20 77 68 61 74 65 76 65 72 20 72  ct to whatever r
1130: 75 6c 65 73 20 79 6f 75 20 68 61 76 65 20 66 6f  ules you have fo
1140: 72 20 49 6e 74 65 72 6e 65 74 20 61 63 63 65 73  r Internet acces
1150: 73 20 66 72 6f 6d 20 74 68 61 74 20 4c 41 4e 2e  s from that LAN.
1160: 0d 0a 0d 0a 0d 0a 0d 0a 23 23 20 41 6c 74 65 72  ........## Alter
1170: 6e 61 74 65 20 44 6f 75 62 6c 65 2d 4e 41 54 20  nate Double-NAT 
1180: 41 76 6f 69 64 61 6e 63 65 20 4d 65 74 68 6f 64  Avoidance Method
1190: 73 0d 0a 0d 0a 54 68 65 72 65 20 61 72 65 20 74  s....There are t
11a0: 77 6f 20 70 6f 74 65 6e 74 69 61 6c 20 77 61 79  wo potential way
11b0: 73 20 74 6f 20 61 76 6f 69 64 20 64 6f 75 62 6c  s to avoid doubl
11c0: 65 2d 4e 41 54 20 77 68 69 6c 65 20 73 74 69 6c  e-NAT while stil
11d0: 6c 20 74 65 72 6d 69 6e 61 74 69 6e 67 20 57 69  l terminating Wi
11e0: 72 65 47 75 61 72 64 20 62 65 68 69 6e 64 20 61  reGuard behind a
11f0: 20 4e 41 54 3a 0d 0a 0d 0a 31 2e 20 49 66 20 79   NAT:....1. If y
1200: 6f 75 72 20 49 6e 74 65 72 6e 65 74 20 67 61 74  our Internet gat
1210: 65 77 61 79 20 72 6f 75 74 65 72 20 73 75 70 70  eway router supp
1220: 6f 72 74 73 20 63 75 73 74 6f 6d 20 73 74 61 74  orts custom stat
1230: 69 63 20 72 6f 75 74 65 73 2c 20 79 6f 75 20 63  ic routes, you c
1240: 6f 75 6c 64 20 72 6f 75 74 65 20 74 68 65 20 57  ould route the W
1250: 69 72 65 47 75 61 72 64 20 73 75 62 6e 65 74 20  ireGuard subnet 
1260: 28 31 39 32 2e 31 36 38 2e 37 37 2e 30 2f 32 34  (192.168.77.0/24
1270: 20 69 6e 20 6d 79 20 65 78 61 6d 70 6c 65 29 20   in my example) 
1280: 74 6f 20 74 68 65 20 52 6f 75 74 65 72 4f 53 20  to the RouterOS 
1290: 62 6f 78 20 61 73 20 74 68 65 20 6e 65 78 74 2d  box as the next-
12a0: 68 6f 70 20 49 50 2e 0d 0a 0d 0a 32 2e 20 49 66  hop IP.....2. If
12b0: 20 79 6f 75 27 72 65 20 6f 6e 6c 79 20 75 73 69   you're only usi
12c0: 6e 67 20 64 65 73 6b 74 6f 70 20 4f 53 20 57 69  ng desktop OS Wi
12d0: 72 65 47 75 61 72 64 20 63 6c 69 65 6e 74 73 2c  reGuard clients,
12e0: 20 79 6f 75 20 6d 61 79 20 62 65 20 61 62 6c 65   you may be able
12f0: 20 74 6f 20 5b 75 73 65 20 74 68 65 69 72 20 50   to [use their P
1300: 6f 73 74 55 70 20 61 6e 64 20 50 6f 73 74 44 6f  ostUp and PostDo
1310: 77 6e 20 72 75 6c 65 73 5d 28 68 74 74 70 73 3a  wn rules](https:
1320: 2f 2f 6a 72 73 2d 73 2e 6e 65 74 2f 32 30 31 38  //jrs-s.net/2018
1330: 2f 30 38 2f 30 35 2f 72 6f 75 74 69 6e 67 2d 62  /08/05/routing-b
1340: 65 74 77 65 65 6e 2d 77 67 2d 69 6e 74 65 72 66  etween-wg-interf
1350: 61 63 65 73 2d 77 69 74 68 2d 77 69 72 65 67 75  aces-with-wiregu
1360: 61 72 64 2f 29 20 74 6f 20 6d 61 6e 69 70 75 6c  ard/) to manipul
1370: 61 74 65 20 74 68 65 20 6c 6f 63 61 6c 20 72 6f  ate the local ro
1380: 75 74 65 20 74 61 62 6c 65 20 69 6e 73 74 65 61  ute table instea
1390: 64 2e 20 49 20 63 6f 75 6c 64 6e 27 74 20 64 6f  d. I couldn't do
13a0: 20 74 68 61 74 20 69 6e 20 6d 79 20 63 61 73 65   that in my case
13b0: 20 62 65 63 61 75 73 65 20 74 68 65 20 69 4f 53   because the iOS
13c0: 20 63 6c 69 65 6e 74 20 64 6f 65 73 6e 27 74 20   client doesn't 
13d0: 68 61 76 65 20 74 68 61 74 20 6f 70 74 69 6f 6e  have that option
13e0: 2c 20 61 6e 64 20 65 76 65 6e 20 69 66 20 69 74  , and even if it
13f0: 20 64 69 64 2c 20 49 20 66 65 65 6c 20 71 75 69   did, I feel qui
1400: 74 65 20 73 75 72 65 20 69 4f 53 20 77 6f 75 6c  te sure iOS woul
1410: 64 6e 27 74 20 6c 65 74 20 79 6f 75 20 64 69 72  dn't let you dir
1420: 65 63 74 6c 79 20 6d 61 6e 69 70 75 6c 61 74 65  ectly manipulate
1430: 20 74 68 65 20 72 6f 75 74 65 20 74 61 62 6c 65   the route table
1440: 20 6c 69 6b 65 20 74 68 61 74 2e 0d 0a 0d 0a 0d   like that......
1450: 0a 23 23 20 3c 61 20 69 64 3d 22 6c 69 63 65 6e  .## <a id="licen
1460: 73 65 22 3e 3c 2f 61 3e 4c 69 63 65 6e 73 65 0d  se"></a>License.
1470: 0a 0d 0a 54 68 69 73 20 77 6f 72 6b 20 69 73 20  ...This work is 
1480: c2 a9 20 32 30 32 32 2d 32 30 32 34 20 62 79 20  © 2022-2024 by 
1490: 57 61 72 72 65 6e 20 59 6f 75 6e 67 20 61 6e 64  Warren Young and
14a0: 20 69 73 20 6c 69 63 65 6e 73 65 64 20 75 6e 64   is licensed und
14b0: 65 72 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70  er <a href="http
14c0: 3a 2f 2f 63 72 65 61 74 69 76 65 63 6f 6d 6d 6f  ://creativecommo
14d0: 6e 73 2e 6f 72 67 2f 6c 69 63 65 6e 73 65 73 2f  ns.org/licenses/
14e0: 62 79 2d 6e 63 2d 73 61 2f 34 2e 30 2f 22 20 74  by-nc-sa/4.0/" t
14f0: 61 72 67 65 74 3d 22 5f 62 6c 61 6e 6b 22 20 72  arget="_blank" r
1500: 65 6c 3d 22 6c 69 63 65 6e 73 65 20 6e 6f 6f 70  el="license noop
1510: 65 6e 65 72 20 6e 6f 72 65 66 65 72 72 65 72 22  ener noreferrer"
1520: 3e 43 43 20 42 59 2d 4e 43 2d 53 41 20 34 2e 30  >CC BY-NC-SA 4.0
1530: 3c 69 6d 67 20 73 74 79 6c 65 3d 22 68 65 69 67  <img style="heig
1540: 68 74 3a 32 32 70 78 21 69 6d 70 6f 72 74 61 6e  ht:22px!importan
1550: 74 3b 6d 61 72 67 69 6e 2d 6c 65 66 74 3a 33 70  t;margin-left:3p
1560: 78 3b 76 65 72 74 69 63 61 6c 2d 61 6c 69 67 6e  x;vertical-align
1570: 3a 74 65 78 74 2d 62 6f 74 74 6f 6d 3b 22 20 73  :text-bottom;" s
1580: 72 63 3d 22 68 74 74 70 73 3a 2f 2f 6d 69 72 72  rc="https://mirr
1590: 6f 72 73 2e 63 72 65 61 74 69 76 65 63 6f 6d 6d  ors.creativecomm
15a0: 6f 6e 73 2e 6f 72 67 2f 70 72 65 73 73 6b 69 74  ons.org/presskit
15b0: 2f 69 63 6f 6e 73 2f 63 63 2e 73 76 67 3f 72 65  /icons/cc.svg?re
15c0: 66 3d 63 68 6f 6f 73 65 72 2d 76 31 22 3e 3c 69  f=chooser-v1"><i
15d0: 6d 67 20 73 74 79 6c 65 3d 22 68 65 69 67 68 74  mg style="height
15e0: 3a 32 32 70 78 21 69 6d 70 6f 72 74 61 6e 74 3b  :22px!important;
15f0: 6d 61 72 67 69 6e 2d 6c 65 66 74 3a 33 70 78 3b  margin-left:3px;
1600: 76 65 72 74 69 63 61 6c 2d 61 6c 69 67 6e 3a 74  vertical-align:t
1610: 65 78 74 2d 62 6f 74 74 6f 6d 3b 22 20 73 72 63  ext-bottom;" src
1620: 3d 22 68 74 74 70 73 3a 2f 2f 6d 69 72 72 6f 72  ="https://mirror
1630: 73 2e 63 72 65 61 74 69 76 65 63 6f 6d 6d 6f 6e  s.creativecommon
1640: 73 2e 6f 72 67 2f 70 72 65 73 73 6b 69 74 2f 69  s.org/presskit/i
1650: 63 6f 6e 73 2f 62 79 2e 73 76 67 3f 72 65 66 3d  cons/by.svg?ref=
1660: 63 68 6f 6f 73 65 72 2d 76 31 22 3e 3c 69 6d 67  chooser-v1"><img
1670: 20 73 74 79 6c 65 3d 22 68 65 69 67 68 74 3a 32   style="height:2
1680: 32 70 78 21 69 6d 70 6f 72 74 61 6e 74 3b 6d 61  2px!important;ma
1690: 72 67 69 6e 2d 6c 65 66 74 3a 33 70 78 3b 76 65  rgin-left:3px;ve
16a0: 72 74 69 63 61 6c 2d 61 6c 69 67 6e 3a 74 65 78  rtical-align:tex
16b0: 74 2d 62 6f 74 74 6f 6d 3b 22 20 73 72 63 3d 22  t-bottom;" src="
16c0: 68 74 74 70 73 3a 2f 2f 6d 69 72 72 6f 72 73 2e  https://mirrors.
16d0: 63 72 65 61 74 69 76 65 63 6f 6d 6d 6f 6e 73 2e  creativecommons.
16e0: 6f 72 67 2f 70 72 65 73 73 6b 69 74 2f 69 63 6f  org/presskit/ico
16f0: 6e 73 2f 6e 63 2e 73 76 67 3f 72 65 66 3d 63 68  ns/nc.svg?ref=ch
1700: 6f 6f 73 65 72 2d 76 31 22 3e 3c 69 6d 67 20 73  ooser-v1"><img s
1710: 74 79 6c 65 3d 22 68 65 69 67 68 74 3a 32 32 70  tyle="height:22p
1720: 78 21 69 6d 70 6f 72 74 61 6e 74 3b 6d 61 72 67  x!important;marg
1730: 69 6e 2d 6c 65 66 74 3a 33 70 78 3b 76 65 72 74  in-left:3px;vert
1740: 69 63 61 6c 2d 61 6c 69 67 6e 3a 74 65 78 74 2d  ical-align:text-
1750: 62 6f 74 74 6f 6d 3b 22 20 73 72 63 3d 22 68 74  bottom;" src="ht
1760: 74 70 73 3a 2f 2f 6d 69 72 72 6f 72 73 2e 63 72  tps://mirrors.cr
1770: 65 61 74 69 76 65 63 6f 6d 6d 6f 6e 73 2e 6f 72  eativecommons.or
1780: 67 2f 70 72 65 73 73 6b 69 74 2f 69 63 6f 6e 73  g/presskit/icons
1790: 2f 73 61 2e 73 76 67 3f 72 65 66 3d 63 68 6f 6f  /sa.svg?ref=choo
17a0: 73 65 72 2d 76 31 22 3e 3c 2f 61 3e 0d 0a 0d 0a  ser-v1"></a>....
17b0: 3c 64 69 76 20 73 74 79 6c 65 3d 22 68 65 69 67  <div style="heig
17c0: 68 74 3a 20 35 30 65 6d 22 20 69 64 3d 22 74 68  ht: 50em" id="th
17d0: 69 73 2d 73 70 61 63 65 2d 69 6e 74 65 6e 74 69  is-space-intenti
17e0: 6f 6e 61 6c 6c 79 2d 6c 65 66 74 2d 62 6c 61 6e  onally-left-blan
17f0: 6b 22 3e 3c 2f 64 69 76 3e 0a 5a 20 66 36 61 64  k"></div>.Z f6ad
1800: 65 35 62 61 34 31 61 61 62 39 38 32 61 37 33 39  e5ba41aab982a739
1810: 31 34 38 30 36 33 31 31 36 62 37 35 0a           148063116b75.