I have a unique situation where a Mikrotik router is rack mounted onto a mobile cart (with wheels). It travels between an office and a remote location. When its at the office I need its ip address to be 192.168.12.8 /24 , however when its at a remote location i need its IP address to be 192.168.12.1 /24.
To make this easy for the personnel moving the wheeled rack (and thus the mt router), i was hoping that i could assign 192.168**.12.1 to eth5** and 192.168**.12.8 to eth7** and simply moving the physical ethernet uplink cable between eth5 and eth7 would “change the IP” (only one eth port is active at a time, EITHER eth5 OR eth7, never both).
However when i test this, it does not work- both IP address will be active or cause conflicts. ie, it only eth7 (12.8) is uplinked, and eth5 does not have a eth cable attached, i see issues accessing 12.8 until i disable the 12.1 IP address. the same is true for the opposite (ie if eth5 is connected, and eth7 is not, i have issues until i disable the IP address 12.8).
Does anyone have a solution perhaps? my goal is to make changing the IP address very simple and for me to not have to remote into the router everytime it changes physical locations, ie make it so that the personal simply move an eth patch cable and the proper IP address is active (and the other is inactive).
I thought on RoS that if you assign an IP to an in-active eth interface, that IP only become active/live if the eth port is LINKED?
thanks
note, i did come up with this script as a kind of sloppy way to do this, but i wanted to see if others had a better idea or way than a script that runs via scheduler every 10 or 20 seconds..
{
local status [interface ethernet get ether8 running ]
if ($status = true) do={
/ip add disable [find comment=“away”]
/ip add enable [find comment=“office”]
/log info “eth8 IS ENABLED ip 8 enabled ip 1 disabled”
} else={
/ip add disable [find comment=“office”]
/ip add enable [find comment=“away”]
/log info “eth7 IS ENABLED ip 8 disabled ip 1 enabled”
}
}