Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Host name not broadcast to DHCP

Linux Kernel, Network, and Services configuration.
Message
Author
Kevin Seise
Posts: 133
Joined: 2009-09-12 13:21
Location: New Jersey, USA

Host name not broadcast to DHCP

#1 Post by Kevin Seise »

I have setup a few machines within my house. The Debian Squeeze machines do not provide a host name in the DHCP client list on my router. Strangely, my Ubuntu, Android, and Blackberry machines do show host names. I have noticed the same behavior when wirelessly tethering my Debian laptop to my Android phone (which also uses DHCP). Is there something I need to enable to have the name show up on the router?

chpln
Posts: 27
Joined: 2010-08-12 09:18
Location: Australia

Re: Host name not broadcast to DHCP

#2 Post by chpln »

The easiest way to resolve this may be to use dhcpcd over ddclient. I believe the former sends the hostname of the client by default.

Kevin Seise
Posts: 133
Joined: 2009-09-12 13:21
Location: New Jersey, USA

Re: Host name not broadcast to DHCP

#3 Post by Kevin Seise »

I actually have dhcp3-client installed. I guess that is the default setup. I edited the /etc/dhclient.conf file to broadcast the host-name and restarted the dhclient package, but that didn't work. Any other ideas?

chpln
Posts: 27
Joined: 2010-08-12 09:18
Location: Australia

Re: Host name not broadcast to DHCP

#4 Post by chpln »

Sorry, ddclient was a typo on my part. It was meant to read dhcp3-client.

User avatar
ripat
Posts: 106
Joined: 2009-12-06 08:46
Location: Belgium

Re: Host name not broadcast to DHCP

#5 Post by ripat »

First install the tcpdump package from the repo if not installed yet. Then, open a console and run as root:

Code: Select all

# tcpdump -vvvn port bootps
In another console run:

Code: Select all

# dhclient -v
And post the result of the tcpdump here.
I'll try to be a native english speaker... in my next life!

User avatar
drokmed
Posts: 1162
Joined: 2007-10-03 19:24
Location: Saint Petersburg, FL

Re: Host name not broadcast to DHCP

#6 Post by drokmed »

and

Code: Select all

# cat /etc/hostname
Author of the Debian Linux Security Appliance Firewall howto, found here
Thread discussing it is here

Kevin Seise
Posts: 133
Joined: 2009-09-12 13:21
Location: New Jersey, USA

Re: Host name not broadcast tobl DHCP

#7 Post by Kevin Seise »

ripat wrote:First install the tcpdump package from the repo if not installed yet. Then, open a console and run as root:

Code: Select all

# tcpdump -vvvn port bootps
In another console run:

Code: Select all

# dhclient -v
And post the result of the tcpdump here.
I think the second command forced my box to change its ip address from the static ip I had set and pickup a new address from the DHCP server. Once I found it again, I got the following results:

Code: Select all

# tcpdump -vvvn port bootps
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes

Code: Select all

# cat /etc/hostname
blackbox
which is correct.

rebooting puts the system back at the right address, but everytime I run dhclient -v, the machine switches ip addresses and I lose connection.

Kevin Seise
Posts: 133
Joined: 2009-09-12 13:21
Location: New Jersey, USA

Re: Host name not broadcast to DHCP

#8 Post by Kevin Seise »

Disregard my last post. I suddenly realized the need to run the commands locally.

Code: Select all

# tcpdump -vvvn port bootps
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
20:27:57.003964 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
    0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 00:1f:c6:0d:88:c9, length 300, xid 0x67ab347c, Flags [none] (0x0000)
	  Client-Ethernet-Address 00:1f:c6:0d:88:c9
	  Vendor-rfc1048 Extensions
	    Magic Cookie 0x63825363
	    DHCP-Message Option 53, length 1: Request
	    Requested-IP Option 50, length 4: 192.168.2.11
	    Hostname Option 12, length 8: "blackbox"
	    Parameter-Request Option 55, length 13: 
	      Subnet-Mask, BR, Time-Zone, Default-Gateway
	      Domain-Name, Domain-Name-Server, Option 119, Hostname
	      Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
	      NTP
	    END Option 255, length 0
	    PAD Option 0, length 0, occurs 25
20:27:57.005234 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 314)
    192.168.2.1.67 > 192.168.2.11.68: [udp sum ok] BOOTP/DHCP, Reply, length 286, xid 0x67ab347c, Flags [none] (0x0000)
	  Your-IP 192.168.2.11
	  Client-Ethernet-Address 00:1f:c6:0d:88:c9
	  Vendor-rfc1048 Extensions
	    Magic Cookie 0x63825363
	    DHCP-Message Option 53, length 1: ACK
	    Server-ID Option 54, length 4: 192.168.2.1
	    Lease-Time Option 51, length 4: 86400
	    Subnet-Mask Option 1, length 4: 255.255.255.0
	    Default-Gateway Option 3, length 4: 192.168.2.1
	    Domain-Name-Server Option 6, length 16: 192.168.2.1,208.67.222.222,208.67.220.220,167.206.245.130
	    END Option 255, length 0
