2

my /etc/resolv.conf file is quite basic, something like:

# Generated by NetworkManager
domain subdomain.example.org
search subdomain.example.org
nameserver 192.0.2.100
nameserver 192.0.2.200

From what I understand, if I have a computer, say machine1.subdomain.example.org, the search field allows me to access it only using its name machine1. But Here's what I get:

$ ping machine1
ping: unknown host machine1
$ ping machine1.subdomain.example.org
PING machine1.subdomain.example.org (192.0.2.12) 56(84) bytes of data.
.../...

I'm on Debian wheezy, how can I make the search directive taken into account for name resolution? Is this a configurations issue? What parameters do I have to check?

EDIT: Here's the content of /etc/nsswitch.conf as requested:

# /etc/nsswitch.conf                                                        
#                                                                           
# Example configuration of GNU Name Service Switch functionality.           
# If you have the `glibc-doc-reference' and `info' packages installed, try: 
# `info libc "Name Service Switch"' for information about this file.        

passwd:         compat                                                      
group:          compat                                                      
shadow:         compat                                                      

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4             
networks:       files                                                       

protocols:      db files                                                    
services:       db files                                                    
ethers:         db files                                                    
rpc:            db files                                                    

netgroup:       nis                                                         
gregseth
  • 193
  • 2
  • 8
  • Do you have *dnsmasq* (or a similar DNS proxy software) installed? It often comes with *Network Manager* (which generally should be avoided on servers). – sam_pan_mariusz Jul 17 '15 at 13:15
  • The example you've supplied *should* work, and it's very unusual that it doesn't. Please compare your `search` string to your `ping machine1.subdomain.domain.fr` string very carefully and make sure a typo isn't present since you've obfuscated this. Barring that, `grep hosts /etc/nsswitch.conf` and share the output. You can try temporarily removing `mdns4_minimal [NOTFOUND=return]` as a troubleshooting step if you find it there. – Andrew B Jul 17 '15 at 13:56
  • If the system you are experiencing the issue is a DHCP client is it possible that `/etc/resolve.conf` and/or the search domains are being modified by the results of getting network information through DHCP? I noticed this [issue on cyberciti](http://www.cyberciti.biz/faq/dhclient-etcresolvconf-hooks/) if something similar is happening on your system that might explain why you can't connect correctly. – Matt Jul 17 '15 at 18:52
  • @AndrewB see edit for nsswitch content – gregseth Jul 20 '15 at 07:01
  • @Matt look like the values in `resolv.conf` are set from DHCP, but they are correct. – gregseth Jul 20 '15 at 07:02
  • Are the machines that you are trying to connect to issued their IPs through DHCP as well? If so what is the state of the DNS server? Are dynamic DNS updates through DHCP allowed? If the systems are statically assigned do they have A records in the DNS server or is everything done in `/etc/hosts`? – Matt Jul 20 '15 at 18:03
  • Have you tried removing `mdns4_minimal [NOTFOUND=return]` as suggested? I don't have experience with the `mdns_minimal` NIS module, but I can see how that `[NOTFOUND=return]` could potentially cause `dns` (and search suffix scanning) to be skipped. – Andrew B Jul 20 '15 at 20:59
  • @Matt I don't know much about the the configuration of th target machine. What I can say though is that the DNS server do have an A record of it address (tested with dig) – gregseth Jul 21 '15 at 06:41
  • @AndrewB Yes, and it doesn't change a thing – gregseth Jul 21 '15 at 06:42

2 Answers2

0

I would remove network-manager and resolvconf and try again, verify that /etc/resolv.conf still has the right contents. These two packages don't have a place on servers and are known to mess with network and dns configurations when you least want it. I use --purge to fully erase them, leave it out if you want. You may also want to verify /etc/network/interfaces is still correct after removing those packages and perhaps restart networking.

apt-get --purge remove network-manager resolvconf
aseq
  • 4,610
  • 1
  • 24
  • 48
0

In AIX you can specify the /etc/netsvc.conf about name resolve lookup

hosts=local,bind4

in Linux /etc/nsswitch.conf

hosts: files dns