What's new

R7800-Voxel replacing stock DHCP or DNS or both?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Easy Rhino

Senior Member
hello!

I'm using Voxel's modified stock firmware, and mostly like it. Kind of intimidated by the prospect of finding a good openwrt build on what is our familys "production" router.

my big gripe is DHCP and DNS and how they dont' talk to seach other and I can't just type in a local hostname to go to an internal web server.

It appears that the Netgear x4s R7800 firmware uses busybox udhdpd for DHCP, and dnsmasq for DNS?

I would like to replace one or both of them, for instance, use dnsmasq for both.

Is there a way to do this?

I tried installing the voxel entware dnsmasq package, but trying to run that threw an error, probably because dnsmasq was already running. and then I gave up.
 
Last edited:
I tried installing the voxel entware dnsmasq package, but trying to run that threw an error, probably because dnsmasq was already running. and then I gave up.

I didn't test entware dnsmasq, but if you edit /opt/etc/init.d/S56dnsmasq and add something like the following at the top of the script (after #!/bin/sh), then it stops the stock dnsmasq, so it can start the entware one.

Code:
if [ "$1" == "start" ]; then
        sleep 10s
        echo "stopping dnsmasq"
        /etc/init.d/dnsmasq
       
  fi

If you plan on switching a lot between both dnsmasq versions, then you might also want to add something at the end of the script to start stock dnsmasq, if you have stopped the entware one:

Code:
if [ "$1" == "stop" ]; then
        echo "starting dnsmasq"
        sleep 5s
        /etc/init.d/dnsmasq start
fi

If you also want to use entware dnsmasq for dhcp, then you'd might want to add some lines to kill and start udhcpd.
Note, this might break things in the GUI.

Also, I don't know what happens if udhcpd has already handed out some leases before it gets killed. It might lead to ip-address conflicts, so perhaps you want to prevent udhcpd from starting at all, by editing /etc/init.d/net-lan
But risk here: if somehow during a reboot, the entware usb-stick isn't mounted, then it will not be handing out dhcp-leases. Depending on situation, you'd then need to configure a static IP on a computer, to regain access to the router to fix it.
 
perhaps easier: if your local webservers have a static IP-address, then edit the script "/sbin/printhosts" to add their names and IP-addresses.

This script generates the hosts file, which should also be used by stock dnsmasq to resolve local hosts

Or perhaps even fancier, add some scripting to parse the "nvram reservation#" entries, and automatically add all static IP-addresses and their name to the hosts file
 
Last edited:
Nice find Mr Gerrits!

I am wondering, how do you find all those things? I am still trying to understand how everything is "linked" together (/tmp , /etc, /sbin, ...) Do you happen to know if there is some documentation about this?

Just looking to understand and finetune myself if needed. Could really appreciate some "building blocks" of our beloved firmware here.
 
Do you happen to know if there is some documentation about this?
Not that I'm aware of... And to make things worse, several "interesting" parts of the firmware are closed source, so even more difficult to understand.

but really short /rom & /overlay are "combined" to form the root-fs
and a lot of stuff that normally would be stored in /etc, is now dynamically generated during boot, based on nvram variables. (usually stored in /tmp, with a symlink into /etc)
This is done so the settings can survive a firmware update.

so if you are looking to change behaviour, look at all the nvram variables (nvram show) to see if something might be related to what you are searching.

And then use cd /rom && grep -ri "searchterm" to find which scripts or binaries do something with it. Or use the same in /etc, /tmp or /overlay.
(using cd / && grep -ir --exclude-dir=proc also kind of works, but might hang the router once it starts searching /sys. (and I don't think grep can be told to exclude both proc and sys))

If it is a binary, then you can use strings "binary" and see what strings / commands are around the thing you are looking for.
And then with a lot of logic thinking, you might figure out the logic that Netgear/DNI has used.

And sometimes, starting a binary with strace (install via entware) might also give you insights on which files / folders are being accessed.
 
Last edited:
hey, to bump this ANCIENT thread, I was able to sort of figure this out. But it's not my current config any more so i don't have the most precise setup info (Actually when I tried to post my config files a while back, it was blocked by a forum anti-hacking protection lol.).

Anyway:

1) Download voxel
2) set up usb drive for storage
3) download and install the Entware version of dnsmasq. (the one included with the netgear is gimped and can't do dhcp).
4) Disable DHCP and DNS in the GUI interface.
5) modify a script, i think /etc/init.d/net-lan, near the bottom, so that instead of running their dnsmasq, run your dnsmasq in your /opt/bin/whatever folder).
6) you have to configure everything with text files now, no GUI helper. The documentation on the dnsmasq page is pretty good though.

