Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

EDIT No. 1

My task is mirroring , i.e., copying updated data from master server to all mirrors, by using rsync and rsh. But during rsync and rsh, I found some delay. My thinking is , the reason for delay is reverse DNS lookup. So I want to make log for time consumed in reverse dns lookup process, when master server connects with mirror server.

In my application I want to detect reverse DNS lookup system call called or not. So, for that which command helps ?

For reverse DNS Lookup , system call is getnameinfo(),. if you any other , tell me.

I just want to trace only this system call in my project. Which command can I use?

I know ltrace/strace command to trace all system call called till script exits, but that makes extra overhead, because all system call trace is not of use in my project.

I want to make log for time consumed in reverse dns lookup during rsync and rsh.

Help me in my problem.

share|improve this question
How about dtrace? (what OS?) – michael_n Mar 3 '13 at 11:14
@michael_n Os is CentOS. – devsda Mar 3 '13 at 12:05

First of all, getnameinfo is not a system call, but a glibc function.

But anyway, just run wireshark to monitor traffic, it works for DNS query.


To profile an app, try gprof, perhaps read this guide

share|improve this answer
My task is to calculate time during reverse dns lookup, only. My task is mirroring, i.e, copying updated data to all mirrors from master server(for that I use rsync, rsh). Is it help me in my task ? – devsda Mar 3 '13 at 6:14
@FreakyCheeky perhaps try gprof like tools to profile function calls, that way you might know the time spent on each C function – warl0ck Mar 3 '13 at 8:28
DNS lookup (even reverse lookup) can take some time the first time around, afterwards the result is cached. It is very unlikely to be the cause of any significant delays. – vonbrand Mar 3 '13 at 16:34
@vonbrand Failing lookups are often not cached. Reverse lookups often time out, and this is a fairly common cause of delays. – Gilles Mar 3 '13 at 23:28

Usually it's the server that does a reverse DNS lookup on the client's IP, and no amount of tracing the client will tell you that.

What you need to do is check the configuration or the network activity on the server. strace and the like aren't a good match for this: look at the network activity, e.g. with tcpdump or Wireshark.

share|improve this answer
I read this link, linux.byexamples.com/archives/283/simple-usage-of-tcpdump But I didn't understand how tcpdump helpful to calculate time consumed in Reverse DNS Lookup, can you tell me the command for the same. – devsda Mar 11 '13 at 5:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.