2 routers on the same network.

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


Joined: 04 Jun 2013
Posts: 3

PostPosted: Tue Jun 04, 2013 20:30    Post subject: 2 routers on the same network. Reply with quote
I'm not sure if this is the right place to post this, if I'm wrong, please move it to where it should be posted. Also my english is not that good.

I have a network with fewer than 20 machines. This network is conected trough a simple switch. A wireless router (linksys WAG120N) which doesn't support dd-wrt, this router is conected trough an ADSL conection. Additionaly I have a second router (which is not attached to the network) that is conected to a WISP.

I have a NAS attached to the main network, this NAS is used mainly for file sharing and backup.

I want to connect the second router the main network, so anyone, regardless of the internet connection they are using they can access the NAS services.

I've set up both networks the following way.

Code:
Router nº 1

IP. 192.168.1.1
SN. 255.255.255.0

Computer connected to it gets the following DHCP.

IP. 192.168.1.100~150
SN. 255.255.255.0
GW. 192.168.1.1
DNS. 208.67.222.123, 208.67.220.123

Router nº 2

IP. 192.168.1.2
SN. 255.255.255.0

Computer connected to it gets the following DHCP.

IP. 192.168.1.151~200
SN. 255.255.255.0
SN. 192.168.1.2
DNS. 208.67.222.123, 208.67.220.123

The NAS is assigned to the 192.168.1.10 IP.


Both works like a charm, unless I connect them simultaneously.

Anything goes fine if I connect only one of the routers, but if I connect both simultaneously computers gets DHCP only from the router nº 1, regardless of which wireless router they are connected.

I'd like to have the connections this way.

Stations connected through ethernet cable gets DHCP from router nº 1.
Stations connected through wireless on router nº 1 gets DHCP from router nº 1.
Stations connected through wireless on router nº 2 gets DHCP from router nº 2.

Notes.

1. If I set up the IP manualy (obviously) they work.
2. When both routers are connected, stations connected through router nº2 are getting DHCP from router nº 1, they should get it from router nº 2.
3. NAS doesn't need internet connection.
4. I have 2 types of internet connection due to some issues.
a. ADSL connection is slow, but stable. Good for remote desktop.
b. WISP connection is fast, but instable. Good for web browsing, uploads, downloads, etc...

Below there is a (barely drawed) image of my network.

https://www.dropbox.com/s/jp5dpdlfvx36xtz/network.jpg

I hope you guys can understand my poorly english, and some help would be very nice.

I heard something about disabling DHCP relay, but I couldn't find anything about it on dd-wrt admin panel.
Sponsor
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 2024

PostPosted: Wed Jun 05, 2013 3:37    Post subject: Reply with quote
If I understand this configuration correctly, what you’ve done is connected the second router to the primary router’s network, LAN to LAN.

That’s a HUGE problem, because you’ve now established two DHCP servers on the same network. There’s no way to control which DHCP server will respond first to any given client on that network. And therefore no way to control which device will use which ISP! In effect, what you did is BRIDGE the networks, which is a wrong. What you need to do is ROUTE between them. And each network should be different (e.g., 192.168.1.x and 192.168.2.x).

Obviously you could use the internet for these purposes (port forwarding, VPN, etc.). But I’m assuming you’d rather route LOCALLY for efficiency purposes, so you need a third router to make that possible.
Daw
DD-WRT Novice


Joined: 04 Jun 2013
Posts: 3

PostPosted: Wed Jun 05, 2013 5:07    Post subject: Reply with quote
You got it, I did connect the second router on the first router network.

The computers connected through ethernet cable should access the ISP from the primary router, I'm trying to get the computers connected through wireless to get the DHCP from the router they are connected to.

For some reason they only gets the DHCP from the primary router.
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 2024

PostPosted: Wed Jun 05, 2013 16:32    Post subject: Reply with quote
I don’t think you fully appreciate the problem here. You’ve created a single network w/ more than one DHCP server. But DHCP is a broadcast based protocol, and as such, you can’t control which DHCP server will respond first to any DHCP request from your clients, be they wired or wireless. And thus it’s just LUCK which DHCP server ends up configuring any given client at any given time. Several factors may result in one DHCP server more likely to respond first most of the time (distance from router, router loading, etc.), perhaps MUCH more likely, giving the illusion it’s safe, but it’s not. Sooner or later some of those clients will end up misconfigured.

