Page MenuHomeVyOS Platform

Router resolves as 127.0.1.1 when using Router's Recursive DNS
Closed, ResolvedPublicBUG

Description

Hi,

When using the router's local instance of pdns as the DNS resolver for clients, the hostname configured for the router is resolved as 127.0.1.1
This makes it impossible to SSH or SNMP monitor the router using its DNS name.

set system host-name 'ferrari'
set system domain-name '<mydomain>.com'
tim@ferrari# show interfaces ethernet eth1 | commands
set address '192.168.0.1/24'

[edit service dns forwarding]
tim@ferrari# show | commands
set allow-from '192.168.0.0/24'
set allow-from '10.1.1.0/24'
set cache-size '8192'
set listen-address '192.168.0.1'
set name-server 'x.x.x.39'
set name-server 'x.x.x.40'


set host-name ferrari.<mydomain>.com inet '192.168.0.1'

DNS lookup from a Unix client

{16:38}~ ➭ dig @192.168.0.1 ferrari.<mydomain>.com

; <<>> DiG 9.11.5-P4-5.1-Debian <<>> @192.168.0.1 ferrari.<mydomain>.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 692
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;ferrari.<mydomain>.com.           IN      A

;; ANSWER SECTION:
ferrari.<mydomain>.com.    86400   IN      A       127.0.1.1

;; Query time: 0 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Mon Apr 13 16:38:43 NZST 2020
;; MSG SIZE  rcvd: 64

It would be better if the DNS name of the router as configured in static-host-mapping could be returned.

Details

Difficulty level
Unknown (require assessment)
Version
1.3-rolling-202004110117
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

jjakob changed the task status from Open to In progress.Jun 8 2020, 7:29 PM
jjakob claimed this task.
jjakob triaged this task as Normal priority.
erkin set Issue type to Bug (incorrect behavior).Aug 30 2021, 7:09 AM
erkin removed a subscriber: Active contributors.
Viacheslav added a project: VyOS 1.5 Circinus.
Viacheslav added a subscriber: jjakob.

It looks working on VyOS 1.5-rolling-202404260019

set system domain-name 'vyos.local'
set system host-name 'r4'
set system static-host-mapping host-name r4.vyos.local inet '100.64.0.14'

set service dns forwarding allow-from '100.64.0.0/24'
set service dns forwarding listen-address '100.64.0.14'
set service dns forwarding name-server 1.1.1.1
set service dns forwarding name-server 8.8.8.8

check:

vyos@r1-right:~$ dig +short @100.64.0.14 r4.vyos.local
100.64.0.14
vyos@r1-right:~$

The same works on VyOS 1.4-stable-202404120309

set system domain-name 'example.local'
set system host-name 'r15'
set system static-host-mapping host-name r15.example.local inet '192.168.122.15'

set service dns forwarding allow-from '192.168.122.0/24'
set service dns forwarding listen-address '192.168.122.15'
set service dns forwarding name-server 1.1.1.1
set service dns forwarding name-server 8.8.8.8

Check:

vyos@r1-right:~$ dig +short @192.168.122.15 r15.example.local
192.168.122.15
vyos@r1-right:~$

Most likely was fixed in https://vyos.dev/T4270
For 1.3.6 still bug

vyos@r4:~$ dig +short @192.168.122.11 r1.example.local 
127.0.1.1
vyos@r4:~$

The template https://github.com/vyos/vyos-1x/blob/a5f847beab098f6d316f7c925509c7aa9a76e21f/data/templates/vyos-hostsd/hosts.tmpl#L6