Community discussions

MikroTik App
 
lurch
just joined
Topic Author
Posts: 23
Joined: Mon Jan 24, 2022 5:45 pm

getting/setting vlan for port

Mon Jan 24, 2022 5:50 pm

I'm currently setting vlan id for interfaces via winbox on a CRS326-24S

bridge > ports > sfp-sfpplus1 PVID = xxx

What I need to be able to do is get the current PVID of a specific interface in a single command via the cli
and
Set PVID of a specific interface in a single command via the cli

I've tried lots of different commands but to no avail so hoping someone on here can help.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3297
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: getting/setting vlan for port

Tue Jan 25, 2022 5:54 pm

To get pvid for an IF ether3
{
:local IF [/interface bridge port find where interface=ether3]
:put [/interface bridge port get $IF pvid]
}
Or in one line:
:put [/interface bridge port get [find where interface=ether2] pvid]
To set pvid 20 for interface ether3
/interface bridge port set  [find where interface=ether3] pvid=20

Who is online

Users browsing this forum: No registered users and 48 guests