DD-WRT + DNSMasq with alternate gateway

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware
Author Message
DD-WRT Novice

Joined: 23 Feb 2012
Posts: 4

PostPosted: Sat Feb 25, 2012 16:58    Post subject: DD-WRT + DNSMasq with alternate gateway Reply with quote

I'm running 'DD-WRT v24-sp2 (08/12/10) mini' and I need the router to do ONLY DHCP and DNS, and Using ONLY the LAN ports, not WAN.

I need to configure the router to not use itself as the gateway, or have any traffic pass through it. I have 50Mb download speed if I bypass the router and if I go through the router I'm limited to 20Mb.

I followed the documentation listed here


but I'm still beeing passed through the router.

If I check the network configuration of the client I still the the router as the gateway.

Is what I'm tryng to accomplish achievable? Do I need a different build ? I have Linksys WRT54G V2.0 .

Thank you
DD-WRT Novice

Joined: 26 Feb 2012
Posts: 5

PostPosted: Sun Feb 26, 2012 15:39    Post subject: Reply with quote
In Swtup -> Basic setup:
Disable the WAN port to stop the forwarding. The WAN port will then act as a normal LAN port.
Set the router's IP that will serve as DHCP and DNS server IP for the clients.
Set the subnet.
Set the gateway to the global gateway.
Leave "Local DNS"

Set your DHCP type to DHCP server.
Enable the server.
Set the scope, users and lease time.
Leave the WINS server to
Set the DNSmasq options if you use DNSmasq instead of DHCPd.(preffered with your router type) You need both.
Don't set DHCP authorative.

In Services -> Services:
Uncheck "Use NVRAM for client lease DB".
Set used domain to "LAN and WAN".
Set the LAN Domain to the global domain if it permits it and all DHCP clients will have resolvable names. Otherwise use something like "localnet". (don't set it to "local" or "lan")
Set any static leases if you need them.
Leave the DHCPd options blank.

Enable DNSmasq with local DNS and no rebind.
In it's options add:
local=your LAN domain that you set up earlier
your global gateway
dhcp-option=6,your global primary DNS server IP, your global secondary DNS server IP
/I'd use, which is Google's global DNS as a secondary DNS/

/Disable IP forwarding/
dhcp-option=20,0 /Source routing/

For windows clients
dhcp-option=46,1 /Make all nodes broadcast themselves so they're visible in the neighbourhood/

Don't disable NetBIOS in windows environment unless you know exactly what you're doing.
DD-WRT Novice

Joined: 23 Feb 2012
Posts: 4

PostPosted: Mon Feb 27, 2012 16:15    Post subject: Reply with quote
Thank you very much, very detailed steps. I'll try them and let you know.

Thank you once again.
DD-WRT Novice

Joined: 18 May 2015
Posts: 2

PostPosted: Mon May 18, 2015 23:33    Post subject: Reply with quote
As OP never posted back and I have wasted some time getting this to work so I will add a little feedback. I followed the steps outlined by Hadji with the exception of all the DNSmasq options, as this we causing other issues (still, it was an excellent guide).

No matter what I did my devices were still picking up my router with DHCP as the gateway and not the true gateway.

The tip that got this to work was this page http://www.dd-wrt.com/wiki/index.php/DNSMasq_as_DHCP_server (under Troubleshooting). I ssh'ed to my router, ran "cat /tmp/dnsmasq.conf" and saw this line:

This is different from the other examples I have seen as it has the added "lan" element in there (this BTW is not my LAN domain name).

So I changed the command in the options from dhcp-option=3, to

Save, Apply settings and BOOM! It freaking works!
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware All times are GMT


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 can attach files in this forum
You can download files in this forum