20:27:57.005730 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 314)
    192.168.2.1.67 > 192.168.2.11.68: [udp sum ok] BOOTP/DHCP, Reply, length 286, xid 0x67ab347c, Flags [none] (0x0000)
	  Your-IP 192.168.2.11
	  Client-Ethernet-Address 00:1f:c6:0d:88:c9
	  Vendor-rfc1048 Extensions
	    Magic Cookie 0x63825363
	    DHCP-Message Option 53, length 1: ACK
	    Server-ID Option 54, length 4: 192.168.2.1
	    Lease-Time Option 51, length 4: 86400
	    Subnet-Mask Option 1, length 4: 255.255.255.0
	    Default-Gateway Option 3, length 4: 192.168.2.1
	    Domain-Name-Server Option 6, length 16: 192.168.2.1,208.67.222.222,208.67.220.220,167.206.245.130
	    END Option 255, length 0
20:29:17.002491 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
    0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 00:1f:c6:0d:88:c9, length 300, xid 0xdf4d2b41, Flags [none] (0x0000)
	  Client-Ethernet-Address 00:1f:c6:0d:88:c9
	  Vendor-rfc1048 Extensions
	    Magic Cookie 0x63825363
	    DHCP-Message Option 53, length 1: Request
	    Requested-IP Option 50, length 4: 192.168.2.11
	    Hostname Option 12, length 8: "blackbox"
	    Parameter-Request Option 55, length 13: 
	      Subnet-Mask, BR, Time-Zone, Default-Gateway
	      Domain-Name, Domain-Name-Server, Option 119, Hostname
	      Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
	      NTP
	    END Option 255, length 0
	    PAD Option 0, length 0, occurs 25
20:29:17.003751 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 314)
    192.168.2.1.67 > 192.168.2.11.68: [udp sum ok] BOOTP/DHCP, Reply, length 286, xid 0xdf4d2b41, Flags [none] (0x0000)
	  Your-IP 192.168.2.11
	  Client-Ethernet-Address 00:1f:c6:0d:88:c9
	  Vendor-rfc1048 Extensions
	    Magic Cookie 0x63825363
	    DHCP-Message Option 53, length 1: ACK
	    Server-ID Option 54, length 4: 192.168.2.1
	    Lease-Time Option 51, length 4: 86400
	    Subnet-Mask Option 1, length 4: 255.255.255.0
	    Default-Gateway Option 3, length 4: 192.168.2.1
	    Domain-Name-Server Option 6, length 16: 192.168.2.1,208.67.222.222,208.67.220.220,167.206.245.130
	    END Option 255, length 0
20:29:17.004220 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 314)
    192.168.2.1.67 > 192.168.2.11.68: [udp sum ok] BOOTP/DHCP, Reply, length 286, xid 0xdf4d2b41, Flags [none] (0x0000)
	  Your-IP 192.168.2.11
	  Client-Ethernet-Address 00:1f:c6:0d:88:c9
	  Vendor-rfc1048 Extensions
	    Magic Cookie 0x63825363
	    DHCP-Message Option 53, length 1: ACK
	    Server-ID Option 54, length 4: 192.168.2.1
	    Lease-Time Option 51, length 4: 86400
	    Subnet-Mask Option 1, length 4: 255.255.255.0
	    Default-Gateway Option 3, length 4: 192.168.2.1
	    Domain-Name-Server Option 6, length 16: 192.168.2.1,208.67.222.222,208.67.220.220,167.206.245.130
	    END Option 255, length 0

and then

Code: Select all

dhclient -v
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:1f:c6:0d:88:c9
Sending on   LPF/eth0/00:1f:c6:0d:88:c9
Sending on   Socket/fallback
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 192.168.2.1
bound to 192.168.2.11 -- renewal in 39512 seconds.
and

Code: Select all

#cat /etc/hostname
blackbox
Obviously the hostname is blackbox. It should be set to a static ip of 192.168.2.2.

User avatar
ripat
Posts: 106
Joined: 2009-12-06 08:46
Location: Belgium

Re: Host name not broadcast to DHCP

#9 Post by ripat »

Where do you define the static ip of your "blackbox"? In the /etc/network/interfaces file or on the router?
I'll try to be a native english speaker... in my next life!

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

Re: Host name not broadcast to DHCP

#10 Post by llivv »

both
you set the computer static IP address in
/etc/network/interfaces
to an IP address that is available from the router
but is not in the routers DHCP pool of IP addresses...
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.

Kevin Seise
Posts: 133
Joined: 2009-09-12 13:21
Location: New Jersey, USA

Re: Host name not broadcast to DHCP

#11 Post by Kevin Seise »

Thank you both! I had set it up in /etc/network/interfaces during the initial installation and made sure that it was there. I just went back in to the router to verify what livv had said and found the correct location within the router to set a static IP. Strangely, I didn't have to do that in Ubuntu. This setup has worked for about 4 years. I had set the DHCP client list to start above the range I wanted my static clients to be on so that if something knocked a static client off, I would only have to fix one connection. I set the static IP on the router and now I am good to go. Everything is working perfectly! Thank you! :D

