Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative DNS Server? #5

Open
rotkohlsuppe opened this issue Jun 8, 2023 · 1 comment
Open

Alternative DNS Server? #5

rotkohlsuppe opened this issue Jun 8, 2023 · 1 comment

Comments

@rotkohlsuppe
Copy link

I wonder how the ESPhole gets the IP addresses for the non-blocked DNS. I assume it's been resolved by the DNS IP from the DHCP Server. I want to setup the ESPHole for a whole little side network. That's why I want to leave the clients (mobile, computer, etc) DNS settings untouched, but alter the DNS settings in my DHCP server, pointing to the ESPHole. But then the ESPHole needs it's own DNS fallback IP, not the one from the router. Otherwise it would create an infinite loop. Is it possible to assign a primary DNS IP address on the ESPHole other than that from the router? Thanks a lot!

@TheTechTiger
Copy link

TheTechTiger commented Apr 25, 2024

You are correct, the ESPHole uses the WiFi's DHCP Server's DNS to get the ip of non blocked domains, so setting up ur ESP8266's IP as a DNS resolver wouldn't be a great idea.
I'm trying to develop a similar version of this project, but instead of using the inbuilt DNSServer library I'm building my own using WiFi UDP.
To fix this problem what I've done is something similar to this:

If(<no match in pre defined DNS Records>){
AddCacheEntery(); //this updates a cache list with the DNS transaction ID, IP and port of the sender
Udp.beginPacket(IPAddress(8,8,8,8), 53);//use any DNS Server like 1.1.1.1 or 8.8.4.4 etc
Udp.write(recivedDNSbuffer, packetSize);
Udp.endPacket();
}

Now this just send/forwards the DNS Request to the server and in the loop method u initially check if the packet is from the DNS server, if so then find its transaction ID in the list and and forward the recived packet from the DNS Server to the respective client IP and port and remove this entry as it's resolved
Additionally u can also set a timeout in this list for like 3-4s, if there's no response from the DNS server for this transaction ID, send "server Busy" response code delete the entry from the list(I do recommend adding this as node mcu has a tiny 4kb RAM size)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants