3

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.

0

1 Answer 1

5

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
2
  • 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?" :-) Jul 19, 2014 at 20:32
  • vi came naturally :) but I agreed.. instructions could have been explained better.
    – Raza
    Jul 19, 2014 at 23:21

You must log in to answer this question.