Linux - Networking This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
09-27-2013, 07:05 AM
|
#1
|
Member
Registered: Dec 2001
Location: Scotland
Distribution: Slackware 9.1-15 RH 6.2/7, RHEL 6.5 SuSE 8.2/11.1, Debian 10.5
Posts: 518
Rep:
|
does PING resolve only once or each count to same address?
I've tried to find an answer to this and got quite a few different responses or opinions so thought I'd come by here for some more.
My question is simply really, when I ping a domain is the domain resolved and then the IP address pinged the number of times or does the domain name get resolved before each ping?
example: ping somedomain.com -c4
Does this result in somedomain.com getting resolved into an IP address once or four times?
Thanks in advance...
|
|
|
09-27-2013, 07:51 AM
|
#2
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
I do believe that this will be resolved 4 times.
If you use strace to look at what's going on you'll see this block (shortened for easy reading) 4 times (using www.xs4all.nl)
Code:
stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=65, ...}) = 0
socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.0.100.1")}, 16) = 0
recvfrom(4, "\240P\201\200\0\1\0\1\0\0\0\0\3www\6xs4all\2nl\0\0\1\0\1\300"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.0.100.1")}, [16]) = 47
connect(4, {sa_family=AF_INET, sin_port=htons(1025), sin_addr=inet_addr("194.109.6.92")}, 16) = 0
write(1, "PING www.xs4all.nl (194.109.6.92"..., 56) = 56
Each block references /etc/resolv.conf, a connect to port 53 (typical DNS port) and returns the IP number.
|
|
|
09-27-2013, 08:51 AM
|
#3
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,340
|
I don't like to argue with druuna, but not on my system.
I started out by thinking - "why the hell would anyone check more than once" - given the latency in DNS updates.
On this Fedora system I see only one check - as I envisioned.
So, as always, "it depends". Check your own system.
|
|
1 members found this post helpful.
|
09-27-2013, 09:06 AM
|
#4
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Quote:
Originally Posted by syg00
I don't like to argue with druuna,
|
Then don't
Seriously;
Quote:
I started out by thinking - "why the hell would anyone check more than once" - given the latency in DNS updates.
|
That was my train of thought, but I can come up with at least one situation were resolving for each ping would be a good thing.
Quote:
On this Fedora system I see only one check - as I envisioned.
So, as always, "it depends". Check your own system.
|
You are right about that, just checked on a RHEL 6 and Slackware 13.37 box and it only solves just once.
Ping -V on
- Debian: ping utility, iputils-sss20100418
- RHEL 6.2: ping utility, iputils-sss20071127
- Slackware 13.37: ping utility, iputils-sss20101006
Sorry I jumped the gun on this one. As correctly stated by syg00: It depends on the ping version.
|
|
|
09-27-2013, 09:59 AM
|
#5
|
Member
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665
Rep: 
|
it should with 4 attempts because every time it pings it sends out an icmp request and when the request is going 4 times the reply will come for sure..
|
|
|
09-27-2013, 10:01 AM
|
#6
|
Senior Member
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
|
Sliping through the legs of the two giants I just drop of "more than one A record for a hostname". So it should resolve more then one time. The rest was already said.
|
|
|
09-27-2013, 03:57 PM
|
#7
|
Moderator
Registered: Mar 2008
Posts: 22,295
|
Good discussion, good question.
|
|
|
All times are GMT -5. The time now is 01:03 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|