Access to NAS from 2 networks

blueoceanvn

Commendable
Jun 28, 2016
7
0
1,510
Hi!

I currently have 2 small networks, both of which provide internet to the networks (from different ISP)

Network A: Router Model No. TL-WR841N IP range: 192.168.1.x
Network B: Router Model: TL-WR740N IP range: 192.168.100.x

A LAN port from each is connected to a 24 port switch which connect to other computers and a NAS (Buffalo LS-WXL/R1) in the network. All PCs are assigned static IP.

I got help to create a batch file which allow each PC to switch from A to B and vice versa. The NAs however, can't switch itself. At the moment, the NAS's IP is assigned to network B.

I did some research about this and read some suggestion about using a crossover cable connecting 2 routers via LAN ports and statically route the 2 networks. But my networking knowledge is mediocre at best.

A more detail how-to or some other thorough instructions would be very appreciated.

Thanks in advance!
 
Solution
It will not automatically change you would need something to monitor the connection. In theory I suppose you could run some type of software that sends ping to the internet and if it gets too much loss it would change the gateway.

The first command to try is ROUTE PRINT.

What you will see is a entry that has 0.0.0.0 in it. This is created by the gateway setting in the nic card configuration screen.

Lets say you see 192.168.1.1 as the gateway and you want to change it to 192.168.1.2

You type
route delete 0.0.0.0 mask 0.0.0.0 192.168.1.1
route add 0.0.0.0 mask 0.0.0.0 192.168.1.2

This is really all you need for simple ISP swapping. To route a particular IP like 123.123.123.123 (fake example)
route add 123.123.123.123 mask...
let me understand what your saying,
so your using the Lan to Lan method to connect your routers together using a switch and plug PCs on to it. the batch files is used to reset the IP from one network to another (why they are in fact static addresses) and the NAS is on network B because it cannot run a batch file to switch over.

have you got the bridge function enabled on your routers ?
 

blueoceanvn

Commendable
Jun 28, 2016
7
0
1,510
Hi!
Yes, that's how my networks are running. Usually when the internet drops on one, I switch to the other by running the batch file.

I have no idea how bridging works with 2 separate LANs, to be honest. Please give me the Network for dummies version.

Thank you for your time!
 
The only reason you do not have massive issues connecting it the way you have is your are using static ip. You really should not overlap 2 different networks in the same switch.

Unfortunately you can not implement the real solution with consumer "routers". Even though they are called router most only have the ability to run a single ip range.

A hack that will work since you already are willing to deal with the hassle of static is ip is to change the ip of the second router to be in the same subnet as your main router. For example you could assign the routers 192.168.1.1 and 192.168.1.2. Everything will now easily talk to each other and instead of changing the IP on the PC with the bat file all you need to do is change the gateway ip which you can do with the ROUTE command.

Now if you get really ambitious you can actually use both ISP from a single pc by sending certain web sites to one router and the other web site to the other. This again is done with the ROUTE command in the pc
 

blueoceanvn

Commendable
Jun 28, 2016
7
0
1,510
Hi!
You're right. I used to have a lot of connectivity issues when I let PCs automatically pick an IP from the DHCP pool. It could be fixed by assigning static IP to each PC, so I was content with that simple solution.
Will changing the routers IP to the same subnet allow the PC in the network to pick up the internet when one of the connections drops?
Which parameters should I use with ROUTE command? It seems like a lot to ask but could you walk me through in details?

Thank you!
 
It will not automatically change you would need something to monitor the connection. In theory I suppose you could run some type of software that sends ping to the internet and if it gets too much loss it would change the gateway.

The first command to try is ROUTE PRINT.

What you will see is a entry that has 0.0.0.0 in it. This is created by the gateway setting in the nic card configuration screen.

Lets say you see 192.168.1.1 as the gateway and you want to change it to 192.168.1.2

You type
route delete 0.0.0.0 mask 0.0.0.0 192.168.1.1
route add 0.0.0.0 mask 0.0.0.0 192.168.1.2

This is really all you need for simple ISP swapping. To route a particular IP like 123.123.123.123 (fake example)
route add 123.123.123.123 mask 255.255.255.255 192.168.1.1

If you type ROUTE with no parameters you will see a simple help screen for the command.
 
Solution


You did well to get that working at all, poor switch! Why not just invest in a dual WAN router and save yourself some grief?
 

blueoceanvn

Commendable
Jun 28, 2016
7
0
1,510
Hello Bill!

In short, I'll have to change my network B gateway from 192.168.100.1 to 192.168.1.2 and using ROUTE delete and ROUTE add in a batch file to change back and forth between 2 networks? (English is not my primary language, so I had to make sure I understood correctly)

With this setup, network A & B will have the same range 192.168.1.x. All devices in the networks will be respectively assigned a static IP which will work with either gateway when it's changed. How will the NAS fit into this setup? I assume it won't have internet when the gateway it's assigned to is down?

Thank you for your time and your shared knowledge! It opens a lot of possibilities for noobs like me to learn and DIY.

@nigelivey, I know it's not an ideal setup but I'm trying to make do with what I have. I do have a Draytek Vigor 2910G which offer dual WAN. However, it somehow caps the speed at about 20Mbps while those TP Link routers can run at max theoretical speed (40Mbps). I tried updating the firmware and reset it to original factory setting but it didn't improve.
 
You are correct.

Does your NAS actually need access to the internet. It would only need access if you are accessing it from remote location or if you needed to say make copies to some cloud server. It is actually safer to not have any gateway set at all. It can always talk to the local devices no matter what.
 

blueoceanvn

Commendable
Jun 28, 2016
7
0
1,510


It works! Thank you very much!

As I was looking around in the TCP/IP4 properties, I saw in the advanced settings, the alternative gateway settings. If I understand it correctly, they're there in case the default gateway doesn't work? I also see a metric option which is set to automatic while the default gateway is set to 1.

[strike]Edit: It looks like there's something strange with admin privileges. Everything was working as expected when I was testing with the Administrator account. However when I switch to my daily use account which also has admin rights, it looks like this in the TCP/IP4 properties:
http://imgur.com/a/bjbJB
The default gateway address is gone! And I did run the batch file with admin privileges (right cilck Run as Admin..)

I ran ROUTE PRINT, the gateway was displayed correctly though. Internet was still available. Everything seems to be in order except that bit.[/strike]
Never mind. I looked through the help section of ROUTE and saw that parameter -p help make changes permanent. I added the parameter and it's done!