Wireguard endpoint route using DDNS

Hi!

I have Wiregaurd S2S VPN between RB4011 (VPN server) and wAP ac LTE6 (VPN endpoint).
I want to autoconnect my wAP ac LTE6 to RB4011, but RB4011 has dynamic Internet IP address.
I added on RB4011 DDNS script, that monitors current IP and updates DDNS service - this works fine, but wAP ac LTE6 endpoint needs to have that public IP added in static route as below:

#     DST-ADDRESS       GATEWAY       DISTANCE
...
1  As 79.11.6.141/32  lte1                 1

How could I change this to autoupdate static route once RB4011 change it’s public IP?

Something like:

#     DST-ADDRESS       GATEWAY       DISTANCE
...
1  As myurl.no-ip.com  lte1                 1

would be perfect…

You can use a name (instead of an IP address) for endpoint in your Wireguard Peer setup.
I’m using the Mikrotik DDNS name (/ip/cloud) for this purpose (it has to be enabled).

For adding a custom route you can use the Wireguard interface.

Thanks for reply
Yeah - endpoint with URL is possible, but you need also to add static route to that endpoint IP to make the tunnel up and transfer traffic via it

So how could I add such host route to URL?

I know there are scripts checking DDNS service for Mikrotik - I use one of them and it works.
Maybe there is some statis route autoupdating scirpt also?

@ shadow82

Maybe there is some statis route autoupdating scirpt also?

interesting :thinking:

hmm.. how about these? from the wg client,

  1. since you already did the remote ip ddns,
    how about - wait for the tunnel to come up.

then..

  1. create another script to read the tunnel interface status, to read remote gateway ip and do route accordingly.

i have never tried this myself but maybe you could do some lab?

The requirement is not clear to me.
There is no need for funny route business for the LTE (client) to connect to the RB4011 server.
Once connected what is that you want to do? Go out RB4011 internet, access RBV4011 subnets??
it seems like you are trying to add an extra step that is not required??