Just a short summery of some useful commands in combination with devices from MikroTik.
SSH Key authentication
To enable the ssh key authentication from your client and login without typing the password you can do following steps. (Linux / Mac)
- Copy your public Keyfile (*.pub) to your MikroTik device.
scp ~/.ssh/id_rsa.pub admin@ip:/
- Login via user and password and import public keyfile
ssh admin@ip
/user ssh-keys import public-key-file=id_rsa.pub user=admin
- Now you can access the device without typing the password
ssh admin@ip
CLI add vlan to bridge
With this cli command you can add vlan interfaces really fast.
/interface/brigde/vlan
add vlan-ids=101 comment=VLAN101-Internal bridge=bridge
add vlan-ids=201 comment=VLAN201-Guest bridge=bridge
CLI change vlan tagged / untagged
after creating the vlan you have to „attach“ ports to the vlan (tagged / untagged)
/interface/brigde/vlan
add vlan-ids=101 comment=VID101-Internal bridge=bridge tagged=qsfpplus1-1,qsfpplus2-1,sfp-sfpplus1 untagged=ether6,ether7,ether8,ether9
CLI create bond via LACP (802.3ad)
First remove the „physical“ interfaces of the bridge.
/interface/bridge/port remove numbers=9,10
now you can create the interface bond
/interface/bonding/add name=bond_SW01 slaves=sfp28-1,sfp28-2 mode=802.3ad
add the bond interface to the bridge again
/interface/bridge/port/add interface=bond_SW01 bridge=bridge
CLI add email settings
With this command you can add an smtp server with users authentication to your RouterOS
/tool/e-mail/set server=smtp.server.com from=from.emailadresse@schaupper.at password=nooneknows tls=starttls user=user.for.login
CLI test email settings
/tool/e-mail send to=“target.email@schaupper.at” subject="email-test!" body="It works!";
Useful scripts
- To create automatic backups of your RouterOS device, or to update it. The user beeyev, created a really cool and easy to use script. You can find it on GitHub LINK
(c) Thumbnail & Header Images was created with Adobe AI Firefly