This is what worked for me, assuming we want to use
eth0 interface of raspberry pi.
Install pre-requisites
apt-get install qemu-system-x86
Preparing tap interface for bridged networking for qemu
(from
https://wiki.qemu.org/Documentation/Net ... s_on_Linux)
Setup bridge
br0 and let it bridge over newly created
tap interface and
eth0.
modprobe tun tap # unnecessary if tun/tap is built-in
ip link add br0 type bridge
ip tuntap add dev tap0 mode tap
ip link set dev tap0 master br0 # set br0 as the target bridge for tap0
ip link set dev eth0 master br0 # set br0 as the target bridge for eth0
ip link set dev br0 up
# staitc ip for bridge
PREFIX=192.168.1.5/24
# gateway
ROUTE=192.168.1.11
ip address add $PREFIX dev br0
ip route add default via $ROUTE dev br0
Prepare and run qemu
1. Download CHR router raw disk image
wget https://download.mikrotik.com/routeros/6.48.6/chr-6.48.6.img.zip
2. Unzip
gunzip -c chr-*.img.zip > chr.img
3. Convert img to qcow:
qemu-img convert chr.img -O qcow2 chr.qcow2
3. Launch in x86_64 qemu:
sudo qemu-system-x86_64 -vnc :0 -nographic -hda chr.qcow2 -nic tap
(open up vnc at port 1900 for remote display, listening to 127.0.0.1. Network is bridged with host)
I find this quite convenient way to remotely utilize CHR's built-in mac-telnet tool. It was my saviour since I had raspberry pi in the same L2 network....