Why ping tries to resolve reverse DNS?

James Hogarth james.hogarth at gmail.com
Tue Aug 17 08:38:12 UTC 2010


On 17 August 2010 09:22, Marcos <fraga.muerete at gmail.com> wrote:
> Hi everyone,
>
> I noticed a timeout while pinging, and as ping wasn't losing packets, I did
> and strace and got the following (among many output)
>
>
> # strace ping server
>
> [...]
> write(5, "RESOLVE-ADDRESS 10.1.1.25\n", 26) = 26
> read(5, "-15 Timeout reached\n", 4096)  = 20
> close(5)                                = 0
> munmap(0x7fc72972b000, 4096)            = 0
> write(1, "64 bytes from 10.1.1.25: icmp_se"..., 5864 bytes from 10.1.1.25:
> icmp_seq=2 ttl=125 time=0.319 ms
> ) = 58
> sendmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0),
> sin_addr=inet_addr("10.1.1.25")},
> msg_iov(1)=[{"\10\0,\237\304F\0\3!<jL\0\0\0\0\266\273\6\0\0\0\0\0\20\21\22\23\24\25\26\27"...,
> 64}], msg_controllen=0, msg_flags=0}, MSG_CONFIRM) = 64
> recvmsg(3, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0),
> sin_addr=inet_addr("10.1.1.25")},
> msg_iov(1)=[{"E\0\0Tq(@\0}\1\2115\n\1\1\31\254\20L!\0\0004\237\304F\0\3!<jL"...,
> 192}], msg_controllen=32, {cmsg_len=32, cmsg_level=SOL_SOCKET,
> cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 84
> open("/etc/hosts", O_RDONLY|O_CLOEXEC)  = 5
> fstat(5, {st_mode=S_IFREG|0644, st_size=243, ...}) = 0
> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0x7fc72972b000
> read(5, "127.0.0.1 localhost\n127.0.1.1 IN"..., 4096) = 243
> read(5, "", 4096)                       = 0
> close(5)                                = 0
> munmap(0x7fc72972b000, 4096)            = 0
> stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=126, ...}) = 0
> socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 5
> connect(5, {sa_family=AF_INET, sin_port=htons(53),
> sin_addr=inet_addr("10.1.1.25")}, 16) = 0
> poll([{fd=5, events=POLLOUT}], 1, 0)    = 1 ([{fd=5, revents=POLLOUT}])
> sendto(5, "\3718\1\0\0\1\0\0\0\0\0\0\00225\0011\0011\00210\7in-addr\4a"...,
> 40, MSG_NOSIGNAL, NULL, 0) = 40
> poll([{fd=5, events=POLLIN}], 1, 5000)  = 1 ([{fd=5, revents=POLLIN}])
> ioctl(5, FIONREAD, [131])               = 0
> recvfrom(5,
> "\3718\205\203\0\1\0\0\0\1\0\0\00225\0011\0011\00210\7in-addr\4a"..., 1024,
> 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.1.1.25")},
> [16]) = 131
> close(5)                                = 0
> socket(PF_FILE, SOCK_STREAM, 0)         = 5
> fcntl(5, F_GETFD)                       = 0
> fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
> connect(5, {sa_family=AF_FILE, path="/var/run/avahi-daemon/socket"}, 110) =
> 0
> fcntl(5, F_GETFL)                       = 0x2 (flags O_RDWR)
> fstat(5, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0x7fc72972b000
> lseek(5, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
> write(5, "RESOLVE-ADDRESS 10.1.1.25\n", 26) = 26
> read(5,
>
>
> So, why does ping try to resolve the inverse DNS? Is it the normal
> behaviour? I find it quite annoying as I have to wait one DNS timeout with
> every packet sent.
> Any clues?
>
> Thanks in advance.
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
>

It is normal yes as on the output it tries to show a friendly hostname...

If you do not want reverse DNS being done use the argument -n

`man ping` will give you more details.

James




More information about the ubuntu-users mailing list