I have installed Debian on a dedicated server. The company that leases this server gave me 3 addresses:

  • DMZ IP
  • Mask
  • Gateway

The server cannot resolve hostnames. So when I use ping with IP- it works. When I use ping with hostname- it doesn't. I think I should put something in

/etc/resolv.conf

But I don't know what. Should it be the gateway?

closed as too broad by Rui F Ribeiro, G-Man, RalfFriedl, msp9011, grochmal Dec 7 at 12:44

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 3 down vote accepted

No, a gateway is a router. You'll want to specify name servers. For example:

nameserver 209.244.0.3
nameserver 209.244.0.4

Or whichever name servers you want to use. Your hosting provider probably has name servers very, very close to your server. Those might be the best option, and you should ask them the IP addresses of their name servers for your use. Or use a search engine to find publicly available name servers. My hosts are very close to Level 3, so I use the Level 3 name servers, as specified above.

Another nice option is the search or domain option. From the manual (man resolv.conf):

domain Local domain name. Most queries for names within this domain can use short names relative to the local domain. If set to '.', the root domain is considered. If no domain entry is present, the domain is determined from the local hostname returned by gethostname(2); the domain part is taken to be everything after the first '.'. Finally, if the hostname does not contain a domain part, the root domain is assumed.

search Search list for host-name lookup. The search list is normally determined from the local domain name; by default, it contains only the local domain name. This may be changed by listing the desired domain search path following the search keyword with spaces or tabs separating the names. Resolver queries having fewer than ndots dots (default is 1) in them will be attempted using each component of the search path in turn until a match is found. For environments with multiple subdomains please read options ndots:n below to avoid man-in- the-middle attacks and unnecessary traffic for the root-dns-servers. Note that this process may be slow and will generate a lot of network traffic if the servers for the listed domains are not local, and that queries will time out if no server is available for one of the domains.

The search list is currently limited to six domains with a total of 256 characters.

domain your-domain-name.com
nameserver 209.244.0.3
nameserver 209.244.0.4
  • Thank you very much! This works perfectly! I've installed Debian a few times and I never had this problem before so I thought something is wrong on the company side. – Tom Dec 6 at 19:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.