Community discussions

MikroTik App
 
phili76
just joined
Topic Author
Posts: 12
Joined: Thu Sep 04, 2014 4:21 pm

add port to existing VLAN not possible?

Sat Aug 08, 2020 10:56 pm

I think I understand VLANs on the 3xx switches but I´m missing an easy way to add a new port to VLANs. In the gui, I open the VLAN in the bridge menu and add the port(s). If there would be a few, no problem. But as we have many I would appreciate a faster way in the terminal.
When I export the config, replace the add with set and add the new interface(s) it would work. But should´n add do the trick?
like
/interface bridge vlan
add bridge=bridge1 vlan-ids=11 tagged=sfp-sfpplus1,sfp-sfpplus10
Maybe with some script this would be possible but isn´t it that way in Cisco switches?

Thanks
Philipp
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19321
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: add port to existing VLAN not possible?

Sun Aug 09, 2020 4:23 am

are you using SWoS or RoS and if using RoS are you doing vlans on the bridge newer method or the standard old switch chip method?
 
phili76
just joined
Topic Author
Posts: 12
Joined: Thu Sep 04, 2014 4:21 pm

Re: add port to existing VLAN not possible?

Sun Aug 09, 2020 9:09 am

RouterOS. In SwOS it looks really easy to add ports to a VLAN. Also there is no terminal in SwOS.
I use the new method.
I wrote a script yesterday to get every VLANs Ports so it should be doable with a script. But I think it would be nice when the add command would do what it says.
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 2098
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Krugersdorp (Home town of Brad Binder)
Contact:

Re: add port to existing VLAN not possible?

Mon Aug 10, 2020 12:07 am

You will use set when changing an existing line in vlan table, and add to add a new line in the vlan table
 
phili76
just joined
Topic Author
Posts: 12
Joined: Thu Sep 04, 2014 4:21 pm

Re: add port to existing VLAN not possible?

Mon Aug 10, 2020 8:35 am

I know, but how would I add a single port to all VLANs without lots of exporting and editing?
like on Cisco:
switchport trunk allowed vlan { add | all | except | remove } vlan-list
or on Dlink DGS-1510 there is an add or change option in the weg gui.
I´m missing a port view on VLANs.
maybe I have to extend this script to get the current status and generate the set lines
:local vlans;/interface bridge vlan ;:foreach vlans in=[find vlan-ids!=0 ] do={:put [get $vlans vlan-ids];:put [get $vlans tagged]};
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 2098
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Krugersdorp (Home town of Brad Binder)
Contact:

Re: add port to existing VLAN not possible?

Mon Aug 10, 2020 11:28 am

can you post the "pseudo code" of exactly what you are trying to achieve?

Nevermind, I think I get what you are trying to do.

Maybe the easiest will be to add comments to the vlan config lines, and then reference that when you want to amend settings via script
{
:foreach myvlan in=[/interface bridge vlan find where comment="My Vlan Comment" && vlan-ids="10"] do={
set tagged=ether1 untagged=ether3
}
}
 
phili76
just joined
Topic Author
Posts: 12
Joined: Thu Sep 04, 2014 4:21 pm

Re: add port to existing VLAN not possible?

Mon Aug 10, 2020 1:31 pm

select port -> add/remove/set VLANs per port
like Dlink:
vlan_dlink.png
under Action either add or remove the inserted VLAN from the list the port is currently in. Or replace the range complete. But on a per-port base.
For now it would be a workaround when per VLAN is working as intended, should be sufficient in terminal, maybe the add command has to be adapted to either create a new VLAN or, if already exists, just update(add) the new port to the tagged list.
You do not have the required permissions to view the files attached to this post.
 
phili76
just joined
Topic Author
Posts: 12
Joined: Thu Sep 04, 2014 4:21 pm

Re: add port to existing VLAN not possible?

Fri Aug 21, 2020 10:03 am

just to ask again, would it be possible to add a command to get/set VLANs per port?
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 2098
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Krugersdorp (Home town of Brad Binder)
Contact:

Re: add port to existing VLAN not possible?

Fri Aug 21, 2020 11:46 am

you can do the same as per dlink with mikrotik gui
addvlanport.JPG
You do not have the required permissions to view the files attached to this post.
 
phili76
just joined
Topic Author
Posts: 12
Joined: Thu Sep 04, 2014 4:21 pm

Re: add port to existing VLAN not possible?

Fri Aug 21, 2020 1:25 pm

but in cli? not so

edit: add to a vlan yes but add vlan to a specific port?
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11587
Joined: Thu Mar 03, 2016 10:23 pm

Re: add port to existing VLAN not possible?

Fri Aug 21, 2020 2:55 pm

but in cli? not so

To nitpick: can you do it on D-Link in CLI?
 
Sob
Forum Guru
Forum Guru
Posts: 9120
Joined: Mon Apr 20, 2009 9:11 pm

Re: add port to existing VLAN not possible?

Fri Aug 21, 2020 6:54 pm

Look at RouterOS config, it's a tree with collections of items and each item has some attributes. You simply add or remove whole items or set attributes for existing items. And it works great for most things. Almost all attributes are short and if you need to edit some, you need to replace it as whole anyway.

Definition of VLANs on bridge is an exception. One of the few or maybe even the only one. It's relatively new, so they used the same kind of config as everywhere else, but it's not the greatest fit for it. And not just CLI, WinBox too. So far I used it only on devices with few ports and it's ok there. But the thought of configuring 24-port switch this way doesn't sound like fun.

There's definitely space for improvements, some higher level GUI in WinBox/WebFig and shortcut commands for editing items in CLI. You can try to invent something great and I think there's a chance they could go with it.
 
phili76
just joined
Topic Author
Posts: 12
Joined: Thu Sep 04, 2014 4:21 pm

Re: add port to existing VLAN not possible?

Mon Aug 24, 2020 11:01 pm

but in cli? not so

To nitpick: can you do it on D-Link in CLI?
yes
switchport trunk allowed vlan { add | all | except | remove } vlan-list
similar to Cisco

maybe we just have to wait, at the moment there are more important things to do(ROS7)

Who is online

Users browsing this forum: Bing [Bot] and 33 guests