### Install RouterOS: # Download RouterOS CD Image from https://mikrotik.com/download. Select the X86 version. wget https://download.mikrotik.com/routeros/X.XX.X/mikrotik-X.XX.X.iso # Create a hard disk: qemu-img create -f qcow2 mikrotik.qcow2 1G # Install RouterOS: qemu-system-x86_64 \ -name MIKRO1 \ -m 512 \ -smp cpus=1 \ -enable-kvm \ -hda mikrotik.qcow2 \ -cdrom mikrotik-X.XX.X.iso \ -serial telnet::2000,server,nowait \ -monitor tcp:127.0.0.1:4000,server,nowait \ -curses \ -boot d \ -net none \ -net nic,model=e1000,vlan=1,macaddr=4c:5e:0c:01:02:01 \ -net nic,model=e1000,vlan=2,macaddr=4c:5e:0c:01:02:02 \ -net nic,model=e1000,vlan=3,macaddr=4c:5e:0c:01:02:03 \ -net nic,model=e1000,vlan=4,macaddr=4c:5e:0c:01:02:04 \ -net socket,vlan=1,udp=127.0.0.1:9011,localaddr=:9001 \ -net socket,vlan=2,udp=127.0.0.1:9012,localaddr=:9002 \ -net socket,vlan=3,udp=127.0.0.1:9013,localaddr=:9003 \ -net socket,vlan=4,udp=127.0.0.1:9014,localaddr=:9004 # Install the required packages. # Once the packages are installed, the router boots and enter in the installation again. To poweroff the router and exit, open another terminal, enter to the qemu monitor console with 'telnet 127.0.0.1 4000' and execute the 'quit' command. # Done!. RouterOS is installed in the hard disk. ### Use RouterOS. # Power on the router: qemu-system-x86_64 \ -name MIKRO1 \ -m 512 \ -smp cpus=1 \ -enable-kvm \ -hda mikrotik.qcow2 \ -serial telnet::2000,server,nowait \ -monitor tcp:127.0.0.1:4000,server,nowait \ -display none \ -daemonize \ -net none \ -net nic,model=e1000,vlan=1,macaddr=4c:5e:0c:01:02:01 \ -net nic,model=e1000,vlan=2,macaddr=4c:5e:0c:01:02:02 \ -net nic,model=e1000,vlan=3,macaddr=4c:5e:0c:01:02:03 \ -net nic,model=e1000,vlan=4,macaddr=4c:5e:0c:01:02:04 \ -net socket,vlan=1,udp=127.0.0.1:9011,localaddr=:9001 \ -net socket,vlan=2,udp=127.0.0.1:9012,localaddr=:9002 \ -net socket,vlan=3,udp=127.0.0.1:9013,localaddr=:9003 \ -net socket,vlan=4,udp=127.0.0.1:9014,localaddr=:9004 # For TAP connection: As root: tunctl -u -t ifconfig netmask up qemu: -net nic,model=e1000,vlan=,macaddr=4c:5e:0c:01:02:0 \ -net tap,vlan=,ifname=,script=no For delete the TAP interface: tunctl -d # For bridge connection to real ethernet interface: As root: ip link add type bridge ip addr flush dev # <-- WARNING! ip tuntap add dev mode tap user ip link set master ip link set master ip link set dev up ip link set dev up ip link set dev up ip addr add dev qemu: -net nic,model=e1000,vlan=,macaddr=4c:5e:0c:01:02:0 \ -net tap,vlan=,ifname=,script=no Delete interfaces: ip link delete ip link delete ip link set dev down # Enter to the router serial console: telnet 127.0.0.1 2000 username: admin password: # To poweroff the router: * Inside RouterOS: /system shutdown * Outside RouterOS: telnet 127.0.0.1 4000 quit # Warning: the ethernet interfaces can be out of order, check the mac address and interfaces names: [admin@MikroTik] > /interface ethernet print Flags: X - disabled, R - running, S - slave # NAME MTU MAC-ADDRESS ARP 0 R ether1 1500 4C:5E:0C:01:02:03 enabled 1 R ether2 1500 4C:5E:0C:01:02:04 enabled 2 R ether3 1500 4C:5E:0C:01:02:01 enabled 3 R ether4 1500 4C:5E:0C:01:02:02 enabled