Why is bash shell sometimes saying I'm at @localhost
while other times it says I'm at @computer-5
?
1 Answer
Some DHCP servers (and clients) are configured to assign a hostname just like an IP address. In these cases the computer's hostname does in fact change to e. g. computer-5
(until it gets a lease assigning a different name, or the lease is relinquished). localhost
will still work for the loopback interface, but the DHCP-assigned hostname will (or should) resolve to the DHCP-assigned address specifically.