I have Mikrotik router hap ac3.
I have 4 sensors which produce data constantly. They are connected to router’s LAN ports and the Internet port is connected to my PC’s network adapter.
I want to switch over the LAN ports in order to receive the data of ONLY ONE sensor at a time.
My first thought was to disable all LAN ports and enable only the one I’m interested to. I do that automatically with a microcontroller which sends commands to the router’s SSH.
Is a router the right device for this or I need something else? a managed switch maybe?
What happens with the data when the port is not active ?
Simply discarded ?
SSH from microcontroller looks like a viable solution.
Can not think of another way (except for a leprechaun pulling the cables and inserting again at a set frequency ).
EDIT: DAMN … IP/ Kid Control is INDEED the proper way to do this !
It’s really simple.
In IP / Kid control, Kids, define your schedules with on and off as needed
In Devices use your device’s MAC address to define the device and required schedule.
And off you go …
@rextended, on previous types of this functionality on other vendor products, if there was a session in progress the STOP time had no effect. It would not allow new sessions to commence after the stop time. Can you clarify, for the OP, if the sensor data being passed will be truncated at stop time, or will continue until the data stream associated with the current session has stopped?
Thankfully we have microcontrollers because I hate leprechauns.
From your answers I suppose that Sensors ----LAN port----- > Router ----INTERNET PORT-----> PC is not wrong. I was concerned about that more.
Kid control sounds good. I’ll give it a try. Thank you both.
Nothing - you can use scripting on Mikrotik itself to actually disable the ports if a fixed schedule suits you, or use an ssh login authenticated using the private/public key pair to let some external device issue the necessary commands when really needed. Or there is something in between, you can just send packets to particular UDP ports, or even packets of a particular size, to instruct the script on the Mikrotik which port to enable. Blocking traffic by MAC address, which is what kid control does, is not the same like disabling the Ethernet port completely.
I’m rather curious what makes you need to permit only one sensor to communicate at a time - is the data collection application unable to receive information from more than one sensor, or vice versa, do all the sensors have the same fixed IP address so they cannot be connected simultaneously? Because this latter possibility could be solved using connection tracking if at least teh application can query different addresses.
What is the real problem you are trying to solve? This smells to me like an XY problem
To me this seems like you are trying to solve the problem with the wrong tool (the network).
Why should the router be involved? What type of sensors are involved? Is the problem that you are using a closed system and can’t have it ignore data from sensors?
The point is, you may be able to have a kludge “solution” using the router to work around a problem, but it seems like you are treating the symptoms instead of the problem. And then when ROS features change your “solution” may break. For example, if kid control feature changes.
The software is designed to visualize only one sensor at a time. But it only asks for a fixed IP address in order to recognise the sensor and establish connection.
We’re checking if it is possible to trick the software and making it believe that the router is the sensor and accept any data coming from it thus accepting data from multiple sensors one at a time. That would be a big upgrade for this software. Definetely there are more details into this, but that’s the main idea.
I’m considered with the network part because the sensors and the software are not really configurable. They are marine sensors fyi.
I only need a way to have multiple ethernet ports and let the data of only one at a time to pass through and fed to the software.
Like a home network which has only multiple devices and only one gateway, but imagine that only one device at a time can use that gateway.
And yes, I’m really not sure if the network part is the solution, but I have to start from something.
The sensor just send a simply udp packet that the software receive because it coming from specific ip?
Assign to the sensors one different IPs, on that way all can be online without block something, and with NAT alter the src-address of the packet from all the sensors,
for appear to come from only one unique ip…
xyproblem detected…
Interesting.
I said in my first post that I want to receive data from only one sensor at a time, I didn't put constraints on how I should do it. Enabling/disabling ports was just an idea.