Loosing internet access via WireGuard

I am not sure if i did someting wrong.

I did simple RoadWarrior style configuration where mobile client is connecting to Internet via mikrotik and wireguard

Initiallty this configuration worked but after a while it started to trow errors:

22:33:32 wireguard,debug wireguard1: bQe944f7N4kCSXROQcDf1kheES0gTHzSsvGiUtZWUWQ=: Handshake for peer did not complete after 5 seconds, retrying (try 10)

mikrotik conf
mt-export.rsc (30 KB)
android/ios client conf
mt-export.rsc (30 KB)
vpn.urbinek.eu.conf.txt (208 Bytes)

I understood handshake should be at 25 sec.
At least that is the general recommendation for devices behind firewall.
Already tried that on both sides ?

Could you explain a little bit more?

You can’t have same allowed-address=192.168.99.0/24 for multiple peers on same interface, it should be allowed-address=192.168.99.X/32 (where X is what that peer has).

Concur, My iphone setting is ONE address.
thus your peer settting for allowed addressess
on MT PEER SETTINGS
Android
/interface wireguard peers
add allowed-address=192.168.99**.X/32** comment=“OnePlus 7” interface=wireguard1
persistent-keepalive=1m
public-key=
add allowed-address=192.168.99.Y/32 comment=“iPhone 11” interface=wireguard1
persistent-keepalive=1m
public-key=\

For example on my iphone I use 10.2.0.2/32

Nothing wrong with having the endpoint address on iphone or android peer settings to be 0.0.0.0/0 as one is wanting internet through the MT WG server location.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The other issue could be routes…
WHERE ARE THEY??
At a minimum you need
dst-address=192.168.99.0/24 gwy=wireguard1 table=main

This also looks suspect:
add action=masquerade chain=srcnat comment=“WireGuard → Internet”
out-interface=ether1-wan src-address=192.168.99.0/24

There is no need to masquerade traffic coming from your iphone out to the internet??
I suppose it cannot hurt but not sure what you accomplish with it???
UNLESS your MT is behind another Router like an ISP router where you cannot create a static route??
Assuming if true, then at least you can forward ports otherwise the MT couldnt be an MT wg server.


note1; This is not best security practices, not recommended to use plain text services
/ip service
set telnet address=192.168.88.0/24
set ftp address=192.168.88.0/24
set www port=81

note2: this does not look like a legitimate rule as if it was for the establishment of an encrypted connection (VPN) it would be input chain
if it was for port forwarding to a server it would be in the dst nat chain.
add action=accept chain=forward dst-port=443 in-interface=ether1-wan
log-prefix="fw-log → " protocol=tcp

Please tell me you’re joking. What do you think this does?

/ip address
add address=192.168.99.1/24 interface=wireguard1 network=192.168.99.0

Neglecting the ip address everyone is using, even himself on iPhone, I guess ?

It seems that changing from network to host alone worked, but i am confused why.

Documentation is not very descriptive on WireGuard and using networks seems to be more flexible configuration for many clients when i do not care about specific IP

You mean like the one created dynamically by MT whe i’ve added IP to WireGuard interface?

[admin@home_CRS305] > /ip/route/print 
Flags: D - DYNAMIC; A - ACTIVE; c, d, y - COPY
Columns: DST-ADDRESS, GATEWAY, DISTANCE
    DST-ADDRESS      GATEWAY       DISTANCE
DAd 0.0.0.0/0        1.2.3.4         1
DAc 10.10.10.0/24    bridge-infra         0
DAc 79.175.228.0/22  ether1-wan           0
DAc 172.16.10.0/24   bridge-guest         0
DAc 172.31.100.0/24  bridge-iot           0
DAc 192.168.88.0/24  bridge-home          0
DAc 192.168.99.0/24  wireguard1           0



I might fail to mention, but this is my home network. I have no option to route this traffic and i need to nat it locally

Agree, I used this for local fuckery, should remove that :slight_smile:

This is not related with VPN

How come?

Running joke/discussion around here between anav and Sob.
anav seems to be amongst the very few (if not the only one) insisting on NOT using internal IP addresses on WG-endpoints (which BTW DOES work without on Mikrotik to Mikrotik connections, no discussion there. But it’s mighty confusing for most people).
But for the connection from his iPhone he has to or it will not work.

Now it makes sense :slight_smile:

For me it’s natural to use IPs for vpn endpoints, but routing by interface might be more elastic in bigger environments i think

So many topics/issues tagged with WireGuard that have nothing to do with WireGuard.

Good that mine was actually related with bad WireGuard configuration fixed by propper WireGuard configuration :slight_smile:

Yes, I forget about the IP address wrt not needed the IP Route.
I prefer to use Routes then IP address. IP address confuses me LOL

For the record Holvoeten I dont espouse anything on non-MT devices. My iphone has an Ip address assigned to it, so that on my MT I can know which IP is coming through the tunnel.
Not necessarily the case for MT devices where I care about the IP address of individual devices coming through, not one, and not necessarily just one subnet, I could care less what the IP address of the wg interface is :wink:

In this case the issue was PEER overlap. Probably caused by over reliance on IP addresses and wg interfaces :stuck_out_tongue_winking_eye:

The catch is that when you have multiple peers connected to same interface, router must use something to determine what should it send to which client. If you have allowed-address=192.168.99.0/24 for both and there’s packet to 192.168.99.x, should it go to first one or second one? It’s impossible to choose. If there’s only one peer (e.g. on client side), then whole subnet is fine, as all will be sent to server and it can do routing between clients.

You can do the same with Linux, but why would anyone do it?

I know and you should also know in which camp I am :laughing:

Well, each peer have unique set of keys which are not shared across other peers so why it can’t be used?
They are used in logs for identifying peers

But i guess that’s MT implementation, so I’ll roll with it.

Yes, keys are unique, but how does that help? How can you tell that e.g. 192.168.99.3 should go to peer A and not peer B?