# resolver ignores /etc/hosts

**URL:** https://forums.suse.com/t/resolver-ignores-etc-hosts/23427
**Category:** SLES Configure-Administer
**Created:** [December 19, 2012, 5:50am UTC](https://forums.suse.com/t/resolver-ignores-etc-hosts/23427 "2012-12-19T05:50:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![epretorious](https://avatars.discourse-cdn.com/v4/letter/e/90ced4/32.png) [@epretorious](https://forums.suse.com/u/epretorious)
#### Post date: [December 19, 2012, 5:50am UTC](https://forums.suse.com/t/resolver-ignores-etc-hosts/23427/1 "2012-12-19T05:50:15Z")

</div>

I’ve added an entry in /etc/hosts for the host [san2.example.com](http://san2.example.com)…

`san1:~ # grep san2 /etc/hosts
192.268.1.2 san2.example.com san2`  
…and verified that the resolver is configured to check /etc/hosts first (by way of /etc/nsswitch.conf)…

[CODE]san1:~ # grep dns /etc/nsswitch.conf

# dns Use DNS (Domain Name Service)

hosts: files dns  
networks: files dns[/CODE]  
…but the resolver still isn’t resolving the hostname correctly.

`san1:~ # ping san2.example.com
ping: unknown host san2.example.com`  
Have I overlooked something? 😕

Eric Pretorious  
Truckee, CA

---

<div class="post-metadata">

### Author: ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)
#### Post date: [December 19, 2012, 6:03am UTC](https://forums.suse.com/t/resolver-ignores-etc-hosts/23427/2 "2012-12-19T06:03:17Z")

</div>

> [@](#):
>
> On Wed 19 Dec 2012 03:54:02 AM CST, epretorious wrote:
> 
> ```auto
> ->>>> 192.268.1.2 san2.example.com san2
> ```
> 
> Have I overlooked something? 😕
> 
> Eric Pretorious  
> Truckee, CA

Hi  
192.268 hmmmmmm

Can you ping the ip address? Domain name setup in YaST Network Settings?

–  
Cheers Malcolm Â°Â¿Â° (Linux Counter #276890)  
openSUSE 12.2 (x86\_64) Kernel 3.4.11-2.16-desktop  
up 1 day 10:10, 3 users, load average: 0.09, 0.07, 0.10  
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU

---

<div class="post-metadata">

### Author: ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)
#### Post date: [December 19, 2012, 2:35pm UTC](https://forums.suse.com/t/resolver-ignores-etc-hosts/23427/3 "2012-12-19T14:35:20Z")

</div>

On 12/18/2012 09:03 PM, malcolmlewis wrote:[color=blue]

> 192.268.1.2 [san2.example.com](http://san2.example.com) san2
> 
> Can you ping the ip address? Domain name setup in YaST Network Settings?[/color]

No no no, this (the bad IP) is the end. Impossible IP addresses will  
never be resolved properly and, as you’re pointing out, this is an  
impossible IP address.

FWIW: I duplicated the symptom exactly. Putting in a valid IP address  
caused things to resolve nicely. I’d guess if you could look at the  
resolver stuff in the system you’d see it choke on the bad IP address and  
then move on.

Good luck.

---

<div class="post-metadata">

### Author: ![epretorious](https://avatars.discourse-cdn.com/v4/letter/e/90ced4/32.png) [@epretorious](https://forums.suse.com/u/epretorious)
#### Post date: [December 20, 2012, 4:37am UTC](https://forums.suse.com/t/resolver-ignores-etc-hosts/23427/4 "2012-12-20T04:37:09Z")

</div>

[QUOTE=malcolmlewis;10782]Hi  
192.268 hmmmmmm

Can you ping the ip address? Domain name setup in YaST Network Settings?[/QUOTE]

Thanks, Malcolm! I fixed the entry in /etc/hosts and the problem went away:

[CODE]san1:~ # grep example /etc/hosts  
127.0.0.2 [san1.example.com](http://san1.example.com) san1  
192.168.0.1 [san1.example.com](http://san1.example.com) san1  
192.168.1.2 [san2.example.com](http://san2.example.com) san2  
san1:~ # ping -c3 [san1.example.com](http://san1.example.com)  
PING [san1.example.com](http://san1.example.com) (127.0.0.2) 56(84) bytes of data.  
64 bytes from [san1.example.com](http://san1.example.com) (127.0.0.2): icmp\_seq=1 ttl=64 time=0.042 ms  
64 bytes from [san1.example.com](http://san1.example.com) (127.0.0.2): icmp\_seq=2 ttl=64 time=0.020 ms  
64 bytes from [san1.example.com](http://san1.example.com) (127.0.0.2): icmp\_seq=3 ttl=64 time=0.022 ms

— [san1.example.com](http://san1.example.com) ping statistics —  
3 packets transmitted, 3 received, 0% packet loss, time 1998ms  
rtt min/avg/max/mdev = 0.020/0.028/0.042/0.009 ms[/CODE]  
Many thanks! 😃

Eric Pretorious  
Truckee, CA
