Page 1 of 1

How to write dynamic command line?

Posted: Tue Oct 16, 2018 10:05 am
by giguard
Hi,
See below for command I'm interested in.
/interface bridge
add admin-mac=AA:BB:CC:DD:EE:FF auto-mac=no name=mybridge
Assuming AA:BB:CC:DD:EE:FF is a MAC address of the ether1 and I'm planning to make ether1 as a master of mybridge.
I want to covert above command to look something like,
/interface bridge
add admin-mac=[ /interface ethernet print mac-address where name=ether1 ] auto-mac=no name=mybridge
Now I know above command does not work. But it should be very clear what I'm after here.
Is there a way to do this so I can have it permanently written inside my default config file and use it across many devices?

Re: How to write dynamic command line?

Posted: Wed Oct 17, 2018 4:19 am
by 2frogs
You was nearly there with your code.
/interface bridge
add admin-mac=[/interface ethernet get [find where name="ether1"] mac-address] auto-mac=no name=mybridge

Re: How to write dynamic command line?

Posted: Wed Oct 17, 2018 5:26 am
by giguard
Excellent. !!!

While we are on the topic, I woud like to know if I was to use auto-mac property would it effectively do the same thing?
Meaning, can I drop the admin-mac entirely and rely on ROS to do the right thing?
/interface bridge
add auto-mac=yes name=mybridge
I'm guessing that ROS will automagically pick up the MAC address of the very first interface that joins the bridge right? Or, is this not a guaranteed behaviour?

Re: How to write dynamic command line?

Posted: Wed Oct 17, 2018 6:56 am
by 2frogs
Using auto-mac, the MAC can change after a reboot. Not so great if you are using the MAC for static lease or for other hard coded settings.

Re: How to write dynamic command line?

Posted: Wed Oct 17, 2018 5:54 pm
by mkx
Using auto-mac the bridge MAC address can also change if you remove the "donnor" port from the bridge. Having bridge MAC address set statically could show even nastier side-effects in such case.
The best approach would be to set bridge MAC address to a completely different MAC address for which you're 105% sure it'll never show up in your network. Such as MAC address of a physically broken ethernet NIC that happens to lie in the back of your bottom drawer instead of being disposed off properly years ago.