Sorry for the wrong wording: what I want is the DHCP client to send the hostname when a lease is requested, but I do not want to give dhclient any explicit hostname to be sent.
I want dhclient to read the hostname from `hostname` or from /etc/sysconfig/network or any other way, and use that name to send the hostname to DHCP server.
DHCP_HOSTNAME=$(hostname -s)
On 02.12.2011 13:25, Александр Кириллов wrote:
Sorry for the wrong wording: what I want is the DHCP client to send the hostname when a lease is requested, but I do not want to give dhclient any explicit hostname to be sent.
I want dhclient to read the hostname from `hostname` or from /etc/sysconfig/network or any other way, and use that name to send the hostname to DHCP server.
DHCP_HOSTNAME=$(hostname -s)
Yes, thank you.
Unfortunately I find that if I ever use the GUI tool (system-config-network) to configure network than the '$' there gets automatically escaped on save ! :)
The back tick form of shell command substitution is preserved though, so I can write: DHCP_HOSTNAME=`hostname -s`
For some strange reasone, when I do that, I get 'host name lookup failure' during `service network restart´ invocation, so in the end I resorted to using just: DHCP_HOSTNAME=`hostname` which seems to work properly until now, and now my router can see the computer names for its DHCP clients, which is a big step compared to seeing just the MAC address. :)
Thank you, Timothy Madden
Timothy Madden wrote:
On 02.12.2011 13:25, ÐлекÑÐ°Ð½Ð´Ñ ÐиÑиллов wrote:
Sorry for the wrong wording: what I want is the DHCP client to send the hostname when a lease is requested, but I do not want to give dhclient any explicit hostname to be sent.
I want dhclient to read the hostname from `hostname` or from /etc/sysconfig/network or any other way, and use that name to send the hostname to DHCP server.
DHCP_HOSTNAME=$(hostname -s)
<snip>
For some strange reasone, when I do that, I get 'host name lookup failure' during `service network restart´ invocation, so in the end I resorted to using just: DHCP_HOSTNAME=`hostname` which seems to work properly until now, and now my router can see the computer names for its DHCP clients, which is a big step compared to seeing just the MAC address. :)
I haven't closely followed this thread - did someone mention just putting HOSTNAME= in /etc/sysconfig/network?
mark
On 02.12.2011 16:59, m.roth@5-cent.us wrote:
Timothy Madden wrote:
On 02.12.2011 13:25, Александр Кириллов wrote:
[...]
For some strange reasone, when I do that, I get 'host name lookup failure' during `service network restart´ invocation, so in the end I resorted to using just: DHCP_HOSTNAME=`hostname` which seems to work properly until now, and now my router can see the computer names for its DHCP clients, which is a big step compared to seeing just the MAC address. :)
I haven't closely followed this thread - did someone mention just putting HOSTNAME= in /etc/sysconfig/network?
Yes, this thread actually starts at nntp://news.gmane.org/gmane.linux.centos.general/120489
I have the 'HOSTNAME= ' line in /etc/sysconfig/network, and the DHCP client still does not send the hostname to the DHCP server on start-up. So my router never knows my computer name.
The point was how to tell DHCP client to send the *current* hostname to the server, instead of hard-coding the hostname in the dhclient configuration file.
Timothy Madden