Unable to SSH into OpenWrt VM after configuring specific interfaces

Hi all,
I'm new to OpenWrt and networking in general, so please bear with me if I have a poor understanding of something.

I am trying to set up an OpenWrt image with a basic configuration to install onto my PCEngines APU2 router. I would like to configure the image on a laptop before flashing it onto my router. To do this, I follow these steps:

  1. Download the openwrt-18.06.4-x86-64-combined-ext4.img.gz image
  2. Launch a VM from this image with QEMU, providing 3 virtual NICs that would correspond to the three physical ports on my APU2. (Note that I am forwarding port 2222 on my laptop to port 22 of the lan1 QEMU virtualized NIC for SSH access from my host laptop.)
/usr/local/bin/qemu-system-x86_64 -display gtk -m 512M -netdev user,id=lan0 -device virtio-net,netdev=lan0 -netdev user,id=lan1,hostfwd=tcp::2222-:22 -device virtio-net,netdev=lan1 -netdev user,id=lan2 -device virtio-net,netdev=lan2 -drive file=openwrt-18.06.4-x86-64-combined-ext4.img,index=0,media=disk,format=raw
  1. Inside the VNC window and OpenWrt, I reconfigure the eth1 physical interface provided by QEMU as follows:
ifdown lan
uci del network.lan
uci set network.lan=interface
uci set network.lan.proto=dhcp
uci set network.lan.ifname=eth1
uci commit
ifup lan

From here I can SSH into the image and finish the configuration.

Problem

I noticed, however, that if I try the exact same procedure for physical interface eth2 instead of eth1 then I cannot SSH into the image. This involves exposing port 2222 on my host to port 22 of the lan2 QEMU device and setting network.lan.ifname to eth2 with UCI.


# From the host
/usr/local/bin/qemu-system-x86_64 -display gtk -m 512M -netdev user,id=lan0 -device virtio-net,netdev=lan0 -netdev user,id=lan1 -device virtio-net,netdev=lan1 -netdev user,id=lan2,hostfwd=tcp::2222-:22 -device virtio-net,netdev=lan2 -drive file=openwrt-18.06.4-x86-64-combined-ext4.img,index=0,media=disk,format=raw

# From the QEMU VNC window
ifdown lan
uci del network.lan
uci set network.lan=interface
uci set network.lan.proto=dhcp
uci set network.lan.ifname=eth2
uci commit
ifup lan

When I try the command ssh -p 2222 root@localhost from my host laptop, the command just hangs for a few 10s of seconds, eventually outputting ssh_exchange_identification: read: Connection reset by peer.

Question

  1. Why can I not connect to the image in this case with SSH?
  2. How would I configure the OpenWrt image so that I can access it over SSH through the eth2 physical interface? I'm configuring a vanilla base image, without any prior customization.

Thanks!

Additional info

Here are the contents of /etc/config/network on the vanilla OpenWrt image before I do anything to it:

config interface `loopback`
        option ifname `lo`
        option proto `static`
        option ipaddr `127.0.0.1`
        option netmask `255.0.0.0`

config globals `globals`
        option ula_prefix `xxxx:xxxx:xxxx::/48`

config interface `lan`
        option type `bridge`
        option ifname `eth0`
        option proto `static`
        option ipaddr `192.168.1.1`
        option netmask `255.255.255.0`
        option ip6assign `60`

config interface `wan`
        option ifname `eth1`
        option proto `dhcp`

config interface `wan6`
        option ifname `eth1`
        option proto `dhcpv6`