Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In linux, when my machine requests an IP address it also sends the hostname back to the DHCP server. How can I stop my machine from sending back this hostname?

I use dhclient, possibly via NetworkManager.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You can find host-name in dhcp client configuration to remove or add hostname.

For example:

Debian / Ubuntu Linux - /etc/dhcp3/dhclient.conf

$ sudo vi /etc/dhcp3/dhclient.conf

Set hostname as you need on the following line: send host-name "yourhostname";

RHEL / Fedora / CentOS Linux - /etc/sysconfig/network-scripts/ifcfg-eth0 (for 1st DHCP network interface)

Open configuration file, enter:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Append hostname as you need on the following line :

DHCP_HOSTNAME=yourhostname

It is also possible for NetworkManager to send the hostname; see /etc/NetworkManager/NetworkManager.conf looking for:

[keyfile]
hostname=your_hostname
share|improve this answer
    
As a side note, I find it funny that you gave specific instructions to use vi to edit those files instead of just saying they have to be edited and letting the readers decide how to do it. Maybe they prefer nano. Suggesting vi can lead to questions like "How do I quit from Vi?" :-) –  Cristian Ciupitu Jul 19 at 20:32
    
vi came naturally :) but I agreed.. instructions could have been explained better. –  Raza Jul 19 at 23:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.