ignore dns from dhcp / use static dns only

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
dholth
DD-WRT Novice


Joined: 07 Jan 2011
Posts: 5

PostPosted: Fri Aug 02, 2019 15:49    Post subject: ignore dns from dhcp / use static dns only Reply with quote
I haven't been able to find a way to keep my ISP's dns servers out of /tmp/resolv.dnsmasq

It looks like I could fix this by replacing the /tmp/udhcp script, called by udhcp to configure the network, with a wrapper that unsets the dns environment variable. Then the upstream dns information would not be used.

For dhcp6c it would be simpler, set a custom configuration without request domain-name-servers;

Is this a good way to disable dhcp-provide DNS? Thanks.

I put Python on usb storage, added `/opt/bin/udhcpc` as

Code:

#!/opt/bin/python3
import os, sys
try:
    del os.environ['dns']
except KeyError:
    pass
os.execve('/sbin/rc', ['udhcpc'] + sys.argv[1:], os.environ)


and added `ln -sf /opt/bin/udhcpc /tmp/udhcpc` to my startup script.
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12839
Location: Netherlands

PostPosted: Fri Aug 02, 2019 18:16    Post subject: Reply with quote
Just add the following to the Additional DNSMasq Options
Code:
no-resolv
server= 209.244.0.3 #level3
server= 209.244.0.4 #level3
server=1.1.1.1 #cloudfare
server=1.0.0.1 #cloudfare


The no-resolv directive will tell DNSMasq not to read the resolv.dnsmasq.
Instead specify the DNS servers you want to use

see: https://svn.dd-wrt.com//ticket/6020

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum