Configuring router's own IP address using DHCP

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


Joined: 05 Nov 2019
Posts: 5

PostPosted: Fri Oct 15, 2021 3:57    Post subject: Configuring router's own IP address using DHCP Reply with quote
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 Razz

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.
Sponsor
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 8997

PostPosted: Fri Oct 15, 2021 16:30    Post subject: Reply with quote
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.

JMTC

_________________
ddwrt-ovpn-split-basic.sh * ddwrt-ovpn-split-advanced.sh * ddwrt-ovpn-kill-switch.sh * ddwrt-ovpn-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 12463
Location: Texas, USA

PostPosted: Fri Oct 15, 2021 17:17    Post subject: Reply with quote
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...

... and the script you're looking for is in the wireless access point wiki, if I am not mistaken.

_________________
Official Forum Rules, Guidelines & Helpful InformationFirmware FAQInstallation WikiWhere Do I Download Firmware‽
DON'T use Chromium-based browsersRTFM/STFW TL;DR is NOT an excuse. • Why Should I Care What Color the Bikeshed Is‽
Please DO NOT PM me with questions; Ask in the forum. ---------------------- Linux User #377467 counter.li.org / linuxcounter.net
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1268

PostPosted: Sat Oct 16, 2021 15:31    Post subject: Reply with quote
I think it is possible, but it would be very circular in logic as eibgrad pointed out...

The system may also be smart enough to notice that traffic is local and thus put it over the loop-back adapter and so it would not work the same
i336_
DD-WRT Novice


Joined: 05 Nov 2019
Posts: 5

PostPosted: Sun Oct 17, 2021 4:51    Post subject: Reply with quote
Thanks all for the replies, and for entertaining my crazy ideas Smile

So, after a couple days' consideration, I realized that it's not, in fact, the end of the world (Exclamation Rolling Eyes) 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 Wink (*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 Wink). 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.


kernel-panic69: thanks for the reference - yup, I found the script over at https://wiki.dd-wrt.com/wiki/index.php/Wireless_Access_Point.

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... Smile

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.
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