Score:0

Cannot resolve LAN hostname when connected using Wireguard

ne flag

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.

ar flag
Which distro and version of Linux are you using?
gameveloster avatar
ne flag
@user68186 Ubuntu 22.04 on the Wireguard server and on `foo`. Mac OS X 12.6 on the laptop.
ar flag
Someone else [asked a similar question](https://askubuntu.com/questions/1434901/how-to-use-wireguard-lan-only) the other day. I don't have any solution.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.