ignore dns from dhcp / use static dns only

Post new topic   Reply to topic    DD-WRT Forum 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: 4377
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 R7800, Netgear R6400v1, Netgear R6400v2, Linksys EA6900 (XvortexCFE), Linksys E2000 (converted WRT320N), WRT54GS v1.
Install guide Linksys EA6900: http://www.dd-wrt.com/phpBB2/viewtopic.php?t=291230
OpenVPN Policy Based Routing guide: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=321686
Install guide R6400v2:http://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
OpenVPN Server Setup:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=318795
Install guide R7800: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Wireguard Setup guide:https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1183135
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum 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