Scapy dns request behind router

836 Views Asked by At

I am using Python/Scapy to send DNS requests. My computer's connection is set to use the gateway's DNS. My gateway is my router (Linksys LNK4500) at 192.168.1.1 and my router's connection is set up to use 8.8.8.8 as its DNS.

If I use the destination that is the router's address, I get a correct response.

sr1(IP(dst="192.168.1.1")/UDP()/DNS(rd=1,qd=DNSQR(qname="www.cnn.com")))

However, if I want to use a different DNS server, for example Google's, and I try

sr1(IP(dst="8.8.8.8")/UDP()/DNS(rd=1,qd=DNSQR(qname="www.cnn.com")))

I get a response "WARNING: Mac address to reach destination not found. Using broadcast." and then the packet is sent but I keep receiving packets forever with no answer.

1

There are 1 best solutions below

0
On

I don't think you should be using 8.8.8.8. as IP.dst because first the packet should be directed to your router which in turn will send the packet to Google DNS server.