DHCP client for LAN interface on Tomator/DD-WRT router?

InvisiBill

2[H]4U
Joined
Jan 2, 2003
Messages
2,608
Is there a way to enable the DHCP client on the LAN side of a Linksys router running DD-WRT or Tomato? Uncle Google didn't really turn up anything helpful.

Here's some background. My brother just went off to college and lives in the dorms. His room has two network jacks. That was ok when his roommate didn't show up and he could just plug in both his PC and XBox. To avoid getting stuck with a random person he hates, he ended up rooming with another guy whose roommate also didn't show up. So now my brother only has one network jack to use, plus he got a netbook. I was originally going to just grab a cheap 5 port switch that he could plug in and "split" the network connection for all three of his devices.

Last week, storms took out the WAN port on a coworker's router. I let him borrow my old one until his new one gets here (plus I've helped him with a lot of tech stuff), so he gave me the old router (which I put Tomato on for him last year). It's a WRT54GS v1.1 and seems to work perfectly other than the WAN port. I figured I could use the WAN-less router as a switch and AP for my brother, which is actually perfect. I don't need to buy another switch, plus he'll have WiFi for the netbook.

The school network requires you to register your MAC with their system to get internet access. You plug in your PC, pull up a website, and associate that device with your student account. The XBox doesn't have a web browser, so he actually had to spoof its MAC onto his PC to register the XBox so it could get online (by showing him how to do that, I made him the most popular guy on his floor). Everyone else just uses their own NAT router (which allows you to split the port as well as register the WAN MAC via your PC), but I figured double-NATing would only make things more complicated and likely to fail.

Since I don't control the main network, I can't simply reserve an IP for the LAN MAC or choose an IP outside of the assigned pool. Ideally I'd like to have the LAN side of the Linksys pull its own IP and act just like any other device plugged into the school network. I think my next choice is to spoof the LAN MAC onto the PC and register it, then just statically configure the router to use the assigned IP, but I'm worried that the school may reassign that IP for someone else's device if the router isn't actually requesting it via DHCP. I don't think they reserve IPs for each registered MAC, but just add the MAC to some sort of ACL. I'd rather have it pull an IP matching whatever network they're using, so that he can easily access it without manually changing his PC to some other IP.

I don't mind using either DD-WRT or Tomato on this router, and I don't mind doing some CLI hacking to get it to work. However, I want it to be reliable, since it will be in my not-so-techy brother's dorm room an hour away. I don't want him constantly wanting me to come over to fix his internet.
 
iirc, you could actually change a LAN port to work as a WAN port. I swear I remember seeing that in DD-WRT anyway. But you don't want the double-NAT...
but no, a LAN port cannot pull an IP from DHCP, to my knowledge. Since it really is nothing more than an unmanaged switch.
what's the big deal about his devices getting a different IP address?

unless I misunderstand what you're trying to accomplish...
disable DHCP in the router, so it's nothing more than a WAP and unmanaged switch?
 
pretty confusing here, but disable DHCP, assign a ip address so you can configure it later on, then use it as a WAP.
 
This can be done from CLI but you really don't wanna do that. Eg. how do you intend to access your router if you change it's lan ip from 192.168.1.1 or whatever to something dhcp gives?

You've pretty much left the choices j-sta came up with.
 
iirc, you could actually change a LAN port to work as a WAN port. I swear I remember seeing that in DD-WRT anyway. But you don't want the double-NAT...
but no, a LAN port cannot pull an IP from DHCP, to my knowledge. Since it really is nothing more than an unmanaged switch.
what's the big deal about his devices getting a different IP address?

unless I misunderstand what you're trying to accomplish...
disable DHCP in the router, so it's nothing more than a WAP and unmanaged switch?

But it's actually more like a managed switch, with having a web interface to configure the device. For sharing the existing dorm network, it will indeed act like an unmanaged switch and AP. It would just be nice if the web interface IP could also be in the same DHCP range that his computers are getting, so that if needed, he'd simply be able to connect to the Linksys' IP without having to manually reset his IP to something different. There's a decent chance he'd do it incorrectly, then not be able to access the router or his dorm network until I went over there and fixed it (which is what I'm trying to avoid).


pretty confusing here, but disable DHCP, assign a ip address so you can configure it later on, then use it as a WAP.

This can be done from CLI but you really don't wanna do that. Eg. how do you intend to access your router if you change it's lan ip from 192.168.1.1 or whatever to something dhcp gives?

You've pretty much left the choices j-sta came up with.

