Contents

DNS Forwarding in VyOS


Prerequisites


Why DNS on VyOS

Without a DNS resolver on the lab network, devices either use a hardcoded public resolver or rely on the home router for name resolution. Running the forwarder directly on VyOS gives you:

  • A single DNS server for all lab hosts to point at
  • Static entries for internal services — no need for a separate DNS server just to resolve nas.lab.local
  • A natural place to add per-domain forwarding rules later (e.g. forward cluster.local to a Kubernetes CoreDNS instance)

VyOS includes a built-in DNS forwarder powered by PowerDNS Recursor, available without installing anything extra.

Official reference: VyOS DNS Forwarding


Enabling DNS Forwarding

Enter configuration mode and set up the forwarder:

1
2
3
4
5
6
7
8
9
configure

set service dns forwarding listen-address '10.x.x.1'
set service dns forwarding allow-from '10.x.x.0/24'
set service dns forwarding name-server '1.1.1.1'
set service dns forwarding name-server '8.8.8.8'

commit
save
  • listen-address — the lab interface IP that VyOS will accept DNS queries on
  • allow-from — restricts queries to your lab subnet; queries from outside this range are dropped
  • name-server — upstream resolvers that unresolved queries are forwarded to

Static Host Entries

For internal services that only exist on the lab network, you can define static A records directly on VyOS rather than running a separate DNS server:

1
2
3
4
5
6
7
configure

set service dns forwarding authoritative-domain lab.local records a nas address '10.x.x.10'
set service dns forwarding authoritative-domain lab.local records a router address '10.x.x.1'

commit
save

Lab hosts can then reach nas.lab.local and router.lab.local by name. Add an entry per service — the domain (lab.local) and the hostnames are entirely up to you.


Pointing Lab Hosts at VyOS

Each lab host needs to use 10.x.x.1 as its DNS server. How you configure this depends on where DHCP is served:

  • If DHCP runs on VyOS — add the name-server option to the subnet. See DHCP Server in VyOS for the full setup; the relevant line is:

    1
    
    set service dhcp-server shared-network-name lab subnet 10.x.x.0/24 name-server '10.x.x.1'
    
  • If DHCP runs elsewhere — set 10.x.x.1 as the DNS server in that DHCP configuration instead.


Verifying

From any lab host, confirm that forwarding and static entries both work:

1
2
3
4
5
# Should return a public A record
dig @10.x.x.1 google.com

# Should return the static IP configured above
dig @10.x.x.1 nas.lab.local

If forwarding is working, google.com resolves via the upstream resolvers. If static entries are working, nas.lab.local returns the IP you set.


What’s Next

  • VRRP redundancy — adding a second VyOS instance for failover
  • BGP peering with Kubernetes — dynamically routing Kubernetes service IPs through VyOS