How can I stop sending my hostname via DHCP?

5,230

you can do it.

send host-name = gethostname();

This statement actually getting the host name of the system from the return value of function.

you can set it manually to some other name if you want.

send host-name =olathe ;

to send no host name: send host-name = ;

Share:
5,230

Related videos on Youtube

Olathe
Author by

Olathe

Updated on September 18, 2022

Comments

  • Olathe
    Olathe over 1 year

    Ubuntu sends my computer's configured hostname to any DHCP server it tries to use. How do I stop it from sending a hostname?

    • Rinzwind
      Rinzwind over 10 years
      What is the version of your dhcp client? If dhcp3 see the config in ` /etc/dhcp3. It has a setting like this send host-name "<hostname>";`
    • Olathe
      Olathe over 10 years
      @Rinzwind, I'm using whatever the standard Ubuntu client is. It appears that there's an /sbin/dhclient which is probably it with a version isc-dhclient-4.2.4. While there's no /etc/dhcp3, there is an etc/dhcp/dhclient.conf with a comment Configuration file for /sbin/dhclient, which is included in Debian's dhcp3-client package. and with the line send host-name = gethostname();. Would commenting out that line stop it or do I have to change it to something to avoid it doing something like sending a default hostname if there's nothing configured?
    • Rinzwind
      Rinzwind over 10 years
      I would assume yes :D (sorry, can not test it because I only have access to production servers at the moment ;) ).
  • Olathe
    Olathe over 10 years
    Is there a way to get it to send no host name rather than a custom one?
  • mx7
    mx7 over 10 years
    @Olathe edited last ,: 0
  • WesDec
    WesDec about 10 years
    This does not seem to work in ubuntu 12.10. I tried to set "send host-name = ;" in "etc/dhcp/dhclient.conf" but my hostname is still sent.