Am am currently visiting TU Wien and today I connected my Debian Linux laptop to their eduroam wlan using wpa_supplicant and the credentials of my home institute – as always when I am visiting another scientific institution.
When I opened a terminal I noticed that my command promt was showing a different host name, and in fact, excecuting hostname gave me e244-082.eduroam.tuwien.ac.at instead of the usual host name of my machine x301.
I am very puzzled by this. How on earth can it be possible that connecting to a wlan changes my host name without my consent?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Some DHCP servers send out host names. Clients can accept or ignore such offers.
Have a look at your local /etc/dhcp/dhclient.conf file to inspect your current configuration. There is a list of
request entities one of which will probably readhost-name. For more information check out the man page of dhclient.conf.
Method 2
It looks like your hostname got configured via DHCP. One common way to do it is via the /etc/dhcp/dhclient-exit-hooks.d/hostname script. There may be other hooks in place which resolve your own IP address via reverse DNS and set your hostname accordingly by calling sethostname().
If you don’t want your hostname to be changed, simply configure your dhcp client not to request one. You may also reconfigure your hostname at any time by running hostname x301, if you don’t feel comfortable touching files in /etc
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0