Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
;; 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...
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.
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.
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.
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?
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
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
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).
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.