router os - Mikrotik Switch Commands (Create VLAN, Assign PORTS) -
i've been working cisco switch , commands simple;
eg/ vlan 100 (will add vlan called 100)
interface 1/0/1 vlan 100 (will assign vlan 100 port)
it seems mikrotik isn't same. don't have mikrotik switch, commands given me are:
//add name=vlan200 interface=ether2 vlan-id=200 //add ports=switch1-cpu, ethernet vlan-id=200 learn=yes
these seem overly complex. these correct commands? mikrotik guru know can test commands without switch?
so i've found answer. after managing obtain mikrotik switch. there great class connecting mk command prompt - it's linked here: api in c sharp
the commands are:
/interface ethernet switch vlan add switch="[yourswitch]" vlan-id="[yourvlan]" ports="[porttoassign]"
to assign port:
/interface ethernet switch port set [yourport] vlan-mode=secure vlan-header=always-strip default-vlan-id=[yourvlan]
if using mk class need write separately. looks more this:
mk mikrotik = new mk("192.168.188.1"); if (mikrotik.login("admin", "admin")) { mikrotik.send("/interface/ethernet/switch/vlan/add"); mikrotik.send("=switch=switch1"); mikrotik.send("=vlan-id=333"); mikrotik.send("=ports=ether4", true); foreach (string h in mikrotik.read()) { console.writeline(h); }
Comments
Post a Comment