You are not logged in.

#1 2013-02-23 17:47:52

Joe4711
Member
Registered: 2013-02-23
Posts: 8

Arch doesn't report hostname to dhcpd

Hi!

Since some time Archlinux doesn't report its hostname to my dhcp/dns-server any more. My other Linux Distributions, even my NAS and my laserprinter, do it flawlessly.

Background: If I set up a new linux installation, e.g. an Ubuntu Server in a VM, and I set its hostname to for example "UbuntuServer", it is automagically reported to my DSL router, which provides DNS and DHCP (Fritz Box 7170, I assume it uses dnsmasq). This is very usefull, since I now can resolve this hostname within my whole LAN.

[joe@tower ~]$ host diskstation
diskstation.fritz.box has address 192.168.1.21
[joe@tower ~]$ host ML3051ND
ML3051ND.fritz.box has address 192.168.1.32
[joe@tower ~]$ host ubuntuserver
ubuntuserver.fritz.box has address 192.168.1.24
[joe@tower ~]$ host tower
Host tower not found: 3(NXDOMAIN)

As you can see, it works for my NAS, network printer and Ubuntu, but if I try the very same thing with Archlinux, it does not work - and this is true for several Archs in my network (virtualized and native).

[joe@tower ~]$ sudo hostnamectl set-hostname tower
[joe@tower ~]$ sudo hostnamectl status
   Static hostname: tower
   Pretty hostname: tower
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: <snip>
           Boot ID: <snip>
  Operating System: Arch Linux
            Kernel: Linux 3.7.9-1-ARCH
      Architecture: x86_64

Since I use several Archs via network, I kindoff depend on this feature.

I'd welcome any hints and advices!

Joe

Offline

#2 2013-02-23 23:47:11

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: Arch doesn't report hostname to dhcpd

Maybe you need to edit /etc/dhcpcd.conf? If that's what you are using or equivalent if you are using a different client.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#3 2013-02-24 12:19:57

Joe4711
Member
Registered: 2013-02-23
Posts: 8

Re: Arch doesn't report hostname to dhcpd

Thanks for your reply, cfr! I tried it with both vanilla and edited config files, here some infos about my setup:

[joe@tower ~]$  pacman -Ss dhcpcd
core/dhcpcd 5.6.4-2 (base) [Installed]
    RFC2131 compliant DHCP client daemon

My /etc/dhcpcd.conf is quite vanilla and contains:

...
# Inform the DHCP server of our hostname for DDNS.
hostname
...

which is according to man 5 dhcpcd sufficient:

hostname name
             Sends hostname to the DHCP server so it can be registered in DNS.  
             If hostname is an empty string then the current system hostname is sent.

Furthermore, I replaced core/dhcpcd 5.6.4-2 with extra/dhclient 4.2.4.2-1 and copied
the (vanilla) config file of Ubuntu Server, which perfectly works there.
It still doesn't work on Archlinux!

That means: Both dhcp clients show the same deficient behavior, apparently both are
not able to send the hostname. Yes, it is correctly set in /etc/hostname... 

WTF is going on here!? Nobody else is experiencing this misbehavior? I experience it
with all my Archies. Sure, my router could cause this malfunction, but as I mentioned,
it works flawlessly for NAS, Network-Printer and Ubuntu...

Last edited by Joe4711 (2013-02-24 12:20:15)

Offline

#4 2013-02-24 14:51:09

sano
Member
Registered: 2012-02-11
Posts: 114

Re: Arch doesn't report hostname to dhcpd

I did experience the same, I solved it by creating:

/etc/dhclient.conf

send host-name = gethostname();

Offline

#5 2013-02-26 14:14:01

Joe4711
Member
Registered: 2013-02-23
Posts: 8

Re: Arch doesn't report hostname to dhcpd

sano wrote:

I did experience the same, I solved it by creating:

/etc/dhclient.conf

send host-name = gethostname();

Thanks for your hint! Unfortunatly, this statement was already in effect and didn't help.

May I ask why you use extra/dhclient, and not core/dhcpcd? I assume you weren't able to make dhcpcd work correctly, were you? I think there is a real bug somewhere, and not just a user misconfiguration... Shall I file an official bug report?

Offline

#6 2013-02-26 16:13:12

sano
Member
Registered: 2012-02-11
Posts: 114

Re: Arch doesn't report hostname to dhcpd

Actually I use dhclient because it seems to be faster... But I never really benchmarked it, so that might be just me. So far I didn't see any disadvantages... But dhcpd also worked, just slower.

Sorry I couldn't help you. When I first noticed that my router didn't show my hostname, I spent hours searching the web for solutions and tried almost all of them. I am not sure what was it that made it work in the end - editing dhclient.conf is just the only thing I still remember.

Offline

