I am trying to understand how /etc/resolv.conf /etc/nsswitch.conf exactly works and what is significance of nameserver entry 127.0.1.1
I did strace ping google.com to get to know about the system calls involved , one part is :
stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=172, ...}) = 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("127.0.1.1")}, 16) = 0
gettimeofday({1413780874, 913366}, NULL) = 0
poll([{fd=4, events=POLLOUT}], 1, 0) = 1 ([{fd=4, revents=POLLOUT}])
send(4, "\0040\1\0\0\1\0\0\0\0\0\0\6google\3com\0\0\1\0\1", 28, MSG_NOSIGNAL) = 28
poll([{fd=4, events=POLLIN}], 1, 5000) = 1 ([{fd=4, revents=POLLIN}])
ioctl(4, FIONREAD, [204]) = 0
recvfrom(4, "\0040\201\200\0\1\0\v\0\0\0\0\6google\3com\0\0\1\0\1\300\f\0\1"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.1.1")}, [16]) = 204
close(4) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(1025), sin_addr=inet_addr("173.194.123.36")}, 16) = 0
getsockname(4, {sa_family=AF_INET, sin_port=htons(58830), sin_addr=inet_addr("192.168.1.13")}, [16]) = 0
close(4)
can any one please explain what is going on here ? specially connect on 127.0.1.1 as it is namsserver entry in my resolv.conf Why we need to make socket connection to 127.0.1.1 ? and how do we get response from it ?