Community discussions

MikroTik App
用户头像
BrianHiggins
Long time Member
Long time Member
Topic Author
Posts: 689
加入: Mon Jan 16, 2006 6:07 am
Location:Norwalk, CT
Contact:

Find last pysical ethernet port

Fri Sep 09, 2016 7:18 pm

In a script, Without knowing how many Ethernet ports are on a router, how do I identify the last port?

aka RB\2011 has 10 ports, I need to ID ether10, CCR1009 has 8 ports, I need to ID ether8

any ideas?

编辑,这也需要那个de any sfp ports
Top
用户头像
BlackVS
Member Candidate
Member Candidate
Posts: 171
加入: Mon Feb 04, 2013 7:00 pm
Contact:

Re: Find last pysical ethernet port

Fri Sep 09, 2016 8:05 pm

Run in console:
:put [:len [/interface find default-name~"ether"]]
Here is supposed that default names of ethernet ports numbered sequantually from 1
To get real name (not default) of last port find interface with default-name equal to etherN, where N got in previous command.
Top

Who is online

Users browsing this forum:BimbaSfxand 12 guests