2

I am in the middle of setting up my home automation system with my Raspberry Pi (3B+), and I have a question regarding networking.

My Raspberry is running the Rasbian Lite derivative called Openhabian ( https://www.openhab.org/docs/installation/openhabian.html ). What I want to achieve is pretty simple. The raspberry is currently connected to my network using a LAN cable. But I want to move my home automation devices that don't need internet connection to completely separate network all together. So basically I'll set up a different wifi router and connect all of those devices to it. And I will not be connecting that router to my primary network. That way I can do anything with my primary network without breaking my home automation setup.

The idea of what I want is simple - the raspberry should connect to my primary network via a LAN cable, get it's IP from there (DHCP) and work like normal. But I also want to connect it to my home automation network via wifi at the same time. And it needs to be able to interact with devices from both networks at the same time.

Sadly I have almost 0 experience with Linux networking and I need some help on how to actually do this.

user3082900
  • 121
  • 1
  • 2
  • It's absolutely possible to connect a device to two networks at the same time. Do you have a specific problem which you experience or expect to experience? – Dmitry Grigoryev Jan 15 '19 at 09:25

2 Answers2

1

What you want is a wifi access point with a wired uplink to the switch (internet router?) on the primary network but without routing between the wifi interface and the wired interface. This way any devices connected to the access point can communicate to each other but cannot get into the primary network. From the RasPi itself you can connect to any device on the access point and also to any device on the primary network, for example to get updates from the internet. How to setup this you can look at Setting up a Raspberry Pi as an access point - the easy way and follow the instructions in section Setting up an access point and with eth0, without routing.

If you want to install a third device as access point and want the RasPi only to connect to both networks then setup its interfaces as normally. Just flash a default Raspbian Stretch image and connect the ethernet port with a cord to the internet router on the primary network. Then setup wifi as described at Wireless connectivity to connect it to the access point for the automation network. There is no additional configuration needed but it is important that you use different subnets for the primary and the home automation network, for example 192.168.10.0/24 and 192.168.4.0/24.

Ingo
  • 40,606
  • 15
  • 76
  • 189
  • Not really. I have my current wifi acces point/router that represents my primary home network. And I want my raspberry connected to that router via a cable. I will be setting up a completely separate wifi access point/router that will handle my home automation but will not be connected to my primary network router at all. All I want is my raspberry to have access to both networks (via wifi to my home automation one and via cable to my primary one). Automation devices that need internet will be connected to my primary network anyways. – user3082900 Jan 01 '19 at 19:50
  • @user3082900 I think that is exactly what I suggested. Or do you do not want the RasPi to be the access point and instead setup a third device as access point? – Ingo Jan 01 '19 at 20:32
  • Yes. I want a separate device to be the access point. I just want the raspberry to connect to it. – user3082900 Jan 01 '19 at 20:40
  • 1
    @user3082900 OK, no problem doing that. But I do not understand why do you want to spend extra money for a third device as access point without any benefit. The RasPi can do it. There is no difference. I have updated my answer. – Ingo Jan 01 '19 at 21:24
  • 1
    Because I have a few cable devices that need to be connected as well. It's primarily meant for wifi devices, but I have two devices that need a cable. And it is easier to manage If you have a nice web interface. I will try the solution and see if really is that simple. – user3082900 Jan 01 '19 at 23:18
1

You can connect both interfaces to their respective networks...as long as you set the default route to go out of your LAN interface (for Internet access), you shouldn't have to do anything else.

I don't run your OS, but I just add a line in /etc/network/interfaces to specify the default route. There should be a lot of guides for "set default route Rasbian Lite"...you might be able to set the default route in the GUI (if you use one)

Some additional advice though, is to use a different IP space for each network. Since they both use DHCP (I assume), it might make future troubleshooting easier to know which network a device is on, based off of the IP they get.

PeeEss
  • 76
  • 2