Community discussions

MikroTik App
 
gucki
just joined
Topic Author
Posts: 5
Joined: Thu Jan 27, 2022 12:07 am

add/ remove interface from bridge vlan

Thu Jan 27, 2022 12:16 am

Hi guys,

let's assume I setup a bridge and configured a couple of vlans on it:

/interface bridge vlan
add bridge=bridge1 tagged=ether3,ether4,bond_edge2 vlan-ids=2
add bridge=bridge1 tagged=ether3,ether4,ether5,bond_edge2 vlan-ids=4

How can I add/remove a single interface to/from a specific vlan? I tried with the following command but it fails:

/interface bridge vlan
add bridge=bridge1 tagged=ether99 vlan-ids=2
=> failure: vlan already added

Thank you :)
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: add/ remove interface from bridge vlan

Fri Jan 28, 2022 6:28 pm

You can do:
/interface bridge vlan set [find vlan-ids=2] tagged=ether3,ether4,bond_edge2,ether99
But I don't know if there's any simple way how to only add/remove one interface without having to list all others that were there before.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19372
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: add/ remove interface from bridge vlan

Fri Jan 28, 2022 8:53 pm

/export hide-sensitive file=anynameyouwish

There is conflict somewhere,,,,,,,,
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: add/ remove interface from bridge vlan

Fri Jan 28, 2022 9:44 pm

Obviously, there's already entry with vlan-ids=2. The question was how to add another interface to it.
 
gucki
just joined
Topic Author
Posts: 5
Joined: Thu Jan 27, 2022 12:07 am

Re: add/ remove interface from bridge vlan

Sat Jan 29, 2022 4:21 pm

Thank you @Sob. It's very bad one has to list all vlans again that there's no simple command to add/remove an interface from an existing vlan. Should be very easy to implement as well - too bad the code is not open or I'd submit a PR ;-)

Nobody really missed that feature before? Is everybody using the Ui? ;-)
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: add/ remove interface from bridge vlan

Sat Jan 29, 2022 8:04 pm

Haven't you tried WinBox already? Do it and you won't be going back. CLI is good when you want to do something on ten routers at once, but otherwise WinBox wins. Unless you're hardcore command line fan, I guess. :)

I'm not absolutely sure that there's no shortcurt, but I didn't find any. Except:
/interface/bridge/vlan/edit [find vlan-ids=2] tagged
But that's interactive editor. But if you'd want it for scripts, I'm sure it can be done too. Adding should be the matter of getting previous value and sticking new interface name at the end. Removing would require a bit more effort. I won't give you examples for that, because RouterOS scripting frustrates me. I'd swear that the thing hates me.
 
gucki
just joined
Topic Author
Posts: 5
Joined: Thu Jan 27, 2022 12:07 am

Re: add/ remove interface from bridge vlan

Mon Jan 31, 2022 9:29 am

Thanks, the "edit" command seems quite useful :-)

I'm a Linux user, so I'm very much used to terminals/ consoles :lol: That's also why I didn't try Winbox yet as there's no Linux version, right?
 
tdw
Forum Guru
Forum Guru
Posts: 1855
Joined: Sat May 05, 2018 11:55 am

Re: add/ remove interface from bridge vlan

Mon Jan 31, 2022 11:51 am

It's very bad one has to list all vlans again that there's no simple command to add/remove an interface from an existing vlan.
No different to changing a list of ports in a firewall rule - you have to specify all of current plus new ones, not just the new ones.

Should be very easy to implement as well
Unlikely. Throughout RouterOS you have to use the full value of parameter arguments, there are no delta operations to add or remove individual items in an existing argument, so may require large architectural changes.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: add/ remove interface from bridge vlan

Mon Jan 31, 2022 1:57 pm

Windows version of WinBox works with Wine, so unless you're purist who can't stand such thing, you too can enjoy GUI.

Who is online

Users browsing this forum: Bing [Bot], broderick, Google [Bot], hazem, holvoetn and 110 guests