### Example LDP Setup Diagram Source: https://help.mikrotik.com/docs/spaces/ROS/pages/121995275/LDP A diagram illustrating a basic four-router setup with loopback IP addresses and network segments for an LDP example. ```text (lo:111.111.111.1) (lo:111.111.111.2) (lo:111.111.111.3) (lo:111.111.111.4) |---------R1-----(111.11.0.0/24)-----R2-----(111.12.0.0/24)-----R3-----(111.13.0.0/24)-----R4---------| ``` -------------------------------- ### Simple VRF-Lite Setup Source: https://help.mikrotik.com/docs/spaces/ROS/pages/328206/Virtual%2BRouting%2Band%2BForwarding%2B-%2BVRF This example demonstrates a basic VRF-Lite configuration. Ensure the VRF is correctly defined and interfaces are assigned to it. ```routeros /routing vrf add name=VRF-LITE table=VRF-LITE /interface ethernet set [find default-name=ether2] vrf=VRF-LITE /interface ethernet set [find default-name=ether3] vrf=VRF-LITE ``` -------------------------------- ### Quick Start: Connection Rate Limiting Setup Source: https://help.mikrotik.com/docs/spaces/ROS/pages/131366985/Connection%2Brate This is a consolidated command for setting up connection rate limiting. It includes mangle rules for marking connections and packets, and queue tree rules for managing bandwidth. ```bash /ip firewall mangle add chain=forward action=mark-connection connection-mark=!heavy_traffic_conn new-connection-mark=all_conn add chain=forward action=mark-connection connection-bytes=500000-0 connection-mark=all_conn connection-rate=200k-100M new-connection-mark=heavy_traffic_conn protocol=tcp add chain=forward action=mark-connection connection-bytes=500000-0 connection-mark=all_conn connection-rate=200k-100M new-connection-mark=heavy_traffic_conn protocol=udp add chain=forward action=mark-packet connection-mark=heavy_traffic_conn new-packet-mark=heavy_traffic passthrough=no add chain=forward action=mark-packet connection-mark=all_conn new-packet-mark=other_traffic passthrough=no /queue tree add name=upload parent=public max-limit=6M add name=other_upload parent=upload limit-at=4M max-limit=6M packet-mark=other_traffic priority=1 add name=heavy_upload parent=upload limit-at=2M max-limit=6M packet-mark=heavy_traffic priority=8 add name=download parent=local max-limit=6M add name=other_download parent=download limit-at=4M max-limit=6M packet-mark=other_traffic priority=1 add name=heavy_download parent=download limit-at=2M max-limit=6M packet-mark=heavy_traffic priority=8 ``` -------------------------------- ### Complete IPv4 Firewall Filter Setup Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/48660574/Filter This combines the rules for accepting established/related connections, allowing specific traffic from an address list and ICMP, and finally dropping all other input traffic. It also includes the creation of the address list. ```routeros /ip firewall filter add action=accept chain=input comment="default configuration" connection-state=established,related add action=accept chain=input src-address-list=allowed_to_router add action=accept chain=input protocol=icmp add action=drop chain=input /ip firewall address-list add address=192.168.88.2-192.168.88.254 list=allowed_to_router ``` -------------------------------- ### Example Partition Print Output Source: https://help.mikrotik.com/docs/spaces/ROS/pages/328103/Partitions An example of the output from the `/partitions/print` command, showing partition details. ```APIDOC # Partitions * Created by Normunds R., last updated by Serhii T. on Jun 13, 2025 2 minute read `[admin@MikroTik] > /partitions/print Flags: A - ACTIVE; R - RUNNING Columns: NAME, FALLBACK-TO, VERSION, SIZE # NAME FALL VERSION SIZEĀ  0 AR part0 next RouterOS v7.18.2 2025-03-11 11:59:04 128MiB` ``` -------------------------------- ### Setup DHCP Server (CLI Interactive) Source: https://help.mikrotik.com/docs/spaces/ROS/pages/328151/First%2BTime%2BConfiguration This interactive command sequence guides you through setting up a DHCP server on the specified interface and network. It automatically determines most configuration options. ```bash [admin@MikroTik] > ip dhcp-server/ setup [enter] Select interface to run DHCP server on dhcp server interface: bridge1 [enter] Select network for DHCP addresses dhcp address space: 192.168.88.0/24 [enter] Select gateway for given network gateway for dhcp network: 192.168.88.1 [enter] Select pool of ip addresses given out by DHCP server addresses to give out: 192.168.88.2-192.168.88.254 [enter] Select DNS servers dns servers: 192.168.88.1 [enter] Select lease time lease time: 1800 [enter] ``` -------------------------------- ### Login Prompt CLI Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/39682058/PtP%2BCLI%2Bexample This example shows the typical login prompt when connecting to a MikroTik device via mac-telnet. Default credentials are 'admin' with no password. ```bash [admin@KD_GW] > /tool mac-telnet C4:AD:34:84:EE:5D Login: admin Password: Trying C4:AD:34:84:EE:5D... Connected to C4:AD:34:84:EE:5D ``` -------------------------------- ### Netinstall v6 Example (Reset Configuration) Source: https://help.mikrotik.com/docs/spaces/ROS/pages/24805390/Netinstall Example of running Netinstall version 6 with the -r flag to reset the device configuration during reinstallation. It specifies the server IP and the target package. ```bash admin@ubuntu:~$ sudo ./netinstall -r -a 192.168.88.3 routeros-mipsbe-6.48.1.npk Using server IP: 192.168.88.2 Starting PXE server Waiting for RouterBOARD... PXE client: 01:23:45:67:89:10 Sending image: mips Discovered RouterBOARD... Formatting... Sending package routeros-mipsbe-6.48.1.npk ... Ready for reboot... Sent reboot command ``` -------------------------------- ### Basic MultiWAN Setup with Routing Marks in ROSv7 Source: https://help.mikrotik.com/docs/spaces/ROS/pages/30474256/Moving%2Bfrom%2BROSv6%2Bto%2Bv7%2Bwith%2Bexamples This example illustrates a basic multi-WAN setup using ROSv7. It involves creating a custom routing table 'myTable', assigning IP addresses to WAN interfaces, adding routes to 'myTable', and using mangle to mark traffic originating from the LAN interface for processing by 'myTable'. ```routeros /routing table add name=myTable fib /ip address add address=192.168.1.1/24 interface=LAN add address=1.1.1.2/24 interface=WAN1 add address=2.2.2.2/24 interface=WAN2 /ip route add gateway=1.1.1.1@main routing-table=myTable add gateway=2.2.2.2 /ip firewall mangle add in-interface=LAN action=mark-routing new-routing-mark=myTable ``` -------------------------------- ### Command Examples Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579160/API Provides examples of API commands that can be sent to the RouterOS. ```APIDOC ## Command examples * `/system/package/getall` * `/user/active/listen` * `/cancel, simultaneous commands` ``` -------------------------------- ### Command Examples Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579160/API Provides examples of common API commands. ```APIDOC ### /system/package/getall /system/package/getall --- !re =.id=*5802 =disabled=no =name=routeros-x86 =version=3.0beta2 =build-time=oct/18/2006 16:24:41 =scheduled= !re =.id=*5805 =disabled=no =name=system =version=3.0beta2 =build-time=oct/18/2006 17:20:46 =scheduled= ... more !re sentences ... !re =.id=*5902 =disabled=no =name=advanced-tools =version=3.0beta2 =build-time=oct/18/2006 17:20:49 =scheduled= !done ### /user/active/listen /user/active/listen --- !re =.id=*68 =radius=no =when=oct/24/2006 08:40:42 =name=admin =address=0.0.0.0 =via=console !re =.id=*68 =.dead=yes ... more !re sentences ... ### /cancel, simultaneous commands /login --- !done =ret=856780b7411eefd3abadee2058c149a3 /login =name=admin =response=005062f7a5ef124d34675bf3e81f56c556 !done -- _first start listening for interface changes (tag is 2)_ /interface/listen .tag=2 -- _disable interface (tag is 3)_ /interface/set =disabled=yes =.id=ether1 .tag=3 -- _this is done for disable command (tag 3)_ !done .tag=3 -- _enable interface (tag is 4)_ /interface/set =disabled=no =.id=ether1 .tag=4 -- _this update is generated by a change made by the first set command (tag 3)_ !re =.id=*1 =disabled=yes =dynamic=no =running=no =name=ether1 =mtu=1500 =type=ether .tag=2 -- _this is done for enable command (tag 4)_ !done .tag=4 -- _get interface list (tag is 5)_ /interface/getall .tag=5 -- _this update is generated by a change made by the second set command (tag 4)_ !re =.id=*1 =disabled=no =dynamic=no =running=yes =name=ether1 =mtu=1500 =type=ether .tag=2 -- _these are replies to getall command (tag 5)_ !re =.id=*1 =disabled=no =dynamic=no =running=yes =name=ether1 =mtu=1500 =type=ether .tag=5 !re =.id=*2 =disabled=no =dynamic=no =running=yes =name=ether2 =mtu=1500 =type=ether .tag=5 -- _here interface getall ends (tag 5)_ !done .tag=5 -- _stop listening - request to cancel command with tag 2, cancel itself uses tag 7_ /cancel =tag=2 .tag=7 -- _listen command is interrupted (tag 2)_ !trap =category=2 =message=interrupted .tag=2 -- _cancel command is finished (tag 7)_ !done .tag=7 -- _listen command is finished (tag 2)_ !done .tag=2 ``` -------------------------------- ### Netinstall v7 Example (Empty Config & Branding Removal) Source: https://help.mikrotik.com/docs/spaces/ROS/pages/24805390/Netinstall Example of running Netinstall version 7 with flags to apply an empty configuration (-e) and discard branding (-b). It specifies the interface, client IP, and multiple packages. ```bash admin@ubuntu:~$ sudo ./netinstall-cli -e -b -i enx1234567ee890 -a 192.168.88.3 routeros-7.14.2-arm.npk wireless-7.14.2-arm.npk Version: 7.15beta9(2024-03-27 20:41:15) Will apply empty config Will remove branding Using Interface: enx1234567ee890 Wait for Link-UP on 'enx1234567ee890'. OK Using Client IP: 192.168.88.3 Using Server IP: 192.168.88.10 Starting PXE server Waiting for RouterBOARD... client: 74:4D:28:8E:86:74 Detected client architecture: arm Sending and starting Netinstall boot image ... Installed branding package detected Discovered RouterBOARD... 74:4D:28:8E:86:74 Formatting... Sending package routeros-7.14.2-arm.npk ... Sending package wireless-7.14.2-arm.npk ... Sending empty config ... Ready for reboot... Sent reboot command ``` -------------------------------- ### System Resource GET Request Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579162/REST%2BAPI Example of how to retrieve system resource information using the REST API with cURL. This demonstrates a GET request to the /system/resource endpoint. ```APIDOC ## GET /system/resource ### Description Retrieves information about the system resources of the router. ### Method GET ### Endpoint `/rest/system/resource` ### Parameters #### Query Parameters - **none** ### Request Example ```bash $ curl -k -u admin: https:///rest/system/resource ``` ### Response #### Success Response (200) - **architecture-name** (string) - The architecture of the board. - **board-name** (string) - The name of the board. - **build-time** (string) - The build time of the RouterOS version. - **cpu** (string) - The type of CPU. - **cpu-count** (string) - The number of CPU cores. - **cpu-frequency** (string) - The CPU frequency. - **cpu-load** (string) - The current CPU load. - **free-hdd-space** (string) - The amount of free hard drive space. - **free-memory** (string) - The amount of free memory. - **platform** (string) - The platform name. - **total-hdd-space** (string) - The total hard drive space. - **total-memory** (string) - The total memory. - **uptime** (string) - The uptime of the router. - **version** (string) - The RouterOS version. #### Response Example ```json [ { "architecture-name": "tile", "board-name": "CCR1016-12S-1S+", "build-time": "Dec/04/2020 14:19:51", "cpu": "tilegx", "cpu-count": "16", "cpu-frequency": "1200", "cpu-load": "1", "free-hdd-space": "83439616", "free-memory": "1503133696", "platform": "MikroTik", "total-hdd-space": "134217728", "total-memory": "2046820352", "uptime": "2d20h12m20s", "version": "7.1beta4 (development)" } ] ``` ``` -------------------------------- ### Setup MikroTik HotSpot Captive Portal Source: https://help.mikrotik.com/docs/spaces/ROS/pages/56459266/HotSpot%2B-%2BCaptive%2Bportal Use the 'setup' command to configure the HotSpot interface, IP address, masquerading, DNS, and create an initial user. Ensure the interface is correctly selected. ```bash [admin@MikroTik] /ip hotspot> setup Select interface to run HotSpot on hotspot interface: ether3 Set HotSpot address for interface local address of network: 10.5.50.1/24 masquerade network: yes Set pool for HotSpot addresses address pool of network: 10.5.50.2-10.5.50.254 Select hotspot SSL certificate select certificate: none Select SMTP server ip address of smtp server: 0.0.0.0 Setup DNS configuration dns servers: 1.1.1.1 DNS name of local hotspot server dns name: myhotspot Create local hotspot user name of local hotspot user: admin password for the user: [admin@MikroTik] /ip hotspot> ``` -------------------------------- ### Example System Resource JSON Source: https://help.mikrotik.com/docs/spaces/ROS/pages/250707984/Kaa%2BIoT%2Bsetup This is an example of the JSON structure that the system info script will generate and publish. ```json { "model": "RB924iR-2nD-BT5&BG77", "sn": "XXXXXXX", "ros": "7.99", "cpu": "7", "umem": "45113344", "fmem": "21995520", "uptime": "4d22:16:08" } ``` -------------------------------- ### Setting Modem Initialization String Source: https://help.mikrotik.com/docs/spaces/ROS/pages/30146563/LTE%2B5G Configure a custom AT command string that will be executed when the modem starts up. ```bash /interface lte set [find] modem-init="AT+CGDCONT=1,\"IP\",\"internet.carrier.com\"" ``` -------------------------------- ### Start Synapse Container Source: https://help.mikrotik.com/docs/spaces/ROS/pages/297795649/Container%2B-%2BMatrix Starts the Synapse container, making the Matrix server accessible after its configuration is complete. ```bash /container/start [find where name=synapse] ``` -------------------------------- ### Marking Connections and Packets Source: https://help.mikrotik.com/docs/spaces/ROS/pages/48660587/Mangle This example demonstrates how to mark new connections from a specific source address and then mark packets belonging to those marked connections. This is useful for optimizing setups by applying actions to specific connections, such as for queue management. Note that packet marks have a limit of 4096 unique entries. ```routeros /ip firewall mangle add chain=forward in-interface=local src-address=192.168.88.123 connection-state=new action=mark-connection new-connection-mark=client_conn add chain=forward connection-mark=client_conn action=mark-packet new-packet-mark=client_p ``` -------------------------------- ### Configure Controller Bridge and Port Extender Source: https://help.mikrotik.com/docs/spaces/ROS/pages/37224456/Controller%2BBridge%2Band%2BPort%2BExtender Initial setup for the Controller Bridge (CB) and Port Extender (PE) devices. This configuration is identical to a previous example and serves as a baseline. ```bash /interface bridge add name=bridge1 vlan-filtering=yes /interface bridge port add bridge=bridge1 interface=sfp-sfpplus2 /interface bridge port-controller set bridge=bridge1 cascade-ports=sfp-sfpplus1 switch=switch1 ``` ```bash /interface bridge port-extender set control-ports=sfp-sfpplus4 switch=switch1 ``` -------------------------------- ### Start Postgres Container Source: https://help.mikrotik.com/docs/spaces/ROS/pages/306675742/Container%2B-%2BPostgres Initiates the PostgreSQL container after it has been created. ```bash /container/start [find where name=postgres] ``` -------------------------------- ### Modem Firmware Upgrade Command Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/30146563/LTE%2B5G Examples of the 'modem firmware-upgrade' command for updating modem firmware. Ensure connectivity is established before proceeding. ```bash /interface lte firmware-upgrade lte1 ``` -------------------------------- ### Example Log Entry with Topics Source: https://help.mikrotik.com/docs/spaces/ROS/pages/328094/Log This is an example of a log entry showing multiple topics assigned to a message, such as 'route', 'ospf', 'debug', and 'raw'. ```text 11:11:43 route,ospf,debug SEND: Hello Packet 10.255.255.1 -> 224.0.0.5 on lo0 11:11:43 route,ospf,debug,raw PACKET: 11:11:43 route,ospf,debug,raw 02 01 00 2C 0A FF FF 03 00 00 00 00 E7 9B 00 00 11:11:43 route,ospf,debug,raw 00 00 00 00 00 00 00 00 FF FF FF FF 00 0A 02 01 11:11:43 route,ospf,debug,raw 00 00 00 28 0A FF FF 01 00 00 00 00 ``` -------------------------------- ### RouterOS CLI Login Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/328134/Command%2BLine%2BInterface An example demonstrating how to disable console colors and set terminal width to 80 characters by appending parameters to the login name. ```plaintext admin+ct80w ``` -------------------------------- ### MikroTik Scripting: Find Command Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579229/Scripting Shows how to use the 'find' command to locate items matching a specific pattern. This example finds interfaces with 'ether' in their name. ```routeros :put [/interface find name~"ether"] ``` -------------------------------- ### Bridge Host Table Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/19136718/Layer2%2Bmisconfiguration Displays the bridge host table, showing learned MAC addresses and their associated interfaces and bridges. This output helps in diagnosing MAC learning issues in misconfigured setups. ```bash [admin@switch] /interface bridge host print where !local Flags: X - disabled, I - invalid, D - dynamic, L - local, E - external # MAC-ADDRESS VID ON-INTERFACE BRIDGE 0 D CC:2D:E0:E4:B3:A1 ether1 bridge1 1 D CC:2D:E0:E4:B3:A2 ether2 bridge1 2 D CC:2D:E0:E4:B3:A1 VLAN bridge2 3 D CC:2D:E0:E4:B3:A2 VLAN bridge2 4 D CC:2D:E0:E4:B3:A3 ether3 bridge2 ``` -------------------------------- ### Run a script Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579162/REST%2BAPI This example demonstrates how to execute a script on the device via the REST API. ```APIDOC ## POST /rest/system/script/run ### Description Executes a system script on the device. ### Method POST ### Endpoint /rest/system/script/run ### Request Body - **.id** (string) - Required - The ID of the script to run (e.g., `*1`) ### Request Example ```json { ".id": "*1" } ``` ### Response (No specific success response details provided in source) ### Error Handling (No specific error handling details provided in source) ``` -------------------------------- ### Example Log Entry Source: https://help.mikrotik.com/docs/spaces/ROS/pages/328094/Log This is an example of a log entry showing the topic, severity, and message. ```text 12:41:40 route,bgp,debug,timer KeepaliveTimer expired 12:41:40 route,bgp,debug,timer RemoteAddress=2001:470:1f09:131::1 ``` -------------------------------- ### Start PostgreSQL Container Source: https://help.mikrotik.com/docs/spaces/ROS/pages/297795649/Container%2B-%2BMatrix Starts the PostgreSQL container, which must be running before the Synapse container can connect to it. ```bash /container/start [find where name=postgresql_synapse] ``` -------------------------------- ### HAProxy Configuration Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/297795651/Container%2B-%2BHAProxy An example HAProxy configuration file (`haproxy.cfg`) to be placed in the created mount point. This configuration sets up a basic HTTP reverse proxy. ```haproxy defaults mode http timeout client 10s timeout connect 10s timeout server 10s timeout http-request 10s frontend http_synapse bind *:80 use_backend synapse backend synapse server server1 172.17.0.2:8008 maxconn 32 ``` -------------------------------- ### Start Pgadmin Container Source: https://help.mikrotik.com/docs/spaces/ROS/pages/306675742/Container%2B-%2BPostgres Initiates the Pgadmin container after it has been created. ```bash /container start [find where name=pgadmin] ``` -------------------------------- ### WireGuard Import File Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/69664792/WireGuard This is a minimal WireGuard import file example. If the client address field is left empty, a default IP address is added when generating the QR code. ```text interface: wireguard1 public-key: v/oIzPyFm1FPHrqhytZgsKjU7mUToQHLrW+Tb5e601M= private-key: KMwxqe/iXAU8Jn9dd1o5pPdHep2blGxNWm9I944/I24= allowed-address: 192.168.88.3/24 client-address: 192.168.88.3/32 client-endpoint: example.com:13231 ``` -------------------------------- ### Start the Container Source: https://help.mikrotik.com/docs/spaces/ROS/pages/84901929/Container Manually start the Pi-hole container after it has been added and its status is 'stopped'. ```routeros /container/start pihole ``` -------------------------------- ### Print Application List Source: https://help.mikrotik.com/docs/spaces/ROS/pages/343244823/Apps Use this command to view a list of installed applications, their status, and resource usage. ```bash /app> print Flags: X - DISABLED, R - RUNNING Columns: NAME, UI-URL, MEMORY-CURRENT, APP-SIZE, DATA-SIZE, CATEGORY, DESCRIPTION ``` -------------------------------- ### List Installed and Available Packages Source: https://help.mikrotik.com/docs/spaces/ROS/pages/40992872/Packages Use this command to view all installed packages, their versions, and their status (e.g., disabled, scheduled for uninstall). It also shows packages available on the server but not yet downloaded. ```bash /system package print Flags: X - DISABLED Columns: NAME, VERSION, SCHEDULED # NAME VERSION SCHEDULED 0 dude 7.9 scheduled for uninstall 1 X zerotier 7.9 2 routeros 7.9 3 XA iot 7.9 ``` -------------------------------- ### Example Device Mount Configuration Source: https://help.mikrotik.com/docs/spaces/ROS/pages/343244823/Apps Use this format to specify host hardware devices and map them to devices within the application container. ```yaml devices: - [host-hw-device]:[device-in-app] ``` -------------------------------- ### Simplest MPLS VPN Setup - PE2 Router (Cisco) Source: https://help.mikrotik.com/docs/spaces/ROS/pages/328206/Virtual%2BRouting%2Band%2BForwarding%2B-%2BVRF Configuration for the Provider Edge (PE) router (Cisco) in a simple MPLS VPN setup. This example assumes a Cisco device and focuses on VRF and BGP setup. ```routeros ! interface GigabitEthernet0/1 ip address 192.168.2.1 255.255.255.0 ! router bgp 65002 neighbor 10.0.0.1 remote-as 65001 neighbor 10.0.0.1 update-source Loopback0 ! Add VPNv4 address family configuration here for the neighbor address-family ipv4 vrf VRF-A network 192.168.2.0 exit-address-family ! vrf definition VRF-A rd 100:1 route-target export 100:1 route-target import 100:1 ! ``` -------------------------------- ### ROSv6 Network Configuration Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/30474256/Moving%2Bfrom%2BROSv6%2Bto%2Bv7%2Bwith%2Bexamples This is the equivalent ROSv6 configuration for advertising a network and creating a blackhole route. ```bash /routing bgp network add network=192.168.0.0/24 synchronize=yes /ip route add dst-address=192.168.0.0/24 type=blackhole ``` -------------------------------- ### MAC Telnet Session Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/189497349/Fail-over%2BPtMP%2BCLI%2Bexample An example of a successful MAC Telnet connection, showing the login prompt and connection confirmation. ```bash [admin@KD_GW] > /tool mac-telnet C4:AD:34:84:EE:5D Login: admin Password: Trying C4:AD:34:84:EE:5D... Connected to C4:AD:34:84:EE:5D ``` -------------------------------- ### Pull and Start Home-Assistant Container Source: https://help.mikrotik.com/docs/spaces/ROS/pages/204341276/Container%2B-%2BHomeAssistant Pulls the 'homeassistant/home-assistant:latest' image and starts the container, configuring its network interface, root directory, mounts, environment variables, and logging. ```routeros /container/add remote-image=homeassistant/home-assistant:latest interface=veth2 root-dir=/usb1/ha mounts=ha_config envlists=ha_env logging=yes ``` -------------------------------- ### PTP Monitor Output Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/64127015/Precision%2BTime%2BProtocol This is an example output from the PTP monitor command, showing key parameters like clock ID, priority, master clock information, and synchronization offsets. ```text name: ptp1 clock-id: 64:D1:54:FF:FE:EB:AD:C7 priority1: 246 priority2: 248 i-am-gm: no gm-clock-id: 64:D1:54:FF:FE:EB:AE:C3 gm-priority1: 100 gm-priority2: 248 master-clock-id: 64:D1:54:FF:FE:EB:AE:C3 slave-port: ether1 freq-drift: 2690 ppb offset: 3 ns hw-offset: -889419842 ns slave-port-delay: 306 ns ``` -------------------------------- ### Get All System Packages Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579160/API Retrieves a list of all installed system packages on the MikroTik device. ```text /system/package/getall ``` -------------------------------- ### Configuration Example: Socksify with TOR Source: https://help.mikrotik.com/docs/spaces/ROS/pages/343244851/Socksify Example of configuring Socksify to use a TOR SOCKS5 proxy and setting up firewall rules. ```APIDOC ## Configuration Example: Use in combination with TOR SOCKS5 proxy server ### Description This example demonstrates how to forward HTTP/s traffic through a TOR SOCKS5 proxy server using the Socksify service and firewall rules. ### Steps 1. **Configure Socksify service:** ```bash /ip socksify add connection-timeout=10 disabled=no name=TOR_socksify socks5-port=9050 socks5-server= ``` 2. **Configure firewall rules:** ```bash /ip firewall filter add action=accept chain=input dst-port=952 protocol=tcp src-address= /ip firewall nat add action=socksify chain=dstnat dst-port=80,443 protocol=tcp socksify-service=TOR_socksify src-address= ``` ### Parameters - ``: Replace with the actual IP address of your TOR SOCKS proxy. - ``: Replace with the IP address of the client machine from which traffic will be socksified. ``` -------------------------------- ### Get OIDs from /system resource Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579162/REST%2BAPI This example demonstrates how to retrieve OIDs from the system resource using the REST API. ```APIDOC ## POST /rest/system/resource/print ### Description Retrieves OIDs from the system resource. ### Method POST ### Endpoint /rest/system/resource/print ### Request Body - **oid** (string) - Optional - Specifies the OID to retrieve. If empty, likely returns all. ### Request Example ```json { "oid": "" } ``` ### Response (No specific success response details provided in source) ### Error Handling (No specific error handling details provided in source) ``` -------------------------------- ### Make a log entry Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579162/REST%2BAPI This example shows how to make a log entry on the device using the REST API. ```APIDOC ## POST /rest/execute ### Description Logs a message to the device's log. ### Method POST ### Endpoint /rest/execute ### Request Body - **script** (string) - Required - The script command to execute, e.g., `/log/info test` ### Request Example ```json { "script": "/log/info test" } ``` ### Response (No specific success response details provided in source) ### Error Handling (No specific error handling details provided in source) ``` -------------------------------- ### WireGuard Import File for wg-import Source: https://help.mikrotik.com/docs/spaces/ROS/pages/69664792/WireGuard When using `interface/wireguard/wg-import file=`, ensure the WireGuard import file does not start with '#'. This example shows the correct format. ```text [Interface] Address =192.168.88.3/24 ListenPort = 13533 PrivateKey = UBLqJEFZZf9wszZSUF2BPWa9dsMX99RbEcxlNfxWffk= ``` -------------------------------- ### Enable Container Start on Boot Source: https://help.mikrotik.com/docs/spaces/ROS/pages/84901929/Container This command enables the 'start-on-boot' option for a specific container, ensuring it automatically starts after a router reboot. It first prints container details and then sets the option. ```bash /container/print 0 name="2e679415-2edd-4300-8fab-a779ec267058" tag="test_arm64:latest" os="linux" arch="arm" interface=veth2 root-dir=disk1/alpine mountslists="" dns="" logging=yes start-on-boot=yes status=running /container/set 0 start-on-boot=yes ``` -------------------------------- ### Configure VRF-Lite Setup Source: https://help.mikrotik.com/docs/spaces/ROS/pages/328206/Virtual%2BRouting%2Band%2BForwarding%2B-%2BVRF Sets up IP addresses, VRF instances, and routes for a basic VRF-Lite configuration. Includes masquerading for local source NAT. ```bash /ip address add address=172.16.1.2/24 interface=public add address=192.168.1.1/24 interface=ether1 add address=192.168.2.1/24 interface=ether2 /ip route add gateway=172.16.1.1 # add VRF configuration /ip vrf add name=cust_a interface=ether1 place-before 0 add name=cust_b interface=ether2 place-before 0 # add vrf routes /ip route add gateway=172.16.1.1@main routing-table=cust_a add gateway=172.16.1.1@main routing-table=cust_b # masquerade local source /ip firewall nat add chain=srcnat out-interface=public action=masquerade ``` -------------------------------- ### Query Word Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579160/API Shows how query words, starting with '?', are used to filter results for the 'print' command. The order of query words is significant. ```text /interface/print ?type=ether ?type=vlan ?#|! ``` -------------------------------- ### MikroTik Rate-Limit Examples Source: https://help.mikrotik.com/docs/spaces/ROS/pages/328097/RADIUS Examples demonstrating different configurations for the Mikrotik-Rate-Limit attribute, specifying upload/download rates, burst rates, burst thresholds, and burst times. ```text 128k ``` ```text 64k/128M ``` ```text 64k 256k ``` ```text 64k/64k 256k/256k 128k/128k 10/10 ``` -------------------------------- ### Add Whitelist Entry with Wildcard Address Source: https://help.mikrotik.com/docs/spaces/ROS/pages/78086201/Bluetooth Add a new entry to the whitelist using a wildcard for MAC addresses. This example whitelists all addresses starting with 'DC:2C:'. ```bash /iot bluetooth whitelist add address=DC:2C:*:*:*:* ``` -------------------------------- ### Download Mosquitto Configuration File Source: https://help.mikrotik.com/docs/spaces/ROS/pages/169246787/Container%2B-%2Bmosquitto%2BMQTT%2Bserver Navigate to the Mosquitto configuration directory and download the 'mosquitto.conf' file using the 'get' command. ```bash sftp> cd mosquitto/mosquitto/config sftp> dir mosquitto.conf sftp> get mosquitto.conf Fetching /mosquitto/mosquitto/config/mosquitto.conf to mosquitto.conf /mosquitto/mosquitto/config/mosquitto.conf ``` -------------------------------- ### Network Diagram Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/122388518/Wireless%2BStation%2BModes Illustrates a typical network setup involving an Access Point (AP) and a Station (STA) connected wirelessly, with wired segments on either side. ```text [X]---[AP]-( )-[STA]---[Y] ``` -------------------------------- ### Enable PPP Client Interface Source: https://help.mikrotik.com/docs/spaces/ROS/pages/328072/PPP Use this command to access the PPP client configuration menu. ```bash /interface ppp-client ``` -------------------------------- ### Import WireGuard Configuration using config-string Source: https://help.mikrotik.com/docs/spaces/ROS/pages/69664792/WireGuard Starting from version 7.19_ab41, the `config-string` parameter allows importing configurations via a CLI command. This example demonstrates its usage. ```bash /interface wireguard/wg-import config-string=" [Interface] Address =192.168.88.3/24 ListenPort = 13533 PrivateKey = UBLqJEFZZf9wszZSUF2BPWa9dsMX99RbEcxlNfxWffk= [Peer] PublicKey = EoF7HlFu3fbOnuYbyGqLMJkPZgQk9n3WwONZuJZ6qWc= Endpoint = 199.168.100.10:51820 AllowedIPs = 0.0.0.0/0 PersistentKeepalive = 25" ``` -------------------------------- ### Navigate to ThingsBoard Directory Source: https://help.mikrotik.com/docs/spaces/ROS/pages/166920348/Container%2B-%2BThingsBoard%2BMQTT%2BHTTP%2Bserver Use the 'cd' command to navigate to the ThingsBoard installation directory in your terminal. ```bash C:\Windows\System32>cd c:\Users\Admin\Desktop\ThingsBoard ``` -------------------------------- ### Example Volume Mount Configuration Source: https://help.mikrotik.com/docs/spaces/ROS/pages/343244823/Apps Define host directories to be mounted into the application container using this volume configuration. ```yaml volumes: - [dir-on-host]:[dir-in-app] ``` -------------------------------- ### Create Dual-Band Home AP Configuration Source: https://help.mikrotik.com/docs/spaces/ROS/pages/224559120/WiFi This example demonstrates setting up a dual-band WiFi access point by creating a common security profile, a common configuration profile, and separate channel configurations for 2.4GHz and 5GHz bands. It then assigns these profiles to specific WiFi interfaces. ```bash # Creating a security profile, which will be common for both interfaces /interface wifi security add name=common-auth authentication-types=wpa2-psk,wpa3-psk passphrase="diceware makes good passwords" wps=disable # Creating a common configuration profile and linking the security profile to it /interface wifi configuration add name=common-conf ssid=MikroTik country=Latvia security=common-auth # Creating separate channel configurations for each band /interface wifi channel add name=ch-2ghz frequency=2412,2432,2472 width=20mhz add name=ch-5ghz frequency=5180,5260,5500 width=20/40/80mhz # Assigning to each interface the common profile as well as band-specific channel profile, in case of "no supported channels" message on interfaces, make sure that correct (channel) configuration is applied to each. /interface wifi set wifi1 channel=ch-5ghz configuration=common-conf disabled=no set wifi2 channel=ch-2ghz configuration=common-conf disabled=no ``` -------------------------------- ### Create HAProxy Container Source: https://help.mikrotik.com/docs/spaces/ROS/pages/297795651/Container%2B-%2BHAProxy This command creates a HAProxy container, mounting a configuration directory and starting it on boot. ```bash /container/mounts/add name=MOUNT_HAPROXY src=disk1/volumes/haproxy/config dst=/usr/local/etc/haproxy /container/add remote-image=haproxy:latest interface=veth1 root-dir=disk1/images/haproxy mounts=MOUNT_HAPROXY name=haproxy start-on-boot=yes user=0:0 logging=yes ``` -------------------------------- ### Add a configured MQTT broker Source: https://help.mikrotik.com/docs/spaces/ROS/pages/46759978/MQTT An example of adding a specific MQTT broker with detailed configuration parameters including name, address, port, SSL, client ID, auto-connect, and keep-alive settings. ```bash /iot mqtt brokers add name="broker" address="192.168.88.33" port=1883 ssl=no client-id="test-client" auto-connect=no keep-alive=60 ``` -------------------------------- ### Configure Bonding and Slave Interface Discovery Source: https://help.mikrotik.com/docs/spaces/ROS/pages/24805517/Neighbor%2Bdiscovery This example demonstrates how to set up a bonding interface with specific slave interfaces and then configure neighbor discovery to only operate on a particular slave interface using an interface list. This ensures discovery messages are received on the intended slave. ```bash /interface bonding add name=bond1 slaves=ether5,ether6 /interface list add name=only-ether5 /interface list member add interface=ether5 list=only-ether5 /ip neighbor discovery-settings set discover-interface-list=only-ether5 ``` -------------------------------- ### Successful LoRa Connection Log Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/16351619/General%2BProperties This log output shows a successful sequence of events for a LoRa gateway connection, including starting the forwarder, connecting to the network server, and becoming ready. ```log 13:50:33 lora,info gateway-0 forwarder started 13:50:38 lora,info [LNS] connecting to wss://eu1.cloud.thethings.network:8887/router-info 13:50:39 lora,info [LNS] eu1.cloud.thethings.network discovered 13:50:39 lora,info [LNS] eu1.cloud.thethings.network disconnected 13:50:39 lora,info [LNS] connecting to wss://eu1.cloud.thethings.network:8887/traffic/eui-xxxx 13:50:39 lora,info [LNS] eu1.cloud.thethings.network configured 13:50:52 lora,info gateway-0 forwarder is ready ``` -------------------------------- ### Simultaneous Commands Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579160/API Demonstrates how to execute multiple commands simultaneously, including listening for interface changes, setting interface state, and retrieving interface lists. Tags are used to correlate requests and responses. ```text /login -- _first start listening for interface changes (tag is 2)_ /interface/listen .tag=2 -- _disable interface (tag is 3)_ /interface/set =disabled=yes =.id=ether1 .tag=3 -- _this is done for disable command (tag 3)_ !done .tag=3 -- _enable interface (tag is 4)_ /interface/set =disabled=no =.id=ether1 .tag=4 -- _this update is generated by a change made by the first set command (tag 3)_ !re =.id=*1 =disabled=yes =dynamic=no =running=no =name=ether1 =mtu=1500 =type=ether .tag=2 -- _this is done for enable command (tag 4)_ !done .tag=4 -- _get interface list (tag is 5)_ /interface/getall .tag=5 -- _this update is generated by a change made by the second set command (tag 4)_ !re =.id=*1 =disabled=no =dynamic=no =running=yes =name=ether1 =mtu=1500 =type=ether .tag=2 -- _these are replies to getall command (tag 5)_ !re =.id=*1 =disabled=no =dynamic=no =running=yes =name=ether1 =mtu=1500 =type=ether .tag=5 !re =.id=*2 =disabled=no =dynamic=no =running=yes =name=ether2 =mtu=1500 =type=ether .tag=5 -- _here interface getall ends (tag 5)_ !done .tag=5 -- _stop listening - request to cancel command with tag 2, cancel itself uses tag 7_ /cancel =tag=2 .tag=7 -- _listen command is interrupted (tag 2)_ !trap =category=2 =message=interrupted .tag=2 -- _cancel command is finished (tag 7)_ !done .tag=7 -- _listen command is finished (tag 2)_ !done .tag=2 ``` -------------------------------- ### Initial Login (post-v6.43) Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579160/API Provides an example of the initial login sequence using username and password, sent in plain text. Errors are indicated by '=message=_error message_'. ```text /login --- =name=admin =password= !done ``` -------------------------------- ### Python API Client Example Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579160/API A basic example of an API client written in Python 3 for interacting with the MikroTik API. It demonstrates login, command execution, and response handling. ```bash debian@localhost:~/api-test$ ./api.py 10.0.0.1 admin '' <<< /login <<< >>> !done >>> =ret=93b438ec9b80057c06dd9fe67d56aa9a >>> <<< /login <<< =name=admin <<< =response=00e134102a9d330dd7b1849fedfea3cb57 <<< >>> !done >>> /user/getall <<< /user/getall <<< >>> !re >>> =.id=*1 >>> =disabled=no >>> =name=admin >>> =group=full >>> =address=0.0.0.0/0 >>> =netmask=0.0.0.0 >>> >>> !done >>> ``` -------------------------------- ### Python Example for GuestProgramSpec Source: https://help.mikrotik.com/docs/spaces/ROS/pages/18350234/Cloud%2BHosted%2BRouter%2BCHR This Python script demonstrates how to use the GuestProgramSpec to execute commands within a virtual machine. Ensure the 'programPath' is set to 'inline' for script text or 'import' for a file path, and 'arguments' are correctly formatted. ```python #!/usr/bin/env python ``` -------------------------------- ### Enable PPP Server Interface Source: https://help.mikrotik.com/docs/spaces/ROS/pages/328072/PPP Use this command to access the PPP server configuration menu. ```bash /interface ppp-server ``` -------------------------------- ### Run Netinstall CLI Source: https://help.mikrotik.com/docs/spaces/ROS/pages/24805390/Netinstall Execute the Netinstall CLI tool with optional parameters and the target RouterOS package. Requires root privileges. ```bash sudo ./netinstall-cli [-parameters] [address/interface] routeros-arm64-[package VERSION].npk ``` -------------------------------- ### Configure RouterBOOT Setup Key Source: https://help.mikrotik.com/docs/spaces/ROS/pages/120324130/UPS Set the RouterBOOT setup key to ' key only' to prevent accidental entry into the setup menu during startup when using a serial UPS connection. ```text Select key which will enter setup on boot: * 1 - any key 2 - key only your choice: ``` -------------------------------- ### Configure Email Settings for Backups Source: https://help.mikrotik.com/docs/spaces/ROS/pages/40992881/Scheduler This example configures the SMTP server and From address for the email backup script. Ensure these settings are correctly configured before scheduling the backup script. ```bash [admin@MikroTik] tool e-mail> set server=159.148.147.198 from=SysAdmin@host.com [admin@MikroTik] tool e-mail> print server: 159.148.147.198 from: SysAdmin@host.com [admin@MikroTik] tool e-mail> ``` -------------------------------- ### Netinstall-CLI Command Line Syntax Source: https://help.mikrotik.com/docs/spaces/ROS/pages/24805390/Netinstall This is the general command-line syntax for the netinstall-cli tool. It outlines the available parameters for device reinstallation and configuration. ```bash netinstall-cli [-r] [-e] [-b] [-m [-o]] [-f] [-k ] [-s ] [-sm ] [--mac ] {-i | -a } [PACKAGES] ``` -------------------------------- ### Quick Example: Configure Email Notifications for Software Crashes Source: https://help.mikrotik.com/docs/spaces/ROS/pages/8978694/Watchdog Example of how to configure the Watchdog to send a support output file to a specific email address via a given SMTP server in case of a software crash. ```APIDOC ## Example: Configure Email Notifications for Software Crashes ### Description This example demonstrates how to enable automatic sending of support output files via email when a software crash occurs. ### Command ```bash /system watchdog set auto-send-supout=yes send-email-to=support@example.com send-smtp-server=192.0.2.1 ``` ### Verification ```bash /system watchdog print ``` ### Expected Output Snippet ``` watch-address: none watchdog-timer: yes no-ping-delay: 5m automatic-supout: yes auto-send-supout: yes send-smtp-server: 192.0.2.1 send-email-to: support@example.com ``` ``` -------------------------------- ### Export device configuration Source: https://help.mikrotik.com/docs/spaces/ROS/pages/47579162/REST%2BAPI This example shows how to export the device configuration using the REST API. ```APIDOC ## POST /rest/export ### Description Exports the device configuration. ### Method POST ### Endpoint /rest/export ### Request Body - **compact** (string) - Optional - If present, exports a compact configuration. - **file** (string) - Required - The name of the file to save the configuration to (e.g., `test.rsc`) ### Request Example ```json { "compact": "", "file": "test.rsc" } ``` ### Response (No specific success response details provided in source) ### Error Handling (No specific error handling details provided in source) ``` -------------------------------- ### Download Netinstall Tool Source: https://help.mikrotik.com/docs/spaces/ROS/pages/24805390/Netinstall Use wget to download the Netinstall tool archive. Replace [VERSION] with the desired RouterOS version. ```bash wget https://download.mikrotik.com/routeros/[VERSION]/netinstall-[VERSION].tar.gz ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.