XxUnkn0wnxX
New Around Here
Hi, i'm not sure how to ask this or if this has been asked, I want to have
at the top of resolv.conf every boot.
now my WAN DNS Setting has
and it doesn't allow for a 3rd or 4th and so forth name servers to be listed only 2.
I want to be able to have proper DNS caching so that my routers dnsmasq is where all quires hit before being forwarded down to CF DNS and so forth.
as i have some custom DNS domains pointing to my own hosts which I have added to: /jffs/configs/dnsmasq.conf.add
now i have added this to /jffs/scripts/services-start
and: /jffs/scripts/dns_resolver.sh
now I think my implementation of it is a bit dirty, is there a proper way to do this? append additional name servers at the top of resolv.conf & ensure that dnsmasq uses it?
I noticed that dnsmasq has the setting: no-resolv enabled which stops it from using /etc/resolv.conf
that's why I added the server=127.0.0.1 to /tmp/resolv.dnsmasq as well.
Code:
nameserver 127.0.0.1
now my WAN DNS Setting has
Code:
1.1.1.1
208.67.222.222
and it doesn't allow for a 3rd or 4th and so forth name servers to be listed only 2.
I want to be able to have proper DNS caching so that my routers dnsmasq is where all quires hit before being forwarded down to CF DNS and so forth.
as i have some custom DNS domains pointing to my own hosts which I have added to: /jffs/configs/dnsmasq.conf.add
now i have added this to /jffs/scripts/services-start
Code:
# Add local DNS server to resolv.conf
/bin/sh /jffs/scripts/dns_resolver.sh
and: /jffs/scripts/dns_resolver.sh
Code:
#!/bin/sh
# Delay execution
sleep 20
# Add local DNS server to resolv.conf if not already present
if ! grep -q "nameserver 127.0.0.1" /etc/resolv.conf; then
echo -e "nameserver 127.0.0.1\n$(cat /etc/resolv.conf)" > /etc/resolv.conf
fi
# Add local DNS server to /tmp/resolv.dnsmasq if not already present
if ! grep -q "server=127.0.0.1" /tmp/resolv.dnsmasq; then
echo -e "server=127.0.0.1\n$(cat /tmp/resolv.dnsmasq)" > /tmp/resolv.dnsmasq
fi
# Restart dnsmasq service to apply changes
service restart_dnsmasq
now I think my implementation of it is a bit dirty, is there a proper way to do this? append additional name servers at the top of resolv.conf & ensure that dnsmasq uses it?
I noticed that dnsmasq has the setting: no-resolv enabled which stops it from using /etc/resolv.conf
that's why I added the server=127.0.0.1 to /tmp/resolv.dnsmasq as well.