# Non-recoverable failure in name resolution



## xwwu (Oct 3, 2013)

Dear friends,

Big problem. Error message as follows:


```
#telnet localhost:25
localhost:25: Non-recoverable failure in name resolution
# telnet localhost:110
localhost:110: Non-recoverable failure in name resolution
```

Need your help!


----------



## SirDice (Oct 3, 2013)

Try reading the telnet(1) man page regarding the correct syntax. It's `telnet localhost 25`.


----------



## xwwu (Oct 3, 2013)

Dear @SirDice,

Sorry for low level mistake. But if I 


```
#nslookup localhost
Server:         192.168.1.1
Address:        192.168.1.1#53

Non-authoritative answer:
Name:   localhost.xxx.xxx.xxx
Address: 60.195.191.230
```

192.168.1.1 is a router. The IP 60.195.191.230 is not mine, and is quite different from 127.0.0.1, even 192.168.1.* bla bla.


----------



## kpa (Oct 3, 2013)

The problem is that nslookup(1) does not use /etc/hosts and it tries a DNS lookup using the settings in /etc/resolv.conf but fails, this is by design. If you do for example a simple `ping localhost` it will use the correct 127.0.0.1 address because the system resolver does use /etc/hosts. Doing `telnet localhost 25` works for the same reason.


----------



## ShelLuser (Oct 3, 2013)

Looks like you've been modifying /etc/hosts in ways you shouldn't have. Well, either that or /etc/nsswitch.conf.

For starters make sure that this is present in /etc/hosts:


```
::1                     localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain
```


----------



## xwwu (Oct 3, 2013)

kpa said:
			
		

> The problem is that nslookup(1) does not use /etc/hosts and it tries a DNS lookup using the settings in /etc/resolv.conf but fails, this is by design. If you do for example a simple `ping localhost` it will use the correct 127.0.0.1 address because the system resolver does use /etc/hosts. Doing `telnet localhost 25` works for the same reason.



Thanks. I know the reason right now.


----------