I'd use the DHCP-assigned IP to access it, rather than 192.168.1.1. The problem with just assigning it 192.168.1.1 and disabling DHCP is that he has no way to easily access it later. He'd need to take the PC and router off the dorm network and manually configure an IP. This should be a fairly simple thing, but like I said above, I wouldn't be surprised for him to configure something incorrectly and not have access to either network. The less he has to change, the better.

Do you have any details about what commands I'd need to use to enable that?
 
webgui != managed switch ;)

only the WAN port has an associated MAC address. Switch ports do not have an associated MAC address.

if you felt inclined, add a secondary IP address to his TCP/IP properties that is in the 192.168.1.x range.

I did this when I was renting a duplex with some friends, and the roomy's DLink didn't play nice with my Linksys wireless adapter.
Roomy's router was the WAN port, left the IP on my Linksys router at the default 192.168.1.1, then added a secondary 192.168.1.2 IP to my wireless connection so that I could still access the Linksys webgui
 
webgui != managed switch ;)

only the WAN port has an associated MAC address. Switch ports do not have an associated MAC address.

if you felt inclined, add a secondary IP address to his TCP/IP properties that is in the 192.168.1.x range.

I did this when I was renting a duplex with some friends, and the roomy's DLink didn't play nice with my Linksys wireless adapter.
Roomy's router was the WAN port, left the IP on my Linksys router at the default 192.168.1.1, then added a secondary 192.168.1.2 IP to my wireless connection so that I could still access the Linksys webgui

I know that having a WebGUI doesn't make it a managed switch, but you can connect to the device and configure stuff on it, similar to a managed switch. Whereas an unmanaged switch is simply a "dumb network splitter", the router does have an interface you can connect to. Though based on the definition at http://en.wikipedia.org/wiki/Network_switch#Configuration_options, I might be inclined to say it is a managed switch anyway.

The individual switch ports don't have MACs, but you're incorrect about only the WAN port having one. The WAN, LAN, and wireless interfaces all have their own MACs. Here's a screenshot from one of my routers.
RouterMACs.png


I like the idea about adding a second IP to his NIC, but it looks like it won't let you set the primary as DHCP and a second one as static (at least not in the GUI on Win7). Going back to the original problem of worrying about having the system reassign the IP when statically configuring the router's LAN interface, I'd be worried about IP conflicts on his PC if it wasn't actually using DHCP.
 
The individual switch ports don't have MACs, but you're incorrect about only the WAN port having one. The WAN, LAN, and wireless interfaces all have their own MACs. Here's a screenshot from one of my routers.
http://pctech.invisibill.net/images/RouterMACs.png[/img[/quote]

you're right... completely forgot about that.

[quote="InvisiBill, post: 1036239459"]I like the idea about adding a second IP to his NIC, but it looks like it won't let you set the primary as DHCP and a second one as static (at least not in the GUI on Win7).[/quote]

hmm.. I know you can in XP as that is how my setup was... haven't delved much into the TCP/IP properties in Win7... I would [b]think[/b] you could do the same thing...

[quote="InvisiBill, post: 1036239459"]Going back to the original problem of worrying about having the system reassign the IP when statically configuring the router's LAN interface, I'd be worried about IP conflicts on his PC if it wasn't actually using DHCP.[/QUOTE]

couple things here...
#1 - for the other devices to get an IP on the college network, their MAC address needs to be registered, correct?
In which case, registering the MAC of a switch will do no good.
Unless you have the other devices get an IP from the router, in which case you have 2 issues-
A- router can reply to all DHCP requests since it's LAN port is connected to an existing network. Causing issues and a headache for the college's IT dept.
B- devices would be NAT'ed, which you don't want.


edit: ok, I confused myself. Re-read the OP. I don't believe even with OpenWRT, DD-WRT, Tomato, etc, is there a way to set the device to receive it's internal IP via DHCP.
 
Last edited:
hmm.. I know you can in XP as that is how my setup was... haven't delved much into the TCP/IP properties in Win7... I would think you could do the same thing...

Yeah, it seems like you should be able to. It's possible that I just missed it in the GUI or it's CLI-only now.


edit: ok, I confused myself. Re-read the OP. I don't believe even with OpenWRT, DD-WRT, Tomato, etc, is there a way to set the device to receive it's internal IP via DHCP.

I haven't found any examples of anyone else setting the LAN IP via the DHCP client. I was hoping someone would have some simple way to turn it on. With all the crazy stuff you can do on DD-WRT with VLANs and Virtual APs and such, it seems like turning the DHCP client on for a different interface should be pretty simple, but I can see where it's probably pretty limited as to when it would be used, so it wouldn't surprise me for it to be totally ignored.


