Multiple nic's as network switch

Hello, I just moved my HAOS pc and my 8 port switch to a new fanless PC with 8 nic’s.

Except for one port that connects to my router I want to use all other nic.s to be used for the camera’s I had connected to my retired switch (in the same network). In other words I would like to use them as a switch.
HA is working fine. I only do not see the camera’s (they have all static IP’s)

Using nmcli it apears these camera nic’s are waiting for a DHCP offer. But naturally it will never get one from a camera.
I have searched this forum and also serveral Linux on how to do this.
Can anyone tell me how I can configure these NIC to be in the same network as HA?
Thanks.

You might be able to use this addon as a DHCP server for your NICs:

However this will not perform switch routing.

1 Like

As @tom_says you will need this to work as a switch, which is not going to be easy to accomplish. You can run pfsense on your own hardware and it will do everything that is needed. However that’s a pretty advanced setup. I’d just get an 8 port smart switch and use the existing dhcp on your router.

2 Likes

Kinda thinking out loud a moment… one possibility would be to run your PC as a Host and your HA instance as a Guest VM, and connect your NICs using a kernel bridge running on the Host. This kernel bridge would also connect your HA VM as well as your Host’s networking interface. So in effect, the kernel bridge is like a 10 port switch with 8 physical ports (8 Physical NICs) and 2 virtual ports (Host and VM).

If i’m correct I understood that HA is already running as a kind of VM using docker (or alike). Would that not give the answer? And if so, would I best use portainer to manage it?
I cannot try this out immediately as this HA is literally on the road now and although I can contact it via startlink, I’m a bit anxious to start modifying the network right now.

Yeah can kind of be confusing, but in the context I’m speaking about, running HA as a VM will use an “image” that has been put together by the HA team to run on a VM. This HA “image” includes HAOS, Supervisor and several Docker Containers, and this is all running inside the VM.

I understand. I do have some experience with vmware. Point is now that it is quite imposible to remotely reconfigure HAOS so it will be running as a VM. I have no experience with docker. But I assume docker has direct access to all NIC’s and is also manageing the networks of all containers. Including HA. Am I right? If so what kind of network configuration should I make for HA to ‘see’ the other nic’s. Do you call it “nic teaming” or what?. tnx!

What you want to do is called a network bridge. I have set them up before in Windows and Linux but not in home assistant.

The multiple NIC setup is something I don’t have really any experience with in that all my setups have been with a single (Ethernet) interface. This thread indicates that HA will see all the interfaces, at least those with an IP address, and I believe this to mean that HA supports multiple IP networks (for example each NIC being on its own IP network; example NIC1 on 192.168.0.0/24, NIC2 on 192.168.1.0/24).

Your application is different in that you want multiple NIC interfaces that are Layer 2 bridged internally to all the NICs. I just don’t think this can be done with HA and its Docker setup, and if it could in theory be done, the configuration needed within HA is likely to be very problematic.

Sort of correct, but if you are running HAOS, then HAOS is the one controlling docker and you can not really do anything without breaking the compliance with HAOS.
Installing another container out of HAOS control, like with portainer, will make HAOS go nuts.

You can either go with a HA core installation instead and have docker provide a switch/bridge setup.
Or you can install HAOS in a VM and either have another VM with the NICs ported in to run a switch/bridge setup or maybe use the features built into the hypervisor to run it.

In my opinion you are complicating yourself needlessly. A PC is a PC and a switch is a switch. Like PeteRage said, just get a switch and connect the HA host and the other end devices to it.

2 Likes

I retired my switch due to lack of space after I upgraded HA from Rpi to small fanless PC :frowning: . I learned HAOS is built on busybox, just like VMware server. See if I can get further on that track. Maybe indeed pfsense might be a solution. But then not as a HA addon but straight on top of HAOS.
I just have to wait till my HA is back home (in about four month time). ( or setup a local HAOS as VMclient and try from there on)
Thanks for your efforts anyhow! Appreciated that! Also that I’m not the only one that cannot answer a seemingly simple question :dotted_line_face:

HAOS is running with a limited configuration, so do not expect you will be able to build anything on top of it.

Sure doesn’t sound that way based on his description. Sounds like all this stuff will be in the same network, which by definition is not a bridge.

What he is doing is simply putting multiple NICs in a single machine. It’s not even multi-homed - since again, all the NICs are on the same network.

A bridge is on the same network. It is used in network hubs and switches.
If they are not in the same network, then you will need to be routing it instead.

Incorrect.

Bridge, hub or switch, depends on the place you where you stand and where you are looking at.
My ‘normal’ access to HA is at 192.168.2.7, all my camera’s are on 192.168.2.4[0-7], so for communication between these IP’s I would need a hub or a switch. But I noticed HA itself is on network 172.30.32./23 just as serveral HA services.

So technically HA is routing to 192.168.2/24. The fact that HA nmcli ‘sees’ both networks confuses me.

IF it routes to 192.* then it would be impossibe to use other Nic’s on the same network. Still I can configure those Nic’s from within HAgui to have the same 192.168.2.7 IP address without any complaints. (they don’t see the camera’s though, probably due to the fact you need to supply a gateway and HA uses that gateway for all request: they will end up at my modem).

IF it bridges to 192* there should be multiple IP’s configured on the same interface. And that is not the case.

So my conclusion is that somehow I need a command that enables all cctv nic’s to use the same network stack as the 'main 192* nic. a hub like function. (neither switch nor bridge)…
I am realy surpised this is not a standard built in function/behaviour of a tcp stack.

Understand that an ethernet switch is not just a CPU connected to a bunch of NICs.

Switchports are PHYs all connected to an 802.3 compliant asic… which processes ethernet frames far more efficiently than a CPU/NIC.

Think of it like software rendering vs an rtx 4090.

Additionally, trying to accomplish this inside haOS on bare metal is asking for trouble.
It’s not a linux distribution that intends for users to modify the networking stack.

If you MUST, then virtualize haOS, then build your virtual network(s) inside the hypervisor host environment.

4 Likes

You network knowledge is lacking.
You need to understand what layer in the ISO model you are working on and how ARP tables and routing tables work.
You also need to understand some of the basic error handling in a Linux network stack.

  1. Giving all NICs the same IP and connect them to the same subnet would make the first one work and the rest disable with a “duplicate IP” error. Giving them different IP on the same network would prevent this error.

  2. Having multiple NICs connected to the same subnet would mean an incoming packet would arrive on multiple NICs and that would trigger a “storm surge error” and probably disable all NICs.

  3. Having multiple NICs connected to one or more subnets with the same IP range would mean only one would handle outgoing packets,because the routing is done on layer 3 in the OSI model.

1 Like

Even an old desktop machine will beat the hell out of a modern dedicated switch or router with ease.
It is correct that switches and routers have ASICs optimized for switching and routing, but is only to give them a fighting chance against normal CPUs.
Normal CPUs alone is often way more expensive than a complete dedicated switch.
The special ASIC is not to beat a normal CPU on speed, but to beat it on costs.