If I configure two nonexistent DNS servers in the /etc/resolv.conf file:
and try to ping for example http://www.slashdot.org, then I capture following sent packets from my machine:
As I understand with help of strace(1), there are two sockets opened:
Am I correct, that in case of UDP it's up to the application to retransmit UDP datagramx if there is no response from the server? Or is this determined by some FreeBSD library which is used by applications? I tried with several different programs and there were always two tries to both DNS servers.
Code:
[root@ ~]# cat /etc/resolv.conf
nameserver 1.1.1.1
nameserver 2.2.2.2
[root@ ~]#
and try to ping for example http://www.slashdot.org, then I capture following sent packets from my machine:
Code:
15:08:19.123979 IP 192.0.43.10.29512 > 1.1.1.1.53: 19983+ A? www.slashdot.org. (34)
15:08:24.144077 IP 192.0.43.10.49257 > 2.2.2.2.53: 19983+ A? www.slashdot.org. (34)
15:08:26.149745 IP 192.0.43.10.29512 > 1.1.1.1.53: 19983+ A? www.slashdot.org. (34)
15:08:36.171772 IP 192.0.43.10.49257 > 2.2.2.2.53: 19983+ A? www.slashdot.org. (34)
As I understand with help of strace(1), there are two sockets opened:
Code:
kqueue(0) = 4
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5
connect(5, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("1.1.1.1")}, 16) = 0
sendto(5, "\20\2\0005\2\2\2\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\17"..., 34, 0, NULL, 0) = 34
clock_gettime(0, 0xbfbec8dc) = 0
kevent(0x4, 0xbfbec964, 0x1, 0xbfbec964, 0x1, 0xbfbec978) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 6
connect(6, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("2.2.2.2")}, 16) = 0
sendto(6, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\17N\0\0\300\266\34(\0\0\0\0\0\0\0\0\0"..., 34, 0, NULL, 0) = 34
clock_gettime(0, 0xbfbec8dc) = 0
kevent(0x4, 0xbfbec964, 0x1, 0xbfbec964, 0x1, 0xbfbec978) = 0
sendto(5, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 34, 0, NULL, 0) = 34
clock_gettime(0, 0xbfbec8dc) = 0
kevent(0x4, 0xbfbec964, 0x1, 0xbfbec964, 0x1, 0xbfbec978) = 0
sendto(6, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 34, 0, NULL, 0) = 34
clock_gettime(0, 0xbfbec8dc) = 0
kevent(0x4, 0xbfbec964, 0x1, 0xbfbec964, 0x1, 0xbfbec978) = 0
close(5) = 0
close(6) = 0
Am I correct, that in case of UDP it's up to the application to retransmit UDP datagramx if there is no response from the server? Or is this determined by some FreeBSD library which is used by applications? I tried with several different programs and there were always two tries to both DNS servers.