couple things here...
#1 - for the other devices to get an IP on the college network, their MAC address needs to be registered, correct?
In which case, registering the MAC of a switch will do no good.
Unless you have the other devices get an IP from the router, in which case you have 2 issues-
A- router can reply to all DHCP requests since it's LAN port is connected to an existing network. Causing issues and a headache for the college's IT dept.
B- devices would be NAT'ed, which you don't want.

Just to clarify, the plan is to throw in a switch and AP to "split" the dorm network connection to the other devices. Those other devices would all get IPs from and be registered with the dorm network.

If the dorm's DHCP server is 10.0.0.1, my brother might have 10.0.0.101 for his PC, 10.0.0.102 for his netbook, and 10.0.0.103 for his XBox. The goal was to simply have the LAN interface of the DD-WRT device (acting as only a switch/AP) pull 10.0.0.104 so he could easily access it (just in case he needs to change some setting). If the DD-WRT used 192.168.1.1, he would need to manually set his PC to 192.168.1.2 (and possibly disconnect from the dorm network) to connect to it. It should have no bearing on actually using the device to split the connection, it would just make it easier for him to access the DD-WRT interface.
 
Yeah, it seems like you should be able to. It's possible that I just missed it in the GUI or it's CLI-only now.

according to Microsoft, the "Alternate Configuration" is still there in Win7?
http://technet.microsoft.com/en-us/library/cc725638.aspx

I can check on my desktop when I go home for lunch. Sadly haven't made the migration off XP yet at work.

edit: looks like the Alternate Configuration tab is in the same place as it is in WinXP. LAC Properties -> TCP/IPv4 Properties -> Alternate Configuration tab
http://www.sevenforums.com/network-sharing/65619-unable-set-alternate-configuration-laptop.html

I haven't found any examples of anyone else setting the LAN IP via the DHCP client. I was hoping someone would have some simple way to turn it on. With all the crazy stuff you can do on DD-WRT with VLANs and Virtual APs and such, it seems like turning the DHCP client on for a different interface should be pretty simple, but I can see where it's probably pretty limited as to when it would be used, so it wouldn't surprise me for it to be totally ignored.

I found some posts pertaining to OpenWRT, but nothing of the sort for what you're looking for. I agree that it probably is possible, just a matter of finding the correct config.

Just to clarify, the plan is to throw in a switch and AP to "split" the dorm network connection to the other devices. Those other devices would all get IPs from and be registered with the dorm network.

If the dorm's DHCP server is 10.0.0.1, my brother might have 10.0.0.101 for his PC, 10.0.0.102 for his netbook, and 10.0.0.103 for his XBox. The goal was to simply have the LAN interface of the DD-WRT device (acting as only a switch/AP) pull 10.0.0.104 so he could easily access it (just in case he needs to change some setting). If the DD-WRT used 192.168.1.1, he would need to manually set his PC to 192.168.1.2 (and possibly disconnect from the dorm network) to connect to it. It should have no bearing on actually using the device to split the connection, it would just make it easier for him to access the DD-WRT interface.

yeah... I had confused myself, hence the edit :p
 
according to Microsoft, the "Alternate Configuration" is still there in Win7?
http://technet.microsoft.com/en-us/library/cc725638.aspx

I can check on my desktop when I go home for lunch. Sadly haven't made the migration off XP yet at work.

edit: looks like the Alternate Configuration tab is in the same place as it is in WinXP. LAC Properties -> TCP/IPv4 Properties -> Alternate Configuration tab
http://www.sevenforums.com/network-sharing/65619-unable-set-alternate-configuration-laptop.html

Duh. I was trying to assign two IPs (DHCP + static) in the advanced properties. I looked right at the alternate config and ignored it. Setting 192.168.1.2 as an alternate should work.

I think that might end up being the simplest way. It should allow the PC to use 192.168.1.2 to connect to the router when there's no DHCP present, then switch back to his regular IP when he plugs it back into the dorm network.

I'll probably still mess around with trying to get the DHCP client working with the LAN side just to do it, but thanks for pointing me in the direction of a fairly foolproof way to make this work.
 
Not only the simplest, sanest too (if you really can't have double nat).

If the dorm's DHCP server is 10.0.0.1, my brother might have 10.0.0.101 for his PC, 10.0.0.102 for his netbook, and 10.0.0.103 for his XBox. The goal was to simply have the LAN interface of the DD-WRT device (acting as only a switch/AP) pull 10.0.0.104 so he could easily access it (just in case he needs to change some setting). If the DD-WRT used 192.168.1.1, he would need to manually set his PC to 192.168.1.2 (and possibly disconnect from the dorm network) to connect to it. It should have no bearing on actually using the device to split the connection, it would just make it easier for him to access the DD-WRT interface.
How would you know dd-wrt got ip .104? Does it have an lcd which displays it? Or were you thinking of trying hundreds, possibly thousands of ips (depending on subnet ofc), to find the right one? I don't think you can really imagine how much fun that must be when something breaks. Consider the possibility dd-wrt doesn't get ip from dhcp for some silly reason. How are you gonna troubleshoot that?
 
Duh. I was trying to assign two IPs (DHCP + static) in the advanced properties. I looked right at the alternate config and ignored it. Setting 192.168.1.2 as an alternate should work.

I think that might end up being the simplest way. It should allow the PC to use 192.168.1.2 to connect to the router when there's no DHCP present, then switch back to his regular IP when he plugs it back into the dorm network.

I'll probably still mess around with trying to get the DHCP client working with the LAN side just to do it, but thanks for pointing me in the direction of a fairly foolproof way to make this work.

That is what I was going to suggest with the Alternate configuration. Just unplug the router from the wall and it will work. But you are most likely going to have to run "ipconfig /renew" in the cmd prompt since the computer won't know the DHCP server is gone just by you unplugging it.
 
edit: after looking this over online this method only works for XP, not vista/7.
 
Last edited:
Not only the simplest, sanest too (if you really can't have double nat).


How would you know dd-wrt got ip .104? Does it have an lcd which displays it? Or were you thinking of trying hundreds, possibly thousands of ips (depending on subnet ofc), to find the right one? I don't think you can really imagine how much fun that must be when something breaks. Consider the possibility dd-wrt doesn't get ip from dhcp for some silly reason. How are you gonna troubleshoot that?

ARP. A simple "arp -a" piped into findstr to filter for the router's MAC (arp -a | findstr "00-de-ad-be-ef-00") spits out a single line showing whatever IP it happened to get. I'd have to look into the details of the DHCP client they use in DD-WRT to figure out something to handle the scenario of not getting an IP. Simply rebooting the router might be enough to fix it (assuming some glitch kept it from pulling an IP as it normally would). I admit that it would be the worst time to have problems, but he'll only need to access the router via this IP if he needs to change a setting on it (SSID, password, etc.). Subsequently, I'll admit that I'm probably putting a whole lot of time into something that will probably never even be used, but that's just how I am. =)


That is what I was going to suggest with the Alternate configuration. Just unplug the router from the wall and it will work. But you are most likely going to have to run "ipconfig /renew" in the cmd prompt since the computer won't know the DHCP server is gone just by you unplugging it.

I'm aware of this. But it's a lot easier to tell my brother to run "ipconfig /renew" whenever he switches it than to walk him through manually changing his IP back and forth.


edit: after looking this over online this method only works for XP, not vista/7.

The alternate IP setup does work on Win7, if that's what you were referring to.
 
I'm a bit rusty on arp, thought it had a timeout? So unless device is continually broadcasting something...

Anyway, just wanted to say that when something goes haywire, you want as few unknows as possible for troubleshooting. A setup like that ain't helping, though i do see the convenience for your brother.
 
I was playing with some other DD-WRT stuff today and found How To Use DHCP to Set the WAP's IP Address.

DD-WRT Wiki said:
It is not possible to set the LAN interface to get its IP address via DHCP using the web configuration interface. You can, however, set your startup script to obtain an IP address.

Code:
udhcpc -i br0 -p /var/run/udhcpc.pid -s /tmp/udhcpc -H test-wrt-wireless
hostname `nslookup \`ifconfig br0 | grep 'inet addr' |cut -f 2 -d ':'\` | grep 'Name:' | awk '{print $2;}' | cut -f 1 -d '.'`
if test `hostname` != `nvram get wan_hostname`; then 
     nvram set wan_hostname=`hostname`;
     nvram set router_name=`hostname`;
     nvram commit;
fi
Only the first line is required if you don't want your WAP to set its name based on the IP address it gets. However, if you want to save a configuration file which will apply to several WAPs, that can be a handy feature.

A little bit of quick testing with my own DD-WRT AP looks like it's working ok. My brother is home from school for Christmas break and I've got a week of vacation, so I should be able to play with this a bit, using his AP/switch behind my parents' router. Obviously, the big concern is reliably finding out which IP the LAN interface has obtained.
 
Back
Top