Skip to content
Contents
GuidesOpenWrt

How to give a WireGuard peer a reverse DNS name on OpenWrt

A WireGuard peer label may never appear in DNS. First confirm which device owns the fixed tunnel address. The outer Endpoint can change, and AllowedIPs can cover an entire remote network.

A WireGuard peer label may never appear in DNS. First confirm which device owns the fixed tunnel address. The outer Endpoint can change, and AllowedIPs can cover an entire remote network.

Name one address

Use SSH on OpenWrt. This assumes dnsmasq listens on loopback and reads /etc/hosts. With no-hosts enabled, check which hosts file the active instance uses instead. Check for duplicate names and addresses and make a fresh backup. Substitute your own values and append once. Schedule the restart for a quiet period because DNS and DHCP may pause.

backup=$(mktemp /tmp/hosts.XXXXXX) &&
cp /etc/hosts "$backup" &&
echo "$backup" &&
printf '\n10.77.0.2 laptop.home.arpa\n' >> /etc/hosts &&
/etc/init.d/dnsmasq restart

Query both directions

The A answer should be 10.77.0.2. For PTR, reverse the four IPv4 octets and append in-addr.arpa. Expect laptop.home.arpa. Update the reverse name if you change the address.

nslookup -type=A laptop.home.arpa 127.0.0.1
nslookup -type=PTR 2.0.77.10.in-addr.arpa 127.0.0.1

OpenWrt 25.12.6 · SSH · A + PTR

SSH session on an OpenWrt 25.12.6 virtual machine. This tests local DNS only. Tunnel connectivity was not tested.

Still seeing an IP on the client?

Repeat the queries there, replacing 127.0.0.1 with the router’s LAN address. If only local queries work, check the client resolver, listening interfaces and caches. Some applications never request PTR records. To undo the change, remove only the added line, restart dnsmasq and confirm PTR no longer returns the test name.

Connect your phone to an OpenWrt WireGuard server from a mobile network

Explore hardware

Comments