Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dhcpcd and hostname in server DNS
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3267
Location: Canada

PostPosted: Wed Dec 21, 2022 5:34 am    Post subject: dhcpcd and hostname in server DNS Reply with quote

So I have this router from my internet provider which serves as DHCP server and pushes itself as as DNS server for a local LAN.

so if I connect my phone, or tablet or Chromcast device, look at the name they are seen by the router, and do
$ dig Chromcast (for example), I get and A record from a router.

Or I can also do

$ dig Chromcast.homenet and it works (given that homenet is what I put as a LAN domain name in the router).

So it all works for my wife's Mac as well

But not for my two Gentoo machines. The answer for DNS query returns empty. The only other machine on the network that has the same issue is HP printer.

Now I can configure on the router static leases based on MAC, where I can put a hostname. Does not help.
Again, with my wife's Mac, if I do that, and give it a name with a static leases, it is properly registered in DNS database.

So, I am thinking that it may somehow do with dhcpcd on Gentoo side. I use dhcpcd to configure the network (no net.eth0 etc scripts), and use plain default configuration.

Anybody has any hint ?
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Wed Dec 21, 2022 10:16 am    Post subject: Reply with quote

Please post the output of
Code:

hostname

Also in dhcpcd.conf add
Code:

hostname_short

See
Quote:

hostname name
Sends the hostname name to the DHCP server so it can be registered in DNS. If name is an empty string
then the current system hostname is sent. If name is a FQDN (i.e., contains a .) then it will be en‐
coded as such.

hostname_short
Sends the short hostname to the DHCP server instead of the FQDN. This is useful because DHCP servers
will not register the FQDN in their DNS if the domain part does not match theirs.

Also, see the env option above to control how the hostname is set on the host.



from
man dhcpcd.conf
_________________
:)
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3267
Location: Canada

PostPosted: Thu Dec 22, 2022 1:40 am    Post subject: Reply with quote

Thanks !

I did put hostname_short as per your advice and dhcpcd.conf, iI is better for my use case in the future, but the issue seems to be on router side after all
It looks like if you do some reconfiguration of the router and it sees the hostname already present in the DNS base, it creates a new DNS entry for hostname-2.

So here is my example

on Gentoo box
Code:

$ hostname
polarbear


on router 192.168.1.254 side list devices shows....
Code:

polarbear   192.168.1.10   00:1a:4d:49:b3:d9   Ethernet Port3     ....


but back to outside on LAN

Code:

$ dig polabear

; <<>> DiG 9.16.33 <<>> polarbear
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47426
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;polarbear.                     IN      A

;; Query time: 185 msec
;; SERVER: 192.168.1.254#53(192.168.1.254)
;; WHEN: Wed Dec 21 18:05:43 MST 2022
;; MSG SIZE  rcvd: 38


returns zero answer, while
Code:

$dig polarbear-2


; <<>> DiG 9.16.33 <<>> polarbear-2
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7079
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;polarbear-2.                   IN      A

;; ANSWER SECTION:
polarbear-2.            0       IN      A       192.168.1.10

;; Query time: 81 msec
;; SERVER: 192.168.1.254#53(192.168.1.254)
;; WHEN: Wed Dec 21 18:06:47 MST 2022
;; MSG SIZE  rcvd: 56


returns the proper DNS entry


For my Gentoo laptop 'grizzly' router decided to call wireless interface grizzly-2, while grizzly was used for ethernet.
Well, this I could at least understand, since it is dealing with two interfaces, but polarbear has only once. I guess at some stage of set up when I was moving from dynamic to static leases, it got registered as a second instance and got -2 suffix (which is now difficult to get rid of, I guess I need to make router forget about this computer somehow).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum