LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   ping: unknown host www.google.com (https://www.linuxquestions.org/questions/linux-networking-3/ping-unknown-host-www-google-com-218936/)

tcma 08-17-2004 04:26 PM

ping: unknown host www.google.com
 
How to setup networking so ping will work?

# ping -c 2 www.google.com
ping: unknown host www.google.com

However, ping works with IP addresses.
# ping -c 2 64.233.161.99
PING 64.233.161.99 (64.233.161.99) 56(84) bytes of data.
64 bytes from 64.233.161.99: icmp_seq=1 ttl=239 time=38.1 ms
64 bytes from 64.233.161.99: icmp_seq=2 ttl=239 time=37.5 ms

--- 64.233.161.99 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 37.583/37.845/38.108/0.326 ms

Linux version 2.6.7-gentoo-r11

david_ross 08-17-2004 04:30 PM

Add your ISPs DNS servers to /etc/resolv.conf in the format:
nameserver ip.of.primary.dns
nameserver ip.of.secondary.dns

Mirceagab 06-11-2011 03:49 AM

Following file should be work with any ISP in the world :)
# cat /etc/resolv.conf
Output:

nameserver 208.67.220.220
nameserver 208.67.222.222

kprojects 06-11-2011 10:28 AM

I'll usually use google's dns..

nameserver 8.8.8.8
nameserver 8.8.4.4

NetDoc 07-22-2011 11:41 AM

Quote:

Originally Posted by kprojects (Post 4382684)
I'll usually use google's dns..

nameserver 8.8.8.8
nameserver 8.8.4.4

Here is what I get:

root@epsilon:~# ping google.com
ping: unknown host google.com
root@epsilon:~#

I have this in my resolv.conf:
File: /etc/resolv.conf

search sblb1.scubaboard.com
nameserver 192.168.2.1
nameserver 8.8.8.8
nameserver 8.8.4.4

repo 07-22-2011 11:51 AM

Remove
Code:

search sblb1.scubaboard.com
nameserver 192.168.2.1

And restart the network

Kind regards

Galatimas 03-02-2012 10:14 PM

Similar issue
 
Hey folks. I've just started playing with linux over the past couple days, so I'm clearly having some trouble.

I have the same issue. At first it was just that the system couldn't get to the internet, but I wrote a static default route and it works fine (not sure how pertinent that is, but perhaps shows some setup issue). My IP settings are all static. Currently I can't ping/traceroute/wget any domain names and programs can't use them either.

nslookup/dig work. Ping just gives "ping: unknown host google.com"

# nslookup google.com
Server: 8.8.8.8
Address: 8.8.8.8#53

Non-authoritative answer:
Name: google.com
Address: 74.125.226.192

# ping 74.125.226.196
PING 74.125.226.196 (74.125.226.196) 56(84) bytes of data.
64 bytes from 74.125.226.196: icmp_req=1 ttl=54 time=18.7 ms
64 bytes from 74.125.226.196: icmp_req=2 ttl=54 time=17.4 ms


Resolv.conf contents:

# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4



nsswitch.conf contents:

# /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: dns files
networks: files

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




Linux version 2.6.32-5-686

Galatimas 03-02-2012 11:47 PM

I'm an idiot...
 
So yeah, apparently if you tab out the lines in the resolv.conf file for the nameservers for neatness' sake, it doesn't work right.

my resolv.conf had:
#yadayadaydayda
<tabbed space> nameserver 8.8.8.8
<tabbed space> nameserver 8.8.4.4

____________________________________________________________________________________________________

Deleted the tabbed space before the nameserver directive and it works fine now.


All times are GMT -5. The time now is 06:41 PM.