Script Tips

Hi -

I picked up a new CCR 24 port 5125 and would like to figure out an easier way to change things.

I’d like to rename all the ethernet ports, and de-slave them from the default. I’m having trouble grasping how to do this without accidentally disconnecting/shutting down my network connection while I’m trying to do this. :slight_smile:

I see that in the default configuration

/interface ethernet
set [ find default-name=ether1 ] name=ether1-master-local
set [ find default-name=ether2 ] master-port=ether1-master-local name=ether2-slave-local
set [ find default-name=ether3 ] master-port=ether1-master-local name=ether3-slave-local
set [ find default-name=ether4 ] master-port=ether1-master-local name=ether4-slave-local
set [ find default-name=ether5 ] master-port=ether1-master-local name=ether5-slave-local
set [ find default-name=ether6 ] master-port=ether1-master-local name=ether6-slave-local
set [ find default-name=ether7 ] master-port=ether1-master-local name=ether7-slave-local
set [ find default-name=ether8 ] master-port=ether1-master-local name=ether8-slave-local
set [ find default-name=ether9 ] master-port=ether1-master-local name=ether9-slave-local
set [ find default-name=ether10 ] master-port=ether1-master-local name=ether10-slave-local
set [ find default-name=ether11 ] master-port=ether1-master-local name=ether11-slave-local
set [ find default-name=ether12 ] master-port=ether1-master-local name=ether12-slave-local
set [ find default-name=ether13 ] master-port=ether1-master-local name=ether13-slave-local
set [ find default-name=ether14 ] master-port=ether1-master-local name=ether14-slave-local
set [ find default-name=ether15 ] master-port=ether1-master-local name=ether15-slave-local
set [ find default-name=ether16 ] master-port=ether1-master-local name=ether16-slave-local
set [ find default-name=ether17 ] master-port=ether1-master-local name=ether17-slave-local
set [ find default-name=ether18 ] master-port=ether1-master-local name=ether18-slave-local
set [ find default-name=ether19 ] master-port=ether1-master-local name=ether19-slave-local
set [ find default-name=ether20 ] master-port=ether1-master-local name=ether20-slave-local
set [ find default-name=ether21 ] master-port=ether1-master-local name=ether21-slave-local
set [ find default-name=ether22 ] master-port=ether1-master-local name=ether22-slave-local
set [ find default-name=ether23 ] master-port=ether1-master-local name=ether23-slave-local
set [ find default-name=ether24 ] master-port=ether1-master-local name=ether24-slave-local
set [ find default-name=sfp1 ] master-port=ether1-master-local name=sfp1-slave-local

but I can’t figure out how to ‘remove’ that. I’d prefer they use the default ‘etherxx’ names as that’s how I had my previous RB493G set up.

I can’t seem to figure out what command would let me ‘delete’ that line, either from the web interface or the command line.

Can you point me in the right direction?

Thanks

This will rename and un-slave all ethernet interfaces

/interface ethernet { :foreach eth in=[find] do={ set $eth name=[get $eth default-name] master-port=none; } }

No worry about renaming, it is only a label for your reading pleasures. It won’t affect firewall, routing, etc., it will however affect scripts of course. Un-laving (freeing?) interfaces will kick you off, if you are attached via TCP using that interface, so do that via the master-port, or using MAC.

Thanks. Worked like a champ. I really need to grasp the scripting better.