LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-30-2012, 10:40 AM   #1
shany
LQ Newbie
 
Registered: Oct 2012
Posts: 5

Rep: Reputation: Disabled
I'm getting "Unknown host name" when i try to ping <hostname>


It would be more clear if i put up things through command outputs..

>ping www.google.com
ping: unknown host www.google.com

>ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=0 ttl=128 time=40.6 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=128 time=36.9 ms

> nslookup www.google.com
Server: 192.168.232.2
Address: 192.168.232.2#53

Non-authoritative answer:
Name: www.google.com
Address: 173.194.38.147
Name: www.google.com
Address: 173.194.38.148
Name: www.google.com
Address: 173.194.38.144
Name: www.google.com
Address: 173.194.38.145
Name: www.google.com
Address: 173.194.38.146

>host www.google.com
www.google.com has address 173.194.38.147
www.google.com has address 173.194.38.148
www.google.com has address 173.194.38.144
www.google.com has address 173.194.38.145
www.google.com has address 173.194.38.146

Some one please explain me what has to be done to rectify this issue.
 
Old 10-30-2012, 10:58 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
You need to put two DNS server addresses in /etc/resolv.conf. I looks like you're using Google's freely available DNS servers, so, open a terminal, and to this:
Code:
su -     <or sudo>
cat > /etc/resolv.conf
search com
nameserver 8.8.8.8
nameserver 8.8.4.4
^D
^D means Ctrl-D

You could also use a text editor; e.g., vi, vim.

Hope this helps some.

[edit]
Forgot to mention: read the manual page for resolv.conf for a complete explanation
Code:
man resolv.conf
[/edit]

Last edited by tronayne; 10-30-2012 at 11:04 AM.
 
Old 10-30-2012, 01:09 PM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Please don't try to ping any external domain like google.com. As far as I know it's illegel & not allowed and it's against IT ethics. For illustration purpose you could have changed original names with some dummy ones.
Anyway, here in your case, your system isn't able to resolve hostnames against IP adresses.
Use following commands to check hostnaems, and then make appropriate entries of hostname against IP in /etc/resolv.conf file (as shown in above response).
# nslookup 8.8.8.8
OR,
# dig -x 8.8.8.8

Last edited by shivaa; 10-30-2012 at 01:11 PM.
 
Old 10-30-2012, 01:26 PM   #4
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Quote:
Originally Posted by shivaa View Post
Please don't try to ping any external domain like google.com. As far as I know it's illegel & not allowed and it's against IT ethics. For illustration purpose you could have changed original names with some dummy ones.
I'm pretty sure pinging is fine, as long as it's not a flood ping - though if you said 'nmap' or something like that, then I would agree with you wholeheartedly. If you're pinging google (say) 5 times, that's putting less load on their servers than bringing it up in a browser. That said, I could be utterly wrong
 
Old 10-30-2012, 08:31 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,323
Blog Entries: 28

Rep: Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141
I think the idea of isolated pings is getting confused with DDoS. http://staff.washington.edu/dittrich/misc/ddos/
 
Old 10-30-2012, 09:05 PM   #6
Rodebian
Member
 
Registered: Apr 2012
Posts: 37

Rep: Reputation: Disabled
ping -c5 google.com or www.google.com

""-c count - Stop after sending count ECHO_REQUEST packets. With deadline option, ping waits for count ECHO_REPLY packets, until the timeout expires.""

-c5 pings = five times. -c10 pings = ten times. You can always control the amount of pings.

Pings are not illegal.

Last edited by Rodebian; 10-30-2012 at 09:12 PM.
 
Old 10-31-2012, 01:49 AM   #7
Heraton
Member
 
Registered: Apr 2011
Location: Germany
Distribution: Mint 10, openSuSE
Posts: 58

Rep: Reputation: 3
You should check your nsswitch.conf

Hello shany!

You might want to check your nsswitch.conf to see if dns is used for name resolution. If not, this would explain why nslookup is working properly (implements dns itself) and ping is not (uses system name resolution). For more information check
Code:
man 5 nsswitch.conf
Regards, Heraton
 
Old 10-31-2012, 09:47 AM   #8
shany
LQ Newbie
 
Registered: Oct 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Heraton View Post
Hello shany!

You might want to check your nsswitch.conf to see if dns is used for name resolution. If not, this would explain why nslookup is working properly (implements dns itself) and ping is not (uses system name resolution). For more information check
Code:
man 5 nsswitch.conf
Regards, Heraton
Hi Heraton,

Thanks for your reply.After re-correcting one entity pertaining to the dns lookup in the nsswitch.conf now everything is going good. Thanks for all your replies..
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CVS Issue - can't login remotely "host unknown" snowweb Linux - Server 1 08-20-2011 11:01 PM
Changed HOSTNAME, now have whole "host" of problems New Shoes Slackware 3 01-29-2009 02:34 AM
startx fail , error shown "hostname: Unknown host " syseeker Red Hat 4 07-05-2006 11:40 AM
error "unknown host" in Browser saurabhK Linux - Networking 1 03-29-2005 11:42 AM
"host" ok, but "ping" can't find ip address hardigunawan Linux - Networking 2 05-16-2002 05:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration