Score:0

Can you connect two PC ports with different subnets to one unmanaged switch?

my flag

We're in the process of designing a machine with a Windows PC inside its electrical cabinet (a Beckhoff IPC like this one). Among other things, there will be some GigEVision cameras connected to that PC. (GigEVision is basically UDP with maybe some TCP mixed in.) Unfortunately, one gigabit connection is not going to have enough bandwidth for all the cameras so we'll need two.

In order to avoid having to buy two switches and find space for them, I got an idea to connect two PC ports to the one switch, using two cables. I can put different ports and their corresponding cameras on different subnets to control which data goes through which ethernet cable.

Is this a good idea? Has anyone here tried something similar? If yes, how did it work out, were there any problems? Otherwise, does anyone know if this should work in theory or is it a terrible idea and just asking for trouble?

If it matters, everything connected to that switch will have a static IP address. Also, the switch will probably be an unmanaged Weidmuller one like this.

relatively_random avatar
my flag
I apologize if it turns out the question is a bit off-topic here, but I don't know where else to ask.
dodexahedron avatar
in flag
What are you trying to accomplish here? Are you trying to segment your IP camera networks? What is your IP address scheme? Are all devices on the same subnet?
relatively_random avatar
my flag
@dodexahedron None of the devices talk to each other, just to the PC. I don't care about subnets, I control all IP addresses so I can set them up however I want. I plan to use the subnets simply as a way of guaranteeing which device's data goes through which cable. (For instance, if I had a port 192.168.1.11 and 192.168.1.12, I can't tell camera's API which one to use to connect to a camera 192.168.1.101. But if the second port is .2.12 and the camera is .2.101, then I know the API can't use the first port.)
dodexahedron avatar
in flag
This is a layer 2 problem, then, and one which likely needs a managed switch. The problem is that ARPs from the cameras and the PC will cause the switch to broadcast at least the ARPs across all ports. But, you may POSSIBLY get what you want by using unique subnets, if your switch is smart enough. Most switches don't forward traffic out all ports once it has learned the IP-MAC mappings (one of the key distinctions between a switch and a hub). Just note that ARP and any multicast and broadcast traffic will still hit all ports, but that should be negligible in the grand scheme of things.
dodexahedron avatar
in flag
You'll need to use an IP addressing scheme like you mentioned in this comment, or subnet smaller than /24 and keep each camera in a unique subnet, if you want to get this behavior. Also, it will matter how your OS is configured, as many may respond to any local address on any physical port (weak host model).
relatively_random avatar
my flag
@dodexahedron I wasn't aware of the strong/weak host model distinction, thanks for drawing attention to that. I'll be sure to check how the PC's configured.
Score:1
cn flag

It's not a terrible idea (but neither a particularly good one). Things should work really, but in the end you will need to have two gateways anyway (two routers or a rounter with multiple ports) which serve these two subnets, otherwise they won't be reachable between themselves.

Also, you should really be able to put two different IP addresses but from the same subnet, that should negate the double gateway and possible drawbacks of having two subnets on the same physical network.

relatively_random avatar
my flag
We don't need any routers because subnets can be completely isolated. All cameras communicate with just the PC and nothing else. I'm worried about having two ports on the same subnet because then I can't easily control which camera sends data through which cable.
briskola avatar
cn flag
In that case it should work as expected, and there shouldn't be any security concerns seeing you don't have any outside connectivity. Once the PC's NIC and appropriate camera learn of each other's MAC addresses, they communicate via layer 2, and the switch learns via which of its ports each MAC is reachable, so the traffic will go exactly as you predicted and there will not be any flooding of other ports (that was how the hubs worked).
Score:1
br flag

If this is a 'one to one' connection between the camera/s and single PC then why not just put more NIC ports in the PC and run a cable between the cameras and these ports - then just set each 'secondary' NIC to it's own non-routable IP address, same for the camera and then the PC will be able to route to each camera just fine. This'll save you switch ports and all the extra cabling/config on the switch as you described and each camera will have the full bandwidth of the link to themselves - quad cards are quite cheap too.

Anyway just a thought.

relatively_random avatar
my flag
We directly connect one camera to one PC port directly whenever we can. Unfortunately, it doesn't seem like an option on this project. But yes, if all else fails, we'll have to get a new PC (this one doesn't have PCI slots) and find more space for it.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.