#7 2013-02-26 21:44:58

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: Arch doesn't report hostname to dhcpd

What happens if you actually specify hostname in the config file? I take it you don't want to do this but it might help narrow down the problem. (That is, is it that it gets the hostname from the system but doesn't send it? Or does it not get anything to send?)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#8 2013-02-26 22:12:32

Joe4711
Member
Registered: 2013-02-23
Posts: 8

Re: Arch doesn't report hostname to dhcpd

The stuff I figured out recently:

  • removing lease files in both /var/lib/dhcpcd/* and /var/lib/dhclient/* didn't help

  • Setting the hostname in /etc/dhcpcd.conf ("hostname testname") didn't help

  • I set up a dnsmasq at another machine, it works!

So: Only the combination of my DSL router box (AVM Fritzbox 7170) and Archlinux doesn't work, which explains why I am the only one who experiences those problems. The box is like seven years old and its dnsmasq accordingly outdated, but I didn't expect any incompatibilities with DHCP implementations... 

Archlinux seems to work fine with other dhcp servers, but my DSL router seems to work with other clients (Ubuntu, SuSE, a Samsung laser printer, a Nokia Smartphone and a Synology NAS are known to work), too. In consideration of those facts you can't blame neither Arch nor the DSL router.

Archlinux seems to do something different than all the other dhcp clients mentioned in that list, but what? I had the idea to capture a dhcp sequence with Wireshark, one triggered with ubuntu, one with Arch, to compare them - I hope this brings some light into this issue! Will report back in one or two days!

Thank you very much for your support so far!

Last edited by Joe4711 (2013-02-26 22:15:53)

Offline

#9 2013-03-04 12:45:03

kahlil88
Member
From: Mendocino, CA
Registered: 2010-08-10
Posts: 138
Website

Re: Arch doesn't report hostname to dhcpd

This problem is related to the systemd transition, I fixed it by adding my hostname to /etc/hosts

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost       tumbleweed
::1             localhost.localdomain   localhost

# End of file

Last edited by kahlil88 (2013-03-04 13:08:01)


There is no system but GNU and Linux is one of its kernels.

Offline

#10 2013-03-05 22:47:46

Joe4711
Member
Registered: 2013-02-23
Posts: 8

Re: Arch doesn't report hostname to dhcpd

kahlil88 wrote:

This problem is related to the systemd transition, I fixed it by adding my hostname to /etc/hosts

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost       tumbleweed
::1             localhost.localdomain   localhost

# End of file

Actually there is a time correlation between transition to systemd and the dhcp problems.
Do you have any further information about what is going wrong there?

Unfortunatly your solution didn't help. Thx anyways!

Offline

#11 2013-03-06 04:04:06

kahlil88
Member
From: Mendocino, CA
Registered: 2010-08-10
Posts: 138
Website

Re: Arch doesn't report hostname to dhcpd

Make sure the dhcpcd service is enabled at startup.

systemctl enable dhcpcd

Last edited by kahlil88 (2013-03-06 10:55:46)


There is no system but GNU and Linux is one of its kernels.

Offline

#12 2013-03-08 13:37:35

Joe4711
Member
Registered: 2013-02-23
Posts: 8

Re: Arch doesn't report hostname to dhcpd

kahlil88 wrote:

Make sure the dhcpcd service is enabled at startup.

That also is already the case.

What do you think, shall I file a bug report?

Offline

#13 2013-03-08 13:39:28

kahlil88
Member
From: Mendocino, CA
Registered: 2010-08-10
Posts: 138
Website

Re: Arch doesn't report hostname to dhcpd

Do you also have the avahi service enabled?


There is no system but GNU and Linux is one of its kernels.

Offline

#14 2013-03-08 19:12:12

bam211
Member
Registered: 2012-01-22
Posts: 11

Re: Arch doesn't report hostname to dhcpd

Joe4711 wrote:
kahlil88 wrote:

Make sure the dhcpcd service is enabled at startup.

That also is already the case.

What do you think, shall I file a bug report?


@Joe4711, I had the same issue and I was using NetworkManager so following entry in /etc/NetworkManager/NetworkManager.conf  solved it for me

dhcp=dhcpcd

Offline

#15 2013-03-08 21:50:05

Joe4711
Member
Registered: 2013-02-23
Posts: 8

Re: Arch doesn't report hostname to dhcpd

kahlil88 wrote:

Do you also have the avahi service enabled?

This actually made it work! (I assumed you cancled your advice, since you removed it from your posting...)

Now, next question: Why does it require avahi and how do I get rid of that dependency?
I don't want to run avahi on every single VM instance I fire up.

And why does my DSL router box require Archlinux to run avahi, but not the dnsmasq daemon I set up for testing purposes?

Thank you very much so far!

Offline

#16 2013-03-08 22:05:37

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: Arch doesn't report hostname to dhcpd

You could try to add "fqdn both" in the dhcpcd config and maybe try to use "tower.fritz.box" as hostname.
Edit: the config file states, that a fritz box may need a clientid, so try to uncomment it.

Last edited by progandy (2013-03-08 22:08:38)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#17 2013-03-08 22:43:25

Joe4711
Member
Registered: 2013-02-23
Posts: 8

Re: Arch doesn't report hostname to dhcpd

progandy wrote:

You could try to add "fqdn both" in the dhcpcd config and maybe try to use "tower.fritz.box" as hostname.
Edit: the config file states, that a fritz box may need a clientid, so try to uncomment it.

Omfg. clientid did the trick! Thank you very very much!

FYI, when problem first occured, I replaced my config file with one of another distribution - hence the comment was gone. Maybe this makes me look less like an idiot...

Offline

#18 2013-03-08 23:11:57

Fixxer
Member
From: Poland
Registered: 2011-08-29
Posts: 210

Re: Arch doesn't report hostname to dhcpd

Show result of:

echo $HOSTNAME

Offline

#19 2013-03-08 23:49:01

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Arch doesn't report hostname to dhcpd

@Fixxer, I think you may not have read through the entire post... as Joe seems to have found his solution.

Joe4711, please mark the thread as [Solved] by editing your first post (this will allow you to edit the title as well).

Offline

#20 2013-03-21 22:32:35

jdkdonk
Member
Registered: 2009-11-23
Posts: 23

Re: Arch doesn't report hostname to dhcpd

After following the many steps/solutions in this thread, I still had a problem with failure to report.  Turns out I had NOT done the following properly:

# hostnamectl set-hostname myhostname 

Set_the_hostname

I realize this thread is getting a bit old, but it was the most relevant to my issue, and I wanted to save this as well.

Offline

#21 2013-11-14 02:29:00

anatolik
Developer
Registered: 2012-09-27
Posts: 458

Re: Arch doesn't report hostname to dhcpd

I had same issue as described here. I have ATT U-verse and ATT forces me to use their 2Wire 3600HGV modem with crappy firmware. ATT forum is full of complains about their DHCP implementation.

Anyway, the modem did not update hostname. It has stuck with "archiso" name for the ip address and never changed to what I have in /etc/hostname. I tried all the suggestions and no luck.

It is weird, because other devices (Android phones, macbook pro, ..) are able to switch the DHCP name. I used tcpdump to find what DHCP request/respond happens between these devices.

# tcpdump -i $NETWORK_DEVICE -vvv -s 1500 '(port 67 or port 68)'

I found that MacBook sends "Netbios-Name-Server, Netbios-Node" and does not send "Static-Routes" DHCP options. So I added following lines to /etc/dhcpcd.conf

option netbios_name_servers 
option netbios_node_type 8
nooption static_routes

I restarted dhcpcd@.service and, woah, modem sees my hostname now! Then I removed these options from /etc/dhcpcd.conf and restarted the service - modem still works fine. I can easily change hostname and modem quickly updates server record. So I believe what I saw is a bug in 2Wire 3600HGV firmware when it stuck the hostname.

Using tcpdump will help you in similar situation.


Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster

Offline

#22 2013-11-14 11:49:44

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: Arch doesn't report hostname to dhcpd

I had same issue as described here. I have ATT U-verse and ATT forces me to use their 2Wire 3600HGV modem with crappy firmware.

I have found instructions on how to root this modem on the internet, that means you could retrieve the login data and replace the modem. I do not want to post any links, but i am sure you can find them for yourself. ( A politician from my country recently suggested to root your modem, in response to beeing forced to use a particular modem :-)

Offline

#23 2013-11-18 04:56:26

thenextdon13
Member
Registered: 2013-01-18
Posts: 58

Re: Arch doesn't report hostname to dhcpd

If using NetworkManager
Since NetworkManager uses dhclient by default rather than dhcpcd, there is the option of telling dhclient to send the hostname rather than converting to use dhcpcd.

Find the dhclient sample config file

[dylan@shoparch ~]$ sudo pacman -Ql dhclient | grep conf  
dhclient /usr/share/dhclient/dhclient.conf.example
dhclient /usr/share/man/man5/dhclient.conf.5.gz

verify you don't already have a dhclient config file

[dylan@shoparch ~]$ sudo ls -l /etc/dhclient.conf 
ls: cannot access /etc/dhclient.conf: No such file or directory

take a look at the file.  I only kept one line of the file and commented the rest out;  here is the important line:

[dylan@shoparch ~]$ head -1 /etc/dhclient.conf 
send host-name = pick-first-value(gethostname(), "ISC-dhclient");

DNS now works right! smile

Offline

Board footer

Powered by FluxBB