When I do a DNS query from a client, the VyOS router successfully returns the addresses for DHCP clients and also results from the main DNS Server on my network. However if I query the VyOS router itself, it returns a loopback address. So ‘pinging’ it is pretty successful!
I have tried using a static-host-mapping but I am guessing this appears after the loopback entry in /etc/hosts.
I am using the loopback address as the source for services, so it would be nice if I can make this work, without giving the VyOS router a different hostname as a workaround. TIA
The issue I think is in the /etc/hosts file with these two lines…
> 127.0.1.1 vyos.local vyos
> 10.20.30.1 vyos
The DNS reply as shown above, returns the first line when I would like it to return the second one based on the static-host-mapping I put in the config file. I don’t think DNS servers should really reply to any query with a loopback address.
Trimmed config below;
> interfaces {
> loopback lo {
> address 10.20.30.1/32
> }
> }
> service {
> dns {
> forwarding {
> allow-from 10.20.30.0/23
> cache-size 0
> listen-address 10.20.30.1
> system
> }
> }
> }
> system {
> domain-name local
> domain-search {
> domain local
> }
> host-name vyos
> name-server 10.20.29.1
> static-host-mapping {
> host-name vyos {
> inet 10.20.30.1
> }
> }
> }
>
> me@vyos:~$ more /etc/hosts
> ### Autogenerated by VyOS ###
> ### Do not edit, your changes will get overwritten ###
>
> # Local host
> 127.0.0.1 localhost
> 127.0.1.1 vyos.local vyos
>
> # From 'system static-host-mapping' and DHCP server
> # system
> 10.20.30.1 vyos
These are the relevant commands from above. Is this what you meant?
If you need the whole config, I will modify it to remove the other things I have been testing, confirm the issue remains, and resubmit, although I believe the issue is just in the way the host file is checked. My working box does the same thing. Cheers.
set interfaces loopback lo address '10.20.30.1/32'
set service dns forwarding allow-from '10.20.30.0/23'
set service dns forwarding cache-size '0'
set service dns forwarding listen-address '10.20.30.1'
set service dns forwarding system
set system domain-name 'local'
set system domain-search domain 'local'
set system host-name 'vyos'
set system name-server '10.20.29.1'
set system static-host-mapping host-name vyos inet '10.20.30.1'
set interfaces loopback lo address '10.20.30.1/32'
set service dns forwarding allow-from '10.20.30.0/23'
set service dns forwarding authoritative-domain vyos.local records a vyos address '10.20.30.1'
set service dns forwarding cache-size '0'
set service dns forwarding ignore-hosts-file
set service dns forwarding listen-address '10.20.30.1'
set service dns forwarding system
set system domain-name 'local'
set system domain-search domain 'local'
set system host-name 'vyos'
set system name-server '10.20.29.1'
Looks like I might need to upgrade. I chose equuleus as it seemed to be the current stable release. The authoritive-domain option doesn’t seem to be present.
This morning I decided to try a workaround of removing the system domain-name and changing the static-host-mapping to include the domain name.
<TLDR> This workaround appears to make everything function the way I would expect.
The existing domain-search is probably the key part of this workaround.
> set system domain-search domain 'local'
The system fingerprints (for ssh etc) didn’t change the way some other devices like those from Cisco would.
<TLDR> Anyone able to tell me how and/or where VyOS actually uses it’s ‘system domain-name’ to help me assess any potential impact(s) of this workaround?
> delete system domain-name 'local'
> delete system static-host-mapping host-name vyos
> set system static-host-mapping host-name vyos.local inet '10.20.30.1'
>
> me@vyos:~$ more /etc/hosts
> ### Autogenerated by VyOS ###
> ### Do not edit, your changes will get overwritten ###
>
> # Local host
> 127.0.0.1 localhost
> 127.0.1.1 vyos
>
> # From 'system static-host-mapping' and DHCP server
> # system
> 10.20.30.1 vyos.local
>
>
>
> [me@guest:~]$ nslookup vyos
> Server: 10.20.30.1
> Address: 10.20.30.1:53
>
> Non-authoritative answer:
> Name: vyos.local
> Address: 10.20.30.1
>
> Non-authoritative answer:
>
> [me@guest:~]$ nslookup vyos.local
> Server: 10.20.30.1
> Address: 10.20.30.1:53
>
> Non-authoritative answer:
> Name: vyos.local
> Address: 10.20.30.1
>
> Non-authoritative answer: