LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (http://www.linuxquestions.org/questions/fedora-35/)
-   -   How to check DHCP_HOSTNAME is being sent/used ? (http://www.linuxquestions.org/questions/fedora-35/how-to-check-dhcp_hostname-is-being-sent-used-793947/)

stryker_oz 03-08-2010 07:06 AM

How to check DHCP_HOSTNAME is being sent/used ?
 
Hi,

I've recently installed FC12 and would like to leave this PC setup to grab an IP via DHCP. I use BackupPC so it needs to have a dhcp_hostname set so the machine can be located for backing up, and all that appears right however BackupPC can't find it.

When I run Angry IP Scanner, the hostname shows as N/A. Is this possibly a function of SELinux? In contrast, my FC11 box shows a hostname but I don't run SELinux on it.

How can I check for certain that the machine is submitting its hostname when it requests an IP?

Thanks

crabboy 03-08-2010 09:06 AM

Look at the command line options used for dhcp.
Code:

#ps -ef | grep dhcp

root      3226    1  0 08:56 ?        00:00:00 /sbin/dhcpcd -t 10 -h animal eth0

You if the -h <hostname> is present, then hdcpcd is sending the hostname, but that does not necessary meant that it is not. See the -h option entry in the man page below:
Quote:

-h, --hostname hostname
By default, dhcpcd will send the current hostname to the DHCP
server so it can register in DNS. You can use this option to
specify the hostname sent, or an empty string to stop any
hostname from being sent.

stryker_oz 03-09-2010 02:38 AM

It is providing the hostname, but still doesn't advertise them on the network
 
Thanks for the tip, crabboy. It got me aimed in the right direction, but still puzzled. Firstly, the result of that grep showed a completely different process running
Code:

root      2546  1228  0 18:15 ?        00:00:00 /sbin/dhclient -d -sf /usr/libexec/nm-dhcp-client.action -pf /var/run/dhclient-eth0.pid -lf /var/lib/dhclient/dhclient-47350821-f9cf-478f-8421-0e9cda61ba5b-eth0.lease -cf /var/run/nm-dhclient-eth0.conf eth0
root      2641  2010  0 18:27 pts/0    00:00:00 grep dhcp

But I ran that same query on my DHCP server and it does run it. Then when I cat'd dhcpd.leases it proved that the hostname and the MAC address are being set correctly.

Incidentally, the result of arp --all on the same box shows the correct MAC at the IP to identify the FC12 box, but no hostname (same result for that IP on my FC11 box). I'm not sure if that's significant.

So...why doesn't the FC12 box advertise its Hostname, Comp Name or MAC address when probed? Is it something in SELinux? I've had a scout through the booleans and can't see anything that fits the bill...yet.

Thanks again !

crabboy 03-09-2010 08:39 AM

Have you read the Dynamic DNS section of the dhclient.conf man page? It has about a page worth of info regarding updating the DNS. It sounds like you do have control over your DNS, so you may be in luck. All our RH boxes I found in our shop have static IPs, so I can't play around with the dhclient config. The example I sent you before,using dhcpcd, was from a slack box.

Just the first part:
Code:

DYNAMIC DNS
      The client now has some very limited support for doing DNS updates when
      a  lease  is  acquired.  This is prototypical, and probably doesn't do
      what you want.  It also only works if you happen to have control  over
      your DNS server, which isn't very likely.


stryker_oz 03-10-2010 05:40 AM

Inching closer to a resolution...maybe
 
Hi,

Thanks again for another great suggestion. I'm starting to think chasing a DNS was maybe a red herring since we are talking about a machine on our local LAN rather than one that's broadcasting to the world. Therefore dynamic DNS also won't be the answer.

I've confirmed the DHCP server is receiving the hostname and MAC address correctly (it's written into the logs and the leases file) of the DHCP server. Today I've enabled WINS resolution through SMB and NMB on the FC12 box and I can browse my network from XP and see the FC12 box is there.

Strangely, the Angry scanner doesn't see the workgroup name though. It's still like this FC12 machine is keeping everything to itself!

The result of /usr/bin/nmblookup -A xxx.xxx.xxx.xxx correctly finds the hostname. Use the machine hostname rather than its IP and it won't find it of course (and that's how BackupPC does it).

Unfortunately the machines being backed up by BackupPC with DHCP are all Windoze of various flavors so I don't have a prototype to check, only confirmation it is possible. The other Linux boxes being backed up are static...I was hoping not to have to do that, but it might have to be my fallback position for expediency.

I welcome any thoughts or suggestions...thanx

crabboy 03-10-2010 08:13 AM

What type of DNS and dhcp servers do you have? Windows?

Our network at work is fairly UNIX hostile, we have Windows AD servers and Win DNS. The DNS has never worked with the Linux or AIX machines. We get around it by either creating static leases in the DHCP or static IPs and put static entries in the DNS. The Windows admins don't care enough to get this working correctly.

stryker_oz 03-10-2010 04:55 PM

DHCP and DNS
 
HI again

DHCP is provided by a smoothwall (linux derivative) firewall which also runs a DNS proxy. When I looked further into DNS I had thought smoothwall provided that too, but it's actually only a DNS cache so I'm uncertain it gives the functionality I presumed.

After finding that I was considering setting up one of the linux boxes to provide DNS (one that is the master WINS name server via SAMBA)...but after consideration I'm now thinking going to static on this client might be the simple, faster, if less elegant way to go since there's only one.

It does bug me the windows clients do this seemingly by default and yet I've not been able to find out a reason for what looks like a perfectly healthy and well behaved FC12 box not...but this mystery might have to remain unsolved, at least for now.

Thanx for your helpful suggestions! I'll post if I find the answer in future.


All times are GMT -5. The time now is 07:11 PM.