LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-11-2012, 06:56 AM   #1
AlphaLan
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Rep: Reputation: Disabled
Can not ping domain name


Topology:
route - 192.168.1.1
PC, ubuntu11.04, manually uninstall network-management, one ethernet interface (eth0) connect to route.

step1, reboot PC, enter command line, "ifconfig -a" check eth0 is present and down.

step2, "dhclient eth0", "ifconfig" check the eth0 is up with ip address got from route DHCP server, 192.168.1.62.

step3, ping 4.2.2.2 OK
step4, ping google.com return error "ping: unknown host google.com"
step5, dig google.com
----------
alan>> dig google.com

; <<>> DiG 9.7.3 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17254
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;google.com. IN A

;; ANSWER SECTION:
google.com. 247 IN A 74.125.128.138
google.com. 247 IN A 74.125.128.102
google.com. 247 IN A 74.125.128.100
google.com. 247 IN A 74.125.128.101
google.com. 247 IN A 74.125.128.139
google.com. 247 IN A 74.125.128.113

;; AUTHORITY SECTION:
google.com. 78470 IN NS ns1.google.com.
google.com. 78470 IN NS ns4.google.com.
google.com. 78470 IN NS ns3.google.com.
google.com. 78470 IN NS ns2.google.com.

;; ADDITIONAL SECTION:
ns1.google.com. 255665 IN A 216.239.32.10
ns2.google.com. 253741 IN A 216.239.34.10
ns3.google.com. 251382 IN A 216.239.36.10
ns4.google.com. 255665 IN A 216.239.38.10

;; Query time: 44 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Thu Oct 11 19:48:11 2012
;; MSG SIZE rcvd: 260
------------
seems the resolver is OK.

step 6, check the resolve.conf host.conf, hosts
alan>> cat /etc/resolv.conf
domain P-660HNU-F1
search P-660HNU-F1
nameserver 192.168.1.1
alan>> cat /etc/host.conf
# The "order" line is only used by old versions of the C library.
order bind, hosts
multi on
alan>> cat /etc/hosts
127.0.0.1 localhost
220.181.111.85 baidu.com(I added this one for debug....)
192.168.1.1 P-660HNU-F1
127.0.1.1 alan-TravelMate-3260

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


step 7, I think maybe is caused by route table, so add one default gateway.
>> route add default gw 192.168.1.1

ping google.com still not work.

Why Why the gethostbyname() in ping program fails....Why why, I cry...
 
Old 10-11-2012, 07:43 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
If you're using IPV4 change your /etc/resolv.conf to this:
Code:
search com
nameserver 8.8.8.8
nameserver 8.8.4.4
If you're using IPV6, change your /etc/resolv.conf to this:
Code:
search com
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
Refer to https://developers.google.com/speed/...dns/docs/using (Google's Public DNS Servers page).

From the above it looks like your gateway address is 192.168.1.1 and your name server is at that address (like in the router). That usually won't work too well.

You do not need to reboot or restart when changing /etc/resolv.conf.

Give that a shot and see what happens.

Hope this helps some.
 
Old 10-11-2012, 07:46 AM   #3
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
Quote:
step3, ping 4.2.2.2 OK
step4, ping google.com return error "ping: unknown host google.com"
step5, dig google.com
Hi,

It appears that you have need to specify a qualified DNS in your conf.

You may discover that qualified DNS IP through your chain of connections. You may want to run this:

Code:
~allan@host~$ /usr/bin/traceroute www.google.com
then using your network manager you may apply the nearest IP with the shortest hop time, usually among the 1st to 3rd hops. You may adjust it later upon your SP's advice. DNS IPs are given by the service providers you can also inquire from them.

Goodluck.
 
Old 10-11-2012, 08:35 AM   #4
AlphaLan
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
tronayne:
IPv4 network.
I just tried the new servername 8.8.8.8 and 8.8.4.4, it didnot fix the issue.

192.168.1.1 is a OK one, acturally. PC is OK. DUT means device under test.
PC-------ROUTE
DUT-----|

PC is windows system, list what it has:
Default gateway: 192.168.1.1
DHCP server: 192.168.1.1
DNS: 192.168.1.1

From the above it looks like your gateway address is 192.168.1.1 and your name server is at that address (like in the router). That usually won't work too well.
I did not get this, can you provide an simple explaination?
Thanks much.

malekmustaq:
Thanks, but it does not help.


All I want to have better understanding about how to make one linux network works. So I manually uninstall the network-manager.
 
Old 10-11-2012, 08:40 AM   #5
AlphaLan
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Yeah, seems the network-manager does not invoke dhclient. In my operation, DUT did not learn the default gateway by dhclient.
So maybe I still miss something configuration about network.

I got ping source code, and found it fails in function gethostbyname(), Anyone where is the gethostbyname defined?
 
Old 10-11-2012, 02:18 PM   #6
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
What are you connecting to: a router, a switch, a modem?

