I created a macvlan type network in docker on the openwrt system (IP: 10.10.10.1), named vr, parent interface br-lan, subnet set to 10.10.10.0/24, gateway 10.10.10.1 (i.e. the IP address of openwrt). And started an alpine container, the network is set to vr, IP is 10.10.10.3. And added a macvlan bridge network using the following configuration:
ip link add br link br-lan type macvlan mode bridge
ip addr add 10.10.10.50 dev br
ip link set br up
ip route add 10.10.10.3 dev br
Then use the ip addr show br command to see that the interface IP is 10.10.10.50.
In the alpine container, you can connect to other devices in the LAN, such as 10.10.10.4. But I can’t connect to the host machine, which is openwrt, 10.10.10.1. I can’t connect to the internet either. How can I solve this problem?
This is a known limitation that affects macvlan and ipvlan networks. Every good blog post should mention it, along with the existing workaround. Usually they call it “macvlan-shim”.
Please use the forum search for that term, as everything that you need to know is shared in those topics already.