mirror of
https://github.com/wifinigel/MikrotikScripting.git
synced 2025-07-23 04:14:29 +02:00
initial commit
This commit is contained in:
commit
c782dde326
61 changed files with 1457 additions and 0 deletions
27
scripts/ch10-10-add-remove-vlans.rsc
Normal file
27
scripts/ch10-10-add-remove-vlans.rsc
Normal file
|
@ -0,0 +1,27 @@
|
|||
# ch10-10-add-remove-vlans.rsc
|
||||
|
||||
# a script to add and remove 50 VLANs to/from
|
||||
# a Mikrotik router interface
|
||||
|
||||
: for VlanId from 200 to 249 do={
|
||||
|
||||
# find LAN interface ID
|
||||
:local LanInterface "ether2";
|
||||
:local LanInterfaceId [/interface find default-name=$LanInterface];
|
||||
|
||||
# add VLAN to LAN interface
|
||||
:local VlanName "VLAN$VlanId";
|
||||
/interface vlan add name="$VlanName" vlan-id=$VlanId \
|
||||
interface=$LanInterfaceId;
|
||||
}
|
||||
|
||||
: for VlanId from 200 to 249 do={
|
||||
|
||||
# find LAN interface ID
|
||||
:local LanInterface "ether2";
|
||||
:local LanInterfaceId [/interface find default-name=$LanInterface];
|
||||
|
||||
# add VLAN to LAN interface
|
||||
:local VlanName "VLAN$VlanId";
|
||||
/interface vlan remove "$VlanName";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue