[942161 views]

[]

[toggle ads]

Odi's astoundingly incomplete notes

New entries | Code

Redhat maps hostname to loopback interface

This is typical on Redhat systems:
/etc/hosts:
127.0.0.1 h1234.example.com h1234 localhost.localdomain localhost
This maps the host name to the loopback interface address. I don't find this particularly amusing. It's really bad practice. Because it leads to the following inconsistency:
user@h1234 $ host h1234
h1234.example.com has address 10.1.2.3
user@h1234$ telnet h1234 80
Trying 127.0.0.1...
It gets especially in your way if you have services that bind to specific addresses only:
user@h1234 $ netstat -lnt
Active Internet connections (only servers)
Proto Local Address  Foreign Address State
tcp   10.1.2.3:80    0.0.0.0:*       LISTEN

posted on 2011-02-22 11:58 CET in Code | 0 comments | permalink