My LAN has a Wireguard server than my laptop connects to from a remote location.
| |
| |
Laptop -> Router (WG client) -> Router -----> (INTERNET) -----> Router -> WG server
| | ∟--> foo
| |
However, when using the Wireguard tunnel, the laptop is unable to ping/ssh to a machine using its hostname foo
, and is only able to reach it using its IP address 192.168.1.101
% ping foo
ping: cannot resolve foo: Unknown host
% nslookup host foo
nslookup: couldn't get address for 'foo': not found
% ping 192.168.1.101
PING 192.168.1.101 (192.168.1.101): 56 data bytes
64 bytes from 192.168.1.101: icmp_seq=0 ttl=63 time=27.082 ms
There is no problem accessing foo
using its hostname from another machine on the network.
$ ping foo
PING foo.localdomain (192.168.1.101) 56(84) bytes of data.
64 bytes from foo.localdomain (192.168.1.101): icmp_seq=1 ttl=64 time=0.094 ms
$ nslookup foo
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: foo.localdomain
Address: 192.168.1.101
$ nslookup foo 192.168.1.1
Server: 192.168.1.1
Address: 192.168.1.1#53
Name: foo.localdomain
Address: 192.168.1.101
The Wireguard profile used by my laptop contains the lines under [Interface]
:
[Interface]
Address = 10.116.51.3/24
DNS = 192.168.1.1, 9.9.9.9, 149.112.112.112
Is there any way to allow the laptop using Wireguard tunnel to reach the LAN machines via their hostnames? The LAN is running on a Unifi Dream Machine and some Unifi switches.