192.168.1.1 is (usually) the default address of a router or switch which is then connected to your modem. You modem may provide a DNS server but you typically don't want to use that server because they tend to time out after a while (as little as hours) and then you'll get the "can't locate blah" messages. By having entries for DNS server(s) (two is enough) in /etc/resolv.conf, your system has a way to quickly look up the numeric address (all internet addresses are numeric, the DNS servers have essentially a look-up table containing the "www.what.where" name and the numeric address of where you're trying to go).

Basically, the error messages you've posted say that you don't have a DNS server available; if you can't open a terminal window and
Code:
ping -c 5 google.com
which will return something quite similar to this
Code:
PING google.com (74.125.224.97) 56(84) bytes of data.
64 bytes from nuq04s08-in-f1.1e100.net (74.125.224.97): icmp_req=1 ttl=51 time=811 ms
64 bytes from nuq04s08-in-f1.1e100.net (74.125.224.97): icmp_req=2 ttl=51 time=819 ms
64 bytes from nuq04s08-in-f1.1e100.net (74.125.224.97): icmp_req=3 ttl=51 time=831 ms
64 bytes from nuq04s08-in-f1.1e100.net (74.125.224.97): icmp_req=4 ttl=51 time=1131 ms
64 bytes from nuq04s08-in-f1.1e100.net (74.125.224.97): icmp_req=5 ttl=51 time=771 ms

--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 15511ms
rtt min/avg/max/mdev = 771.777/873.234/1131.735/130.807 ms, pipe 2
then, well, you ain't got no DNS server.

You should be able to open a browser and go directly to http://192.168.1.1 and you may see a page the details the settings of either the router/switch or modem (in many, not necessarily all, cases).

Something else to check is that your internet daemon is actually running (it ought to be, but maybe not): open a terminal window and
Code:
ps -ef | grep inet
root      1887     1  0 Sep28 ?        00:00:00 /usr/sbin/inetd
The location may vary (your may not be in /usr/bin) but you should see inetd.

Now, if you've made changes to the inet configuration, for changes to take effect you have two choices: reboot the system or HUP the PID of the running netd. The PID, in the above example is 1887 and the way you HUP (hang up) is to open a terminal window and
Code:
su kill -HUP 1887   (use the PID of your running inetd, not likely 1887)
Doing that will restart the network daemon (you don't need to do anything else).

In the link I provided previously (for the Google document), there is a section that details what to do with an Ubuntu system:
Quote:
Example: Changing DNS server settings on Ubuntu

In the System menu, click Preferences, then click Network Connections.
Select the connection for which you want to configure Google Public DNS. For example:
To change the settings for an Ethernet connection, select the Wired tab, then select your network interface in the list. It is usually called eth0.
To change the settings for a wireless connection, select the Wireless tab, then select the appropriate wireless network.
Click Edit, and in the window that appears, select the IPv4 Settings or IPv6 Settings tab.
If the selected method is Automatic (DHCP), open the dropdown and select Automatic (DHCP) addresses only instead. If the method is set to something else, do not change it.
In the DNS servers field, enter the Google Public DNS IP addresses, separated by a space:
For IPv4: 8.8.8.8 and/or 8.8.4.4.
For IPv6: 2001:4860:4860::8888 and/or 2001:4860:4860::8844
Click Apply to save the change. If you are prompted for a password or confirmation, type the password or provide confirmation.
Test that your setup is working correctly; see Testing your new settings below.
Repeat the procedure for additional network connections you want to change.

If your distribution doesn't use Network Manager, your DNS settings are specified in /etc/resolv.conf.
You might want to give that a try (and refer to the Google document for more information).

If your ISP provides one or two DNS server addresses, you can use those instead of the Google DNS servers; the method is the same.

And, last, you may need to reinstall your network management software (if you have removed it).

Hope this helps some.

Last edited by tronayne; 10-11-2012 at 02:21 PM.
 
Old 10-11-2012, 09:54 PM   #7
AlphaLan
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
To tronayne#6:
Thank you so much.
(1) I will try to dig the daemon inetd.
(2) I will use code block on this forums next time. Sorry for the mess format.
(3) result will be updated.
 
Old 10-14-2012, 12:24 PM   #8
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
Quote:
PC is windows system, list what it has:
Default gateway: 192.168.1.1
DHCP server: 192.168.1.1
DNS: 192.168.1.1
AlphaLan,

All these IPs are not qualified. You need to route your packets into a valid domain name server. Since you were able to dig into the www.google.com I assume you are connected to the internet. Probably you need to reboot the system and redo the traceroute to discover the hops (assuming that your ISP did not give you their DNS Ip). Use the route command to set up toward the DNS server.

Good luck.
m.m.
 
  


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
can't ping domain name, but can ping ip address dtra Linux - Networking 4 04-03-2013 05:02 PM
DNSMasq - dnslookup build.domain.local works but ping build.domain.local doesnt mustaghattack Linux - Server 2 03-01-2010 09:00 PM
Ping resolving to the wrong domain ?? rsmccain Linux - Software 1 12-12-2007 02:10 PM
I cannot ping hosted domain (site) at server Peon1 Linux - Newbie 4 10-06-2007 04:39 AM
ping IP's but not domain names matrx88 Linux - Networking 11 07-08-2003 02:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:05 AM.

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