Multiple Routers used at Once

If you mean by

  • "VPN router" => "VPN connection" and
  • "standard router" => "standard internet connection"

then I would expect that to work. I even think that works without any specific changes to your node-red application.
Of course the hard part is setting up the VPN connection and also assuring that node-red can securily be accessed over the internet.

If you connect to them separately, via two ethernet cables or via wifi and ethernet, then they will both be connected. What makes you think they are not both connected.
If there are two mqtt brokers then this is where the issue arises. You will need to setup routes on the pi so that one is accessed via one router and the other via the other router. This is nothing to do with node red (or mqtt) you will need to research how to setup routes on the pi.
Once you have setup the routing then if you use two MQTT Out nodes and connect one to one broker and the other to the other broker then they will both be updated at the same time.

Since they have different external ip addresses then if you access via the appropriate ip address then it will go through the correct router.

I will point out again, he may have and need two external IP addresses, but as far as I can see he only needs one internal IP address. A topology drawing would be most helpful.

Hi Gerry

That is correct, they will have the same ip , the problem is using two routers at the same instance and controlling which is used when and where for what data.

How would you connect the pi to the routers and the routers to each other in that case?
[Edit] Each router is connected separately to the internet in order to perform some interactions via a cheaper connection.

What aspect of that problem have I not pointed to the solution for in post 22?

[Edit] For directing the connection to the mqtt servers from the pi via the separate routers you can use the ip route add ... via ... command. See https://www.cyberciti.biz/faq/ip-route-add-network-command-for-linux-explained/

A topology map would sure be nice but in the absence of you providing one.... You can have numerous routers in a network all providing different connectivity to different networks for different purposes. Trying to explain how all that interconnects would be the subject of a very long course. You have a Pi with one ethernet interface of say 192.168.1.1 and a sub net of 255.255.255.0, One router is at 192.168.1.254 and the other one is at 192.168.1.253 say, in each instance both routers can see the Pi and route any outside traffic to it. You will have to open the exact same port in each router to point at the Pi IP in order to connect. The problem is going to be if you have other traffic running on the same port on a different IP among others. You will have to set that port to be forwarded to the Pi IP of 192.168.1.1 on BOTH routers and then no other traffic on that port will get to any other devices on the network. You will have to set a default gateway in the Pi to one of the two routers, should be the one you use the most and then the Pi will have to bounce through that router to get to the other router. Note that the outside IP will be different on both routers so you will have to use one outside IP to get to the VPN and another outside IP to get to the other router. Without more information that is going to be as close as I can get you. I have setup more than a dozen routers on the same network and it is a lot of work to sort out IP's and subnets and default gateways and such. I'm sorry to be skeptical but from the questions you are asking I feel that the router programming may be out of your reach. Is there not a network/hardware person in your organization that can help? You will need access to the routers programming and the chances of you messing up the entire network is high if you don't understand how all the devices mesh on the network. My recommendation would be to tread very carefully before you start re-programming routers.

Yes of course, you are right. I had not considered the possibility of both routers LAN side being on the same subnet and just connecting them together. Simple when you know how.

Maybe a bit out of my depth, but rather than have 2 x LAN/WiFi connections to the Pi, just connect one router to the Pi via LAN or WiFi with that router set for DHCP, then connect the second router (with its line to the internet) to a LAN port on the first router with DHCP disabled.
Then both routers would be connected to the outside world via two different connections and 2 independent external IP addresses.
They will both be on the same LOCAL network and as mentioned by Gerry one could be the master DHCP server on 192.168.1.254 and the other would be on whatever the first router allocates to it.
I do very similar with my (master) router connected to my normal telephone line and then a second router running as a WiFi bridge connecting to a WiFi hotspot as a backup.
If I was to connect to my local network from the OUTSIDE world (WAN), I can actually do it via two completely different IP address.
Maybe this is what your trying to do Edward?

1 Like

This is very similar to my setup, with two routers providing different local networks - one for general use and one for my home automation devices. Since they're connected together I can access the Node-RED dashboard from either, but for the one connected to the external line I use a non-standard port and secure connection, with port forwarding to the Node-RED server.

I think what @edwardr likely needs is just this - port forwarding from each public-facing router to its appropriate Node-RED or MQTT server, with each of these having a specific static IP on the local net.

1 Like

This is exactly right. Thank you so much for your answer! I`ll be attempting this and will keep you updated as to how it goes.

That is exactly right. Both you and Martin have hit it exactly on the head. I will keep you updated on how I get on.

1 Like

You can have two separate IP's easily and as long as the PI sees both routers there are a number of ways to make the network connections. Just be careful setting up the subnets and set the PI's default gateway to the router you want it to access the internet through.

1 Like

One more time, be very cautious, you indicated this is a company network. Enterprise routers are nothing like residential routers being far more complex and most don't have a GUI interface. Tread carefully. And make sure your network connections don't create a loop.

Thank you Gerry, regarding routing tables , which would I use to transfer data between the two routers - I have the option of Main or Wan?

Your question makes no sense - with what you are saying it seems to me that you are using OpenWrt - the routers will not transfer infromation amongst themselves.

You need to give us specific examples of IP addresses you are using and what Routing platforms

Craig

@craigcurtin has a good point, specifics would be necessary and one small point. I'm not against giving advice, that's the point of a forum, but you'll need to do the heavy lifting. Router programming can get very complicated very quickly and I'll give advice but you will have to at least get started. I'm not going to give you all the programming, you need to learn it and I'll help as I can.

Hi Gerry,

I don`t expect you to spoon feed me here, I appreciate your advice and like anything , will work at it until I see results so no need to comment such :slight_smile:

Yep so give us a network diagram and a listing of what equipment you are using and relevant IP addresses.

Craig

I use a Pi with a USB Ethernet adapter, the on-board RJ-45, and WiFi at the same time on an enterprise network. The Pi is able to talk to devices on each of the 3 networks without any issues. I am also able to connect my PC to any of the 3 networks to edit my Node-Red code and Node-Red sends data to devices on the correct network using the UDP node. However, each network is on a different subnet. I think this allows the Pi to know who to send data to without any special configuration.

If you must have the routers on the same subnet you might be able to look into the metric settings, but that goes beyond my networking knowledge. Also beyond my knowledge is subnetting, but maybe set a network adapter to 255.255.255.240 and the other to 255.255.255.15, or something similar?