Centos 6 - machine does not know it's own hostname
So I've got this Centos 6 machine running. it's got openssh-server and the firewall is open on port 22. It's hostname is mycentos. I've found that most linux systems seem to know their own hostname, and are contactable by hostname:
Code:
root@foobar:~# ssh foobar Code:
yanom@mycentos:~ $ ssh mycentos Code:
yanom@mycentos:~ $ ssh 192.168.1.70 This machine also has an apache web server running, and I've confirmed that the web server is reachable by "http://192.168.1.70" by not by "http://mycentos" |
Hi there,
Connecting locally and remotely work a little differently. To connect locally your machine can look up its own hostname in the /etc/hosts file. On most Linux systems, if you use the system setup tools to change the hostname (like yast on opensuse, or setup on centos), it also changes the /etc/hosts entry for you. If you changed the hostname manually, though (for example by editing /etc/sysconfig/network on centos), the /etc/hosts file would not be updated as well. You can fix this by editing the /etc/hosts file and adding an appropriate entry, like this: Code:
127.0.0.1 localhost.localdomain localhost mycentos For connentions from another computer on the same network, the other computer also needs a way to translate the name (mycentos) to its IP address (192.168.1.70). If you are running a Domain Name Server (DNS), the best thing to do is to add an entry for this host to the DNS. If not, you will have to add this entry to the hosts file of the other computer. Good luck! |
All times are GMT -5. The time now is 06:42 AM. |