So except for the text file thing, it worked, it even survived multiple voxel firmware upgrades.

I was able to register DHCP leases, assign hostnames, and those host names were passed on to DNS for other machines to find.
 
Hi

If you are willing to find the solution outside your r7800:

I have bought a Raspberry Pi for $10 which runs pihole to manage my dns and dhcp.This with as advantage that it blocks adds in your entire network.

Works perfect for me.
 
yes, I realized I could use a standalone device for both DHCP and DNS (i run pihole on a VM on a larger server) but at the time I wanted those functions on the router as a fallback for reliability in the house. in other words, as long as the router was working, we'd still have internet and the wife and kids wouldn't hurt me down.

relying on another device (even a pihole in the corner) would have introduced another point of failure.
 
Funny to see that most have the same challenge; make sure Internet keeps on working to keep everyone happy in the household.
For that reason I took the direction of adding a dedicated Raspberry Pi zero w for pi-hole instead of changing code in my R7800. It runs a script that it gets updated ones a week and is already rock solid for 2 years+.
 
hey, to bump this ANCIENT thread, I was able to sort of figure this out. But it's not my current config any more so i don't have the most precise setup info (Actually when I tried to post my config files a while back, it was blocked by a forum anti-hacking protection lol.).

Anyway:

1) Download voxel
2) set up usb drive for storage
3) download and install the Entware version of dnsmasq. (the one included with the netgear is gimped and can't do dhcp).
4) Disable DHCP and DNS in the GUI interface.
5) modify a script, i think /etc/init.d/net-lan, near the bottom, so that instead of running their dnsmasq, run your dnsmasq in your /opt/bin/whatever folder).
6) you have to configure everything with text files now, no GUI helper. The documentation on the dnsmasq page is pretty good though.

So except for the text file thing, it worked, it even survived multiple voxel firmware upgrades.

I was able to register DHCP leases, assign hostnames, and those host names were passed on to DNS for other machines to find.

to follow up and correct my owninstructions slightly.

5) modify the script /etc/init.d/dnsmasq

6) comment out this line
Code:
/usr/sbin/dnsmasq --except-interface=lo -r $resolv_file $opt_argv

7) add in this line, assuming that /opt/sbin is where new entware dnsmasq gets installed, and opt/etc/ is where you want to store your config file
Code:
 /opt/sbin/dnsmasq --except-interface=lo  --conf-file=/opt/etc/dnsmasq.conf
 
To add my 2 cents to this discussions:

It is totally possible to get rid of native DHCP…

I personally changed a lot the router scripts to work this way:
On the WAN side, I got rid of the DHCP client. My ISP is giving me a fixed IP, but the gateway is using DHCP ACL to authorize my IP (based on my MAC) with a lease of 5 minutes… so I made a program in C to send appropriate DHCP requests regularly to maintain my ACL and keep a static setup, without bothering my WAN interface. Basically, I am simulating a DHCP client in the eyes of the FAI DHCP relay/server.
On the LAN side, I still use the native udhcpd.

For IPv6, on the WAN side I use a modified self compiled dhcp6c to do the same trick for my ACL (simulating DHCP client). I will probably rewrite completely this in the future.
On the LAN side, I use entware dhcpd with -6 argument.

I completely separated WAN from LAN, as I did not want the LAN servers to be dependent on the LAN clients (since I have fixed IPs).
Native NG DHCP scripts is crap as first it did not renew DHCP leases at ½ time like it is supposed to, creating micro cuts, and on top of that, WAN DHCP client was launching a script reconfiguring the LAN side DHCP server each time the lease was renewed… With a lease of 5 minutes, it was a catastrophe, and the reason why I made my own scripts.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top