Address by computer name instead of IP address in WireGuard VPN?

It’s all in the HOW-TO.

Thanks for all your help, so far, but I’m still unable to connect at mac.local.

If I knew how to do this safely, on a mac, I would consider it… but the default/unchangeable computer name, through settings, must end in .local.

Can you ping your Mac via LuCI → Network → Diagnostics → IPv4 Ping w/ 10.0.0.2?

PING 10.0.0.2 (10.0.0.2): 56 data bytes
64 bytes from 10.0.0.2: seq=0 ttl=64 time=0.942 ms
64 bytes from 10.0.0.2: seq=1 ttl=64 time=1.033 ms
64 bytes from 10.0.0.2: seq=2 ttl=64 time=0.843 ms
64 bytes from 10.0.0.2: seq=3 ttl=64 time=0.851 ms
64 bytes from 10.0.0.2: seq=4 ttl=64 time=0.859 ms

— 10.0.0.2 ping statistics —
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.843/0.905/1.033 ms

Good stuff. Can you ping your Mac via its WG IP (eg: 10.0.8.2)?


Reference(s):

PING 10.0.8.2 (10.0.8.2): 56 data bytes
64 bytes from 10.0.8.2: seq=0 ttl=64 time=32.366 ms
64 bytes from 10.0.8.2: seq=1 ttl=64 time=150.096 ms
64 bytes from 10.0.8.2: seq=2 ttl=64 time=59.870 ms
64 bytes from 10.0.8.2: seq=3 ttl=64 time=61.765 ms
64 bytes from 10.0.8.2: seq=4 ttl=64 time=711.697 ms

— 10.0.8.2 ping statistics —
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 32.366/203.158/711.697 ms

Also, I added both mac.local and mac.lan to my ‘hosts’ file
127.0.0.1 localhost
10.0.0.2 mac.local
10.0.0.2 mac.lan
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

FWIW, I did these, also:

PING mac.local (10.0.0.2): 56 data bytes
64 bytes from 10.0.0.2: seq=0 ttl=64 time=0.985 ms
64 bytes from 10.0.0.2: seq=1 ttl=64 time=0.996 ms
64 bytes from 10.0.0.2: seq=2 ttl=64 time=1.219 ms
64 bytes from 10.0.0.2: seq=3 ttl=64 time=0.939 ms
64 bytes from 10.0.0.2: seq=4 ttl=64 time=0.975 ms

— mac.local ping statistics —
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.939/1.022/1.219 ms

PING mac.lan (10.0.0.2): 56 data bytes
64 bytes from 10.0.0.2: seq=0 ttl=64 time=1.048 ms
64 bytes from 10.0.0.2: seq=1 ttl=64 time=1.049 ms
64 bytes from 10.0.0.2: seq=2 ttl=64 time=1.205 ms
64 bytes from 10.0.0.2: seq=3 ttl=64 time=1.102 ms
64 bytes from 10.0.0.2: seq=4 ttl=64 time=1.143 ms

— mac.lan ping statistics —
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 1.048/1.109/1.205 ms

So we know WG is proper… which we already knew. What’s the result when you ping via the hostname(s) (eg: mac.lan, then mac.local)? I’m looking to see what IPv4 is returning.

PING mac.lan (10.0.0.2): 56 data bytes
64 bytes from 10.0.0.2: seq=0 ttl=64 time=0.966 ms
64 bytes from 10.0.0.2: seq=1 ttl=64 time=0.941 ms
64 bytes from 10.0.0.2: seq=2 ttl=64 time=0.914 ms
64 bytes from 10.0.0.2: seq=3 ttl=64 time=0.924 ms
64 bytes from 10.0.0.2: seq=4 ttl=64 time=0.929 ms

— mac.lan ping statistics —
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.914/0.934/0.966 ms


PING mac.local (10.0.0.2): 56 data bytes
64 bytes from 10.0.0.2: seq=0 ttl=64 time=0.880 ms
64 bytes from 10.0.0.2: seq=1 ttl=64 time=0.987 ms
64 bytes from 10.0.0.2: seq=2 ttl=64 time=0.848 ms
64 bytes from 10.0.0.2: seq=3 ttl=64 time=1.003 ms
64 bytes from 10.0.0.2: seq=4 ttl=64 time=0.994 ms

— mac.local ping statistics —
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.848/0.942/1.003 ms

I’m speculating if this will help but what happens if you set mac 10.0.8.2 as the mac.{lan,local} & remove all references to 10.0.0.2 in the GI GUI hostnames &/or LuCI Static Leases/Hostnames?

I’m wondering if that’ll be enough to resolve the DNS to the WG IP but I wouldn’t get my hopes up.

Please make sure you have a backup made first.