Hostname defined in file "network" changes after change to file "hosts"
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
ip addr add 192.168.30.5/24 brd 192.168.30.255 dev eth0 label eth0:0
/etc/hosts
127.0.0.1 localhost
192.168.30.5 system-adm-1 adm-1 # alias eth0:0
192.168.20.5 system-wrk-1 wrk-1 # eth1 (relates to hostname)
## eth0 is DHCP obtaining an address of 172.16.25.2
command line prompt
guest@system-wrk-1
All is fine up until this point where a technician makes the following change to /etc/hosts:
127.0.0.1 localhost
192.168.30.5 system-adm-1 adm-1 # alias eth0:0
192.168.20.5 system-wrk-1 wrk-1 # eth1
172.16.25.2 system-hse-1 ## still DHCP but entered here
Now after a reboot of the system (virtual machine), the command line prompt comes back as:
guest@system-hse-1
If /etc/hosts is only a local DNS lookup, why doesn't the prompt adhere to the value set in /etc/sysconfig/network and why does it change to the new entry defined in /etc/hosts? Not only did it change names, it changed interfaces!
To answer odcheck, the return from hostname -f is system-hse-1. Populating /etc/hostname (not normally present by default in CentOS, is this a Debian thing?) changes nothing.
This would appear to be a bug in the Xen stuff. The virtual machine has CentOS 5.3 running on it just as the base physical machine does. Both system install sets are essentially the same. The condition only occurs on the virtual machine given the same setup. May have to go to the well (Citrix) on this one.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.