I am trying to understand how dnsmasq's forwarding works. What I read from the manual is this:
"[...]Dnsmasq accepts DNS queries and either answers them from a small, local, cache or forwards them to a real, recursive, DNS server.[...]"
So as far as I understand if I do a DNS-request my machine asks dnsmasq for the ip adress for a given domain. If dnsmasq cannot answer this dnsmasq will forward this request "to a real, recursive, DNS server."
How does this forwarding work? I tried to answer this question by myself by way of googling but this did not really answer my question.
When I look at it via wireshark I see this kind of pattern:
127.0.0.1 -> 127.0.1.1 (standard query)
192.168.1.2 -> 192.168.1.1 (standard query)
192.168.1.1 -> 192.168.1.2 (standard query response)
127.0.1.1 -> 127.0.0.1 (standard query response)
Can someone explain what is going on there?
Edit:
What I am asking for is how does dnsmasq know what the answer of 192.168.1.1 is. In fact 192.168.1.1 tells only 192.168.1.2 the ip address. How does 127.0.1.1 get to know the ip address? How is the information transferred?
I would expect something like this:
192.168.1.1 -> 127.0.1.1 OR
192.168.1.2 -> 127.0.1.1
I would expect that there is some routing going on to transfer the information but it is not.