I have a question which is puzzling me.

I have a couple of custom electronic devices (are identical, one is a master and the other is a slave) which implement only up to level 2 of the ISO/OSI layer, so they have only a (different) MAC address

If I connect one of them to my PC with a straight connection (e.g. the ethernet cable from the PC's ethernet card to the ethernet port of the device) , then I can connect and exchange data.

Now I have a more complex situation to handle.

The two devices are installed on a pole along with an IP camera. These 3 elements are named “sensor group”. I can have up to 7 sensor groups installed in a given area, for a specific task.

I need to connect those 7 sensor groups to a single local PC, in a room, with a specific SW (developed by myself) running.

I was thinking to use a network switch for each sensor group with a cabling (maybe fiber) to a network switch to which the PC is connected to. So, each sensor group, thanks to its local switch can communicate to the PC.

Now my point is: which kind of equipment I need to use (layer 2 switch, layer 3 switch, hub, router ...) in order to allow both a connection between the SW on the PC and each specific custom device in a sensor group, and to receive the RTSP stream from the camera, too? I am really struggling because it is the first time for me to face this kind of need with these “only-MAC” devices.

Thanks! LuKa

  • Hello Lukariello and welcome to NE. What kind of things are the special devices?
    – jonathanjo
    Dec 15, 2018 at 17:53
  • 1
    I'm sure you meant RTSP (real time streaming protocol, used by some cameras) not RSTP (rapid spanning tree protocol, used on switches), so I edited as such.
    – jonathanjo
    Dec 15, 2018 at 18:22
  • Hi jonathanjo, the special devices are custom made electronics equipments which are able to perform real time environment analysis like specific gas presence in the air. They are “safe” and so communicate via rs 232. Their eth connection is for maintenance and set up purposes and for real time data transmission to perform specific debug.
    – Lukariello
    Dec 15, 2018 at 18:24
  • 1
    The point is that the use of serial comm is due to safety aspect strictly regulated by standards which do not allow IP communications. Anyway, my concern is not about serial communications but about eth port connections. That latter kind of connection is only for debug/setup purposes and the point is being able to connect from the monitoring pc to each of the custom device without going near the pole where each device is mounted.
    – Lukariello
    Dec 15, 2018 at 19:12
  • 2
    What happens if you have several of these devices connected to a switch, and your PC connected to the same switch? Does it all work OK, or do you need to be able to "isolate" each device and communicate with only device at a time?
    – jcaron
    Dec 15, 2018 at 23:03

2 Answers 2


The question doesn't really say much about the special devices and the software which communicates with them and how it knows which ethernet address to connect to.

Lukariello added in comments:

The point is that such kind of connection (several devices connected to the same switch) has never been tried before. Up to now the connection between the PC and each device was made “point to point”. Now, for logistic constraints it can't be made this way any more. So that is the reason I need a little switch (or at least I think a switch will do the job) at each pole, collecting all the data (2 devices + ipcam), and a switch at PC side, connecting each single pole switch to the PC. So, if I use switches how to “talk” with each device? How to realize a point-to-point connection?

You really need to find this out as it completely changes what you have to do for the networking.

This leads us to two cases:

    1. where the software can choose which device to communicate with, perhaps by selecting the ethernet address
    1. where the software only works if it has a single device visible on the ethernet

The following describes what to do for these two cases. As an observation, the complexity involved is exactly what internet protocol is for: it takes away all these difficulties, and -- still amazing to me -- works perfectly over high-speed LAN and global WAN.

1. On the assumption you can choose which device to connect to by ethernet address: use a single flat ethernet

If your sensors are layer-2 ethernet only, you must have just switches (and no routers) between two communicating devices. So if your devices communicate with the PC, that means they must all plug into the same switch, or a network of switches. One obvious setup is exactly what you describe: have a small switch per sensor group, and link the seven sensor-group switches to a main switch next to the PC, by fibre or cable depending on distance and speed. But it all depends on the physical layout.

If you additionally have layer-3 cameras, they will work fine because internet protocol will sit perfectly well on top of ethernet.

In the diagrams, C1 is camera 1, S12 is room 1 special device 2. Switches are ===+===.

  S11 S12 C1         S21 S22 C2
  |   |   |          |   |   |
==+===+===+===+==   =+===+===+===+== ...  Simple room switches
              |                  |
              |   +--------------+  <-- fibre if far
              |   |                     copper if not
              |   |      other rooms
              |   |   |   |   |   |   |
            ==+===+===+===+===+===+===+===+== Simple main switch

You only need routers if you have different layer-3 networks which need to communicate. A so-called "layer 3 switch" is actually a switch with a router built in to the same box: you don't need one.

Additionally, if you have VLANs, communicating layer-2 devices must be on the same VLAN. (Thanks @Criggie) This would only be the case if for some reason you were obliged to use VLANs, such as an existing set of switches with VLAN per room or something similar. If you're starting with new equipment, and about 20 devices, a simple single flat ethernet made up of plain switches (no VLANs, no layer-3 features) will be best. Especially if you're in a regulated environment which requires simplicity -- which I'll guess means you don't want to share infrastructure with other purposes. One of the risks of a network which is only used for configuration is that is is used infrequently, and it can be tricky to ensure that it will work when you need it.

Other relatively exotic setups are also possible: bridges and wireless access points count as switches here, as do hubs and coax ethernet. If the PC behaves as a trunk you could conceivably use different VLANs. However, simplest will almost certainly be best.

2. If you can't select a device by ethernet address (CABLE SOLUTION)

My assumption is that the software running on the PC will connect to the one special device on layer 2 ethernet. (As an opinion, this is horrible, but if this is what the equipment does you might have to work with it.)

Consider just running the cables! (You don't say how far it is.) It's very simple and so long as the distance isn't too far, will work perfectly.

Here you simply have three ethernet cables per room, running back to a patch panel next to the PC. Plug all the cameras and the PC into the switch. Configure all these with IP addresses in the ordinary way. Plug only one of the special devices into the switch, here shown as S71.

  C1  S11 S12   C2  S21 S22    C7  S71 S72 
   +   +   +     +   +   +      +   +   +  Patch panels in rooms
   |   |   |     |   |   |  ... |   |   |  <- building wiring
   +   +   +     +   +   +      +   +   +  Patch panel near PC
   |           +-+              |   \______
   +-------+   |                \_____     \  <-- "selector" patch cable
           |   |   other cameras      \    |
           |   |   |   |   |   |   |   |   | 
     ==+===+===+===+===+===+===+===+===+===+== Switch

3a. If you can't select a device by ethernet address (VLAN SOLUTION + 2 NIC)

This is considerably more complex for the networking, but nonetheless easily achievable. It's basically a VLAN variant for the cabling solution.

This is an illustration of one scheme, many variations are possible.

We'll use a central switch and one switch per room. The switches must be capable of VLANs. We put each special device in its own VLAN. Special device 1 of room 1 goes in VLAN 11, device 2 of room 7 goes in VLAN 72. (You can pretty much make up whatever scheme you like for this.) Additionally, we use VLAN 1 for the cameras. On the PC, we put two network cards, NIC1 and NIC2. NIC1 is put into VLAN1 and configured with an IP address in the ordinary way, and this communicates with the cameras. NIC2 is plugged into a port in the main switch and you change the VLAN of this port to connect to a different special device.

For example, if you put the NIC2 port into VLAN 52, by using the switch's control panel or command line, there will be an ethernet with Room 5's device 2 and the PC. You then run your software. With a suitable switch and PC you might be able to script this easily if that helps.

This scheme is good if the rooms are far apart and cabling is expensive; also good if you want to use fibre optic links for distance or electrical insulation.

Switches now show as ==1===2===T==, where 1 and 2 indicates access ports on VLAN 1, 2 etc, and T shows a trunk port.

Two NIC solution:

   S11  S12  C1            S21  S22  C2
    |    |   |              |    |   |
===11===12===1===T===   ===21===22===1===T=== ...
                 |                       |
                 |   +-------------------+  <-- fibre if far
                 |   |                          copper if not
                 |   |      other rooms
                 |   |   |   |   |   |   |
                                             |   |
                                             |   |
                                             |   |
                                            nic1 nic2

With this scheme, you tell the switch to make the appropriate socket an access port on a particular VLAN (the socket NIC2 is on). With a suitable switch (eg Cisco with command-line interface), suitable configuration (eg SSH with keys so password not required), and suitable client (scriptable SSH client), you could automate this easily with scripts to run on the PC.

This scheme is the most likely to work, but depends on whether the software which runs on the PC is able to select which NIC to use. If it's so fussy as to only take a particular NIC, you'll have to use that one.

3b. If you can't select a device by ethernet address (VLAN SOLUTION + 1NIC)

One NIC solution: if the PC supports trunking (depends on operating system), you can configure the main interface to be VLAN 1, connecting to the cameras. Then, according to which special device you want, you configure a subinterface in the required VLAN and run your software.

                 |   |   |   |   |   |   |
                                             PC  <- needs trunks

With this scheme, the PC can change the VLAN of one of its subinterfaces and get a connection through to a single special device. You'd have to try this with your operating system to see if your software works with the subinterfaces; if it does this is likely to be the least aggravating solution.

  • 1
    I'm guessing OP's situation is at work, where managed switches and VLANs may be deployed. Might be worth adding "PC and devices must be on the same VLAN"
    – Criggie
    Dec 15, 2018 at 21:37
  • Hello Criggie, so, if I got your point, each pole switch shall be configured to have 3 VLAN. Two for each device and one for the IPCam.?
    – Lukariello
    Dec 16, 2018 at 9:35
  • 1
    No, only have VLANs in your application if for some reason you are obliged to. @criggie was saying that if there are VLANs, your L2-only devices must be on the same VLAN as their communicating PC. There seems to be no benefit in separating the sensor devices from the cameras or each other. The simple setup you describe in the question is the best.
    – jonathanjo
    Dec 16, 2018 at 11:38
  • @lukariello -- if you can't address the devices, you might have to do what you're saying. I've rewritten my answer to cover this.
    – jonathanjo
    Dec 16, 2018 at 12:23
  • @honathanjo, the solution number 3 (VLAN SOLUTION) seems to me to be the best, especially if I have not to interact with the switchers physically but I can access the central switch" with a command line tool (eg. Window's cmd.exe or something like that) to select the VLAN and so access a specific device for maintenance purpose.
    – Lukariello
    Dec 21, 2018 at 14:35

If the devices only communicate at layer-2, then you use a layer-2 switch. A hub (layer-1 device) should work, too, but they are practically extinct, and they have the problem of collisions. Routers work at layer-3, and they strip off the layer-2 frame, so that will not work for layer-2 communications.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.