Posted: Fri Oct 15, 2021 3:57 Post subject: Configuring router's own IP address using DHCP
Hi all,
I'm overhauling my LAN and trying to centralize the config so I can reason about it just a tad more easily. I want to get all the bits on the network to autoconfigure off of dnsmasq running on the dual-NIC box acting as my gateway/router.
So far I have my little 24 port switch set up to get its local/configuration IP via DHCP (yay!), along with an old TG582n I'll be using for backup Wi-Fi (or maybe for IoT stuff). Now I want to figure out how to have DD-WRT on my R7000 do the same.
Sooo, how do I get the address listed at Setup > Basic Setup > Network Setup > Router IP to autoconfigure via DHCP, so I don't have to specify it manually? I see no "retrieve via DHCP" option.
I realize that one of the caveats of such a feature is that the device MUST be connected to a DHCP server in order to function in this mode, and that if this isn't remembered, the device would appear to be dead/inaccessible unless it was factory reset. (I also realize my switch solves the "get back in without factory reset" scenario by providing serial console access.) However, I expressly want to use this configuration, and if I somehow Needed™ to get back in without a DHCP server available I'd just reset it because I'd have config backups
If this capability isn't available... well, maybe this post could be a tentative feature request/discussion? I'm very happy to file a ticket if that's deemed to be a reasonable idea.
I understand what you're asking for. And I'm sure it *could* be done. In fact, I seem to recall a few years ago someone scripting a solution (if I can find it, I'll post back).
Obviously w/ the default, routed configuration, it makes no sense for the LAN network interface of the router to be configured w/ DHCP, since it *is* the DHCP server. It has to be static in order to reliably provide the service to other devices. The need/desire for having the LAN network interface configured by DHCP arises when you're NOT using the default, routed configuration, but simply AP mode (i.e., bridged, w/ NO WAN). And as I said, it could be done. But I just think given all other priorities and a limited staff, this is one enhancement that's considered a luxury, since a static configuration will still work (if somewhat less conveniently).
I think if the router actually had an "AP mode" option, you'd be more likely to see this implemented. But as it stands, YOU have to implement AP mode by carrying out several *manual* operations (disable WAN, assign WAN port to LAN, disable DHCP server, assign IP, netmask, gateway, etc.). And I don't see "AP mode" happenin' either.
Joined: 08 May 2018 Posts: 14246 Location: Texas, USA
Posted: Fri Oct 15, 2021 17:17 Post subject:
I'll be the one to say a feature request without patches written and submitted ain't gonna happen right away. There are feature requests that are 11 years old that I still don't know if they have been implemented or not so those tickets can be closed. Perhaps I should point our newly-acquired web programmer guru towards those tickets to see if he can get the backlog cleared...
Thanks all for the replies, and for entertaining my crazy ideas
So, after a couple days' consideration, I realized that it's not, in fact, the end of the world ( ) to hardcode address/netmask/gateway info into my dual-NIC box, switch, r7000 and 1-2 wifi routers.
Perhaps you can tell this is my first go at "really" setting up a network (*dusts off VLAN and 𝚗𝚏𝚝𝚊𝚋𝚕𝚎𝚜 lint*) - I now see I got a tad sidetracked with a combination of premature optimization and poor understanding of fundamentals.
I'd come up with this cool idea that it would be cool to be able to remotely change the /24 I picked for my network in case I ever tried to VPN in from a conflicting LAN. Thing is, new dnsmasq setup notwithstanding (host. naaaames. :D), I'm still going to hardcode IP addresses in Stuff™ here and there, so this would ultimately amount to a "do untold amounts of damage, probably break remote access to the gateway, and render demos inoperable" button. Not a great idea. (And I now realize a complete implementation would have neeeded to edit my systemd network files, eep.)
I ultimately just spent a bit more time finding a /24 I liked and which Google finds not a single result for (it is in the private ranges ). And at the end of the day, if I do encounter conflicts, bidirectional NAT would work for just about everything except SIP - which I don't expect to need to use on my home LAN.
eibgrad + kernel-panic69: The points about staffing are duly noted. I've honestly found it more than adequately straightforward and easy to reason about to apply a static configuration, FWIW. IMO the priorities are mostly sanely configured...
Wildlion: an interesting point, and I can see where you're coming from - but the DHCP script in the Wiki makes no changes to the routing config, so this wouldn't be a problem.