User avatar
ripat
Posts: 106
Joined: 2009-12-06 08:46
Location: Belgium

Re: Host name not broadcast to DHCP

#12 Post by ripat »

You can also force your DHCP server to allocate the same IP to one machine based on its MAC address. In that case you keep the iface eth0 inet dhcp line in the interfaces file. Doing that will force your machine to send the DHCP request containing your hostname (Option 12 in the tcpdump that shows that the hostname is correctly sent) to the router/DHCP server. This said, the hostnames from your other devices might be broadcasted by another multicast service like Bonjour or Avahi that could not be running on your Debian.

Edit:

Sorry didn't notice you solved the problem. Well done!
I'll try to be a native english speaker... in my next life!

Kevin Seise
Posts: 133
Joined: 2009-09-12 13:21
Location: New Jersey, USA

Re: Host name not broadcast to DHCP

#13 Post by Kevin Seise »

ripat,
Thanks for responding. I was leaving this marked as unsolved because this only fixes one issue with one router. I run into the same problem with a laptop which I carry around all the time. Your suggestion of avahi is intriguing and I will give it a shot. The avahi-daemon package is already installed, but I will have to play around a bit to see what works. It will be a few days before I can try it out.

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

Re: Host name not broadcast to DHCP

#14 Post by llivv »

with a roaming laptop the /etc/network/interfaces config is a bit different

I don't use it so I'm only parroting what I've read in the forum

instead of
auto eth0
it's
allow-hotplug eth0

their are others changes that need to be made to the config, but iirc you can setup roaming in the interfaces file...
there may still be some instructions at
/usr/share/doc/ifupdown/examples
Last edited by llivv on 2010-12-23 15:22, edited 1 time in total.
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.

Kevin Seise
Posts: 133
Joined: 2009-09-12 13:21
Location: New Jersey, USA

Re: Host name not broadcast to DHCP

#15 Post by Kevin Seise »

llivv wrote:with a roaming laptop the /etc/network/interfaces config is a bit different

I don't use it so I'm only parroting what I've read in the forum

instead of
auto eth0
it's
allow-hotplug eth0

their are others changes that need to be made to the config, but iirc you can setup roaming in the interfaces file...
Thank you. The roaming part is configured correctly during the install, it is only the hostname broadcast that doesn't happen. When I am on someone elses router, I show up as * and not the hostname. The actual networking works fine though.

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

Re: Host name not broadcast to DHCP

#16 Post by llivv »

then you're all set .. unless you really need to know why the hostname is not sent to the router..
up&p package?
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.

Kevin Seise
Posts: 133
Joined: 2009-09-12 13:21
Location: New Jersey, USA

Re: Host name not broadcast to DHCP

#17 Post by Kevin Seise »

Well, I appreciate the help in getting this to work, but I would love to find out the reason this isn't working the way I expected it to. I am a convert from Ubuntu and I suspect you may see more people coming from Ubuntu and looking for the same answer. If we can figure it out, we can prevent a bunch of similar questions from popping up.

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

Re: Host name not broadcast to DHCP

#18 Post by llivv »

Yeah I read that above, it may be that you are expecting something .... up&p
debian doesn't do by default... But I'm not exactly sure... How badly do you need to know?
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.

Kevin Seise
Posts: 133
Joined: 2009-09-12 13:21
Location: New Jersey, USA

Re: Host name not broadcast to DHCP

#19 Post by Kevin Seise »

I will poke around with the up&p stuff. Since you solved my problem, I am all set. Thank you for the help. If I find that the upnp stuff works, I will post the result and mark this as solved.

User avatar
ripat
Posts: 106
Joined: 2009-12-06 08:46
Location: Belgium

Re: Host name not broadcast to DHCP

#20 Post by ripat »

I just did a little bit of packet sniffing and watched what happens when I start-up my netbook with Ubuntu. It sends udp packets to a multicast address 224.0.0.251.5353 which is the multicast address used for mDNS. Then I did the opposite: sniffed on the netbook when my Debian (Squeeze) laptop starts up. Exactly the same kind of packets. It's the avahi-daemon who's in charge of network discovery and stuff.

Check if your daemon is listening:

Code: Select all

# netstat -taupe | grep mdns
udp        0      0 *:mdns                  *:*                                 avahi      5228        1367/avahi-daemon: 
udp6       0      0 [::]:mdns               [::]:*                              avahi      5229        1367/avahi-daemon:

# netstat -taupen | grep 5353
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           105        5228        1367/avahi-daemon: 
udp6       0      0 :::5353                 :::*                                105        5229        1367/avahi-daemon: 
Besides IGMP and mDNS packets I didn't observe any other multicast packets.

Can you also post the result of the following command on your Debian and on your Ubuntu (as root):

Code: Select all

# netstat -g 
and

Code: Select all

# netstat -ng 
Merry Xmas to all.
I'll try to be a native english speaker... in my next life!

Post Reply