Ethernet interfaces ordering

In previous RouterOS versions order of ethernet interfaces used in scripts was the same as physical order, as example:

[admin@MikroTik] > /interface ethernet print 
Flags: X - disabled, R - running, S - slave 
 #    NAME          MTU MAC-ADDRESS       ARP        MASTER-PORT      SWITCH     
 0    5ether       1500 D4:CA:6D:37:35:5C enabled    none             switch1    
 1    4ether       1500 D4:CA:6D:37:35:5D enabled    none             switch1    
 2 R  3ether       1500 D4:CA:6D:37:35:5E enabled    none             switch1    
 3    2ether       1500 D4:CA:6D:37:35:5F enabled    none             switch1    
 4    1ether       1500 D4:CA:6D:37:35:60 enabled    none             switch1

Now they are sorted in lexical order, so:

[admin@MikroTik] > /interface ethernet print 
Flags: X - disabled, R - running, S - slave 
 #    NAME          MTU MAC-ADDRESS       ARP        MASTER-PORT      SWITCH     
 0    1ether       1500 D4:CA:6D:37:35:60 enabled    none             switch1    
 1    2ether       1500 D4:CA:6D:37:35:5F enabled    none             switch1    
 2 R  3ether       1500 D4:CA:6D:37:35:5E enabled    none             switch1    
 3    4ether       1500 D4:CA:6D:37:35:5D enabled    none             switch1    
 4    5ether       1500 D4:CA:6D:37:35:5C enabled    none             switch1

This completely breaks setting custom interface’s name since you are never know which #number use. Even export functionality broken since generated export script is following:

/interface ethernet
set 0 name=1ether
set 1 name=2ether
set 2 name=3ether
set 3 name=4ether
set 4 name=5ether

and after export interfaces are:

[admin@MikroTik] > /interface ethernet print 
Flags: X - disabled, R - running, S - slave 
 #    NAME          MTU MAC-ADDRESS       ARP        MASTER-PORT      SWITCH     
 0    1ether       1500 D4:CA:6D:37:35:5C enabled    none             switch1    
 1    2ether       1500 D4:CA:6D:37:35:5D enabled    none             switch1    
 2 R  3ether       1500 D4:CA:6D:37:35:5E enabled    none             switch1    
 3    4ether       1500 D4:CA:6D:37:35:5F enabled    none             switch1    
 4    5ether       1500 D4:CA:6D:37:35:60 enabled    none             switch1

So 1ether is for D4:CA:6D:37:35:5C port instead of D4:CA:6D:37:35:60.

I created ticket #2013100766000231 but didn’t receive a reply. Is this a bug?

a Feature? Even worse is that a old export, can change the default name to port 12-23 instead of 0-11.

Its common to have syntax change between Ros (also inside main releases). There is ways to make this to work. You somehow have to script some more than just interface 1,2,3,4 etc. You have to figure out. What is interface 1. etc.

Maybe possible to make a code like this (not tested)

product 1,2,3 Change the code to your product, due to ros version

#eg 1 = 4.x 2=5.x, 3=6.x

:global product 1
:global ethname lan1,lan2,lan3,lan4,lan5,lan6,lan7,lan8,lan9
:if ( [ :pick $product ] = 1 ) do={ :set :set ethname wan,lan1,lan2,lan3,lan4 }
:if ( [ :pick $product ] = 2 ) do={ :set :set ethname lan4,lan3,lan2,lan1,wan }
:if ( [ :pick $product ] = 3 ) do={ :set :set ethname wan,wan2,wan3,lan1,lan2,}
#edit one time the 3 lines above to fit.
/ interface ethernet { :foreach i in=[ find ] do={ set $i name=[ :pick $ethname [ :find [ find ] $i ] ] }

Its also possible to make a "get mac address, set name to lowest first" type of script.