Setting up network on qemu OpenWrt image

Welcome everybody, I'm Chris and just started some development project for OpenWrt device.

Now, I run qemu virtual machine on Mac M1 host using suggested command:

qemu-system-aarch64 -m 1024 -smp 2 -cpu host -M virt,highmem=off -nographic -accel hvf -kernel openwrt-armvirt-64-Image -drive file=openwrt-armvirt-64-rootfs-squashfs.img,format=raw,if=virtio -append root=/dev/vda -device virtio-net,netdev=net0 -netdev user,id=net0,net=192.168.1.0/24,hostfwd=tcp:127.0.0.1:1122-192.168.1.1:22 -device virtio-net,netdev=net1 -netdev user,id=net1,net=192.0.2.0/2

As the result, I got VM with 192.168.1.1 for LAN, while my router has the same address, and obviously I cannot reach hosts within my LAN from it. What should I do to set LAN interface for different IP address and point 192.168.1.1 as default router?

Thanks

Welcome Chris.
If I understand correctly both your devices share the same IP and you can't modify the Host, but can access the Router. (If I have that backward sorry).

Use this time tested solution. SSH into the VM or Router and change the Interface IP to a different Subnet.

Well I changed network settings and it looks quite good:

network.loopback=interface
network.loopback.device='lo'
network.loopback.proto='static'
network.loopback.ipaddr='127.0.0.1'
network.loopback.netmask='255.0.0.0'
network.globals=globals
network.globals.ula_prefix='fdbe:0cf2:85e7::/48'
network.@device[0]=device
network.@device[0].name='br-lan'
network.@device[0].type='bridge'
network.@device[0].ports='eth0'
network.lan=interface
network.lan.device='br-lan'
network.lan.proto='static'
network.lan.ipaddr='192.168.1.80'
network.lan.netmask='255.255.255.0'
network.lan.ip6assign='60'
network.wan=interface
network.wan.device='eth1'
network.wan.proto='dhcp'
network.wan6=interface
network.wan6.device='eth1'
network.wan6.proto='dhcpv6'

However it does not have access to any hosts in the same network - no ping works.

This is were the VM still is correct? I have a dumb question.. how do you know the VM is running if you can't query it and it's headless. I'm a newb here.

Perhaps.. changing the IF line hostfwd=tcp:127.0.0.1:1122-192.168.1.1 to "192.168.2.1" and retry the procedure now that the IP's are different and begin again.

qemu-system-aarch64 -m 1024 -smp 2 -cpu host -M virt,highmem=off -nographic -accel hvf -kernel openwrt-armvirt-64-Image -drive file=openwrt-armvirt-64-rootfs-squashfs.img,format=raw,if=virtio -append root=/dev/vda -device virtio-net,netdev=net0 -netdev user,id=net0,net=192.168.1.0/24,hostfwd=tcp:127.0.0.1:1122-192.168.2.1:22 -device virtio-net,netdev=net1 -netdev user,id=net1,net=192.0.2.0/2

I'm speaking out of my league here so perhaps OpenWrt VM gurus will see me flailing, and pounce on your prospective solution.

Thank You and sit tight.