Cause: The company network interface to do the interface authentication, the virtual machine bridge to the physical network card can not complete authentication network access, but can only say that the virtual machine network mode changed to NAT mode, after the completion of the SSH login, found that the host name has changed.
Before changing NAT mode
[[email protected] ~] #
[[email protected] ~] #
[[email protected] ~] #
After changing to NAT mode
[[email protected] ~] #
[[email protected] ~] #
Found the host name into a bogon, very angry, look very uncomfortable, try to change back.
View several related files
[[email protected] ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
[[email protected] ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Host names in network and hosts are normal, localhost
[[email protected] ~]# hostname bogon
Directly using hostname to find or return bogon, not localhost in the file, view DNS file
[[email protected] ~]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search localdomain
nameserver 192.168.13.2
Found a row of search localdomain, should be the problem caused by this line of configuration, resolv.conf configuration is automatically issued by the VMware 8 network card, so change the configuration here is useless, prepare the curve to salvation
The configuration instructions for this block are to parse the IP address of the host after the configuration file is loaded, and the returned domain domain name is echoed to the command line as the hostname, attempting to resolve the native IP
[[email protected] ~]# nslookup 192.168.13.128
Server: 192.168.13.2
Address: 192.168.13.2#53
Non-authoritative answer:
128.13.168.192.in-addr.arpa name = bogon.
Authoritative answers can be found from:
[[email protected] ~]#
Sure enough, the IP address of this machine is resolved in order to Bogon, then the problem is that if the search Localdomain is configured in resolv.conf, the host name obtained here takes precedence over the configuration in the hosts and network files.
To solve this problem, the simplest solution is to let its resolution without DNS, using the Hosts file, directly to the native IP address to the localhost can be
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.13.128 localhost
Restart the server, log in and see the host name back to normal.
The Linux hostname inexplicably became Bogon and resolved to change to localhost