In short, connecting two routers LAN to LAN, each w/ its own DHCP server, is asking for trouble.
Daw
DD-WRT Novice


Joined: 04 Jun 2013
Posts: 3

PostPosted: Wed Jun 05, 2013 20:50    Post subject: Reply with quote
I've never looked at DHCP servers this ways, maybe the DHCP client looks for lower IP adress, so they keep geting DHCP from the primary router, never from the secondary one.

Is there a way to connect the second router to the main network, in another IP class, so users connected to the second router/isp can access the NAS device? Is it possible? Since the NAS is on the IP class of the main network.
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 2024

PostPosted: Wed Jun 05, 2013 23:00    Post subject: Reply with quote
DHCP clients don’t know anything about the current network, and therefore have no means/reason to discriminate among the multiple DHCP responses they may receive. That’s why they’re requesting help from DHCP. The DHCP server is telling them the current situation (what IP address to use, what DNS server(s) to use, where’s the default gateway, etc.). If the clients had sufficient knowledge to be that discriminating, they probably wouldn’t be using DHCP in the first place. And most, when confronted w/ multiple responses, will simply accept the first one for those reasons.

The only mechanism for dealing w/ multiple DHCP servers is from the DHCP servers themselves. It is theoretically possible to have, for example, DHCP servers that only respond to specific client MAC addresses. Of course, that’s a major maintenance headache. And assumes you have access to such a feature on your router (most consumer-grade routers are Unlikely to provide it, they’re pretty basic).

And there’s no way to connect one network to the other over a WAN either since those are needed for their respective ISPs! So no, you can’t connect these routers together in any way, neither LAN to LAN, nor WAN to LAN, given the current constraints.

NOTE: It would be possible to use two routers *if* they supported VLANs. Then you could, in effect, create a shared third network and route between them. But I’m assuming this option is not available on your non-ddwrt router. So I’m taking that option off the table.

So what’s the solution? USE A THIRD ROUTER!

Use another router to create the gateway you need between the two networks so you can access resources between them, AND without having to deal w/ DHCP conflicts.

Now how to configure that third router depends on several factors, such as whether there is a security issue w/ having cross network access. IOW, should we assume each network trusts the other? Should access to resources be limited to only the NAS, or wide open (all resources)? Or perhaps only in one direction? IOW, it’s like anything else involving routing between two networks. It’s really these details that are the most complicated, and only something YOU can decide.

So architecturally it’s not really all that complicated. It only gets complicated if you insist on trying to solve a three-router problem w/ a two-router solution!
SierraSabre
DD-WRT Novice


Joined: 02 Aug 2013
Posts: 2

PostPosted: Fri Aug 02, 2013 22:47    Post subject: Expanding on this idea Reply with quote
So, I'm a bit new the the world of "advanced routing." I can configure my dd-wrt routers in various modes, but its very much a "follow the recipe" level. I'd like to learn more about these concepts. I've done some limited playing around and I am beginning to know enough to be dangerous. Which is a precarious position.

So I ask for guidance...

eibgrad wrote:

NOTE: It would be possible to use two routers *if* they supported VLANs. Then you could, in effect, create a shared third network and route between them. But I’m assuming this option is not available on your non-ddwrt router. So I’m taking that option off the table.


Not to threadjack, but can we put it back on?

So... VLANs. I've read about them, and I'm trying to figure this out. I'm trying to do something similar to the OP, and I'm a bit lost. I'd like to figure out a way to do something like this. Two DHCP servers, each serving a different subnet, isolated from each other.


eibgrad wrote:


So what’s the solution? USE A THIRD ROUTER!
Use another router to create the gateway you need between the two networks so you can access resources between them, AND without having to deal w/ DHCP conflicts.

Now how to configure that third router depends on several factors, such as whether there is a security issue w/ having cross network access. IOW, should we assume each network trusts the other? Should access to resources be limited to only the NAS, or wide open (all resources)? Or perhaps only in one direction? IOW, it’s like anything else involving routing between two networks. It’s really these details that are the most complicated, and only something YOU can decide.

So architecturally it’s not really all that complicated. It only gets complicated if you insist on trying to solve a three-router problem w/ a two-router solution!


Lets keep it simple, just for the sake of learning. Assume wide open access to resources. I can figure out the rest, I think.

How do you go about configuring that third (middle) router using dd-wrt?
erwin9
DD-WRT Novice


Joined: 30 Jul 2013
Posts: 10

PostPosted: Sun Aug 04, 2013 16:08    Post subject: Reply with quote
There could be another way, but it requires some manual work and will lack the dynamicity of vlans. However, it keeps the manual things at one place, so it can be a temp solution for a while ...

- Remain in your current setup.
- Disable DHCP on one of the routers, presumably the non-dd-wrt one since it is probably the less flexible.
- Then do everything with ONE DHCP, on which you configure two dhcp-range for ip addresses. Play with start/end addresses to carve out what you need in your whole address space.
- To make things simple let's "tag" them 1 and 2 using the net:1 and net:2 locutions
See http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html
- You normally do that in the "Services" tab of the Web UI, under the section "Additional DHCPd Options"
- For each range 1 and 2, you add a number of options in the same DD-WRT config place, to specify a different gateway, and anything else you want like DNS server, using dhcp-option
- The next step is the "manual" part. You have to collect all the MAC addresses of the workstations, and then assign them to either net 1 or net 2, using the dhcp-host command.

Something like the below, which you need to tune/verify as I didn't test it and I'm not sure the syntax is the latest or corresponds to your version of dd-wrt (in particular, net: can now be replaced by set: I believe, read the doc above in details). I am doing the same sort of things for a particular case of mine on one of my routers, which is Tomato, but I presume that dnsmasq on DD-WRT is as complete as in Tomato.

This is to give you the idea:
Code:
dhcp-range=net:1,192.168.1.64,192.168.1.127
dhcp-range=net:2,192.168.1.128,192.168.1.191
dhcp-option=net:1,option:router,192.168.1.1
dhcp-option=net:2,option:router,192.168.1.2
dhcp-option=net:1,option:dns-server,x.x.x.x
dhcp-option=net:2,option:dns-server,y.y.y.y
dhcp-host=aa:bb:cc:dd:ee:ff, net:1
dhcp-host=11:22:33:44:55:66, net:2
.. etc ...
<don't forget to set a default for the MAC addresses you don't know yet, so that they get one of the two gateways, and can still be operational until you assign them>


Hope that helps.
Erwin9.
MemoryDump
DD-WRT Novice


Joined: 16 Sep 2013
Posts: 4

PostPosted: Tue Oct 15, 2013 17:56    Post subject: Re: Expanding on this idea Reply with quote
SierraSabre wrote:
So, I'm a bit new the the world of "advanced routing." I can configure my dd-wrt routers in various modes, but its very much a "follow the recipe" level. I'd like to learn more about these concepts. I've done some limited playing around and I am beginning to know enough to be dangerous. Which is a precarious position.

So I ask for guidance...

eibgrad wrote:

NOTE: It would be possible to use two routers *if* they supported VLANs. Then you could, in effect, create a shared third network and route between them. But I’m assuming this option is not available on your non-ddwrt router. So I’m taking that option off the table.


Not to threadjack, but can we put it back on?

So... VLANs. I've read about them, and I'm trying to figure this out. I'm trying to do something similar to the OP, and I'm a bit lost. I'd like to figure out a way to do something like this. Two DHCP servers, each serving a different subnet, isolated from each other.


eibgrad wrote:


So what’s the solution? USE A THIRD ROUTER!
Use another router to create the gateway you need between the two networks so you can access resources between them, AND without having to deal w/ DHCP conflicts.

Now how to configure that third router depends on several factors, such as whether there is a security issue w/ having cross network access. IOW, should we assume each network trusts the other? Should access to resources be limited to only the NAS, or wide open (all resources)? Or perhaps only in one direction? IOW, it’s like anything else involving routing between two networks. It’s really these details that are the most complicated, and only something YOU can decide.

So architecturally it’s not really all that complicated. It only gets complicated if you insist on trying to solve a three-router problem w/ a two-router solution!


Lets keep it simple, just for the sake of learning. Assume wide open access to resources. I can figure out the rest, I think.

How do you go about configuring that third (middle) router using dd-wrt?

did you manage to get this setup working?
I'm also looking at linking 2 separate networks together using a wire connection. (VLAN or 3rd router)
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