root@c2:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
10: eth0@if11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:16:3e:de:5a:06 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.177.108.109/24 brd 10.177.108.255 scope global dynamic eth0
valid_lft 3468sec preferred_lft 3468sec
inet6 fd42:6507:3321:8a12:216:3eff:fede:5a06/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 3541sec preferred_lft 3541sec
inet6 fe80::216:3eff:fede:5a06/64 scope link
valid_lft forever preferred_lft forever
12: eth1@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:16:3e:c3:c3:2b brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::216:3eff:fec3:c32b/64 scope link
valid_lft forever preferred_lft forever
root@c2:~# ip r
default via 10.177.108.1 dev eth0 proto dhcp src 10.177.108.109 metric 100
10.177.108.0/24 dev eth0 proto kernel scope link src 10.177.108.109
10.177.108.1 dev eth0 proto dhcp scope link src 10.177.108.109 metric 100
So when your eth0 NIC device is connected to the LXD managed lxdbr0, it will get a private address from that bridge via DHCP.
When you attach another NIC, in this case eth1 as a macvlan connected to your wlx28ee52172bcc interface, the container doesnât have any automatic configuration, so nothing happens (apart from the IPv6 link local addressing).
So you need to modify your containerâs network config inside the container (in this case modifying /etc/netplan/10-lxc.yaml ) to do what you want to do, be it a statically assigned IP or to use DHCP, the same way you would with a real computer. You can also do this configuration automatically using cloud-init (which LXD supports passing config to).
Also, you will likely have problems getting macvlan to work with a wifi parent as the different MAC addresses will cause issues with wifi authentication.
If the DHCP servers on the two separate networks both return a default route then the DHCP client inside your container will do one of two things:
Setup the default route to the first or last DHCP request complete (this may be different each time you reboot).
Setup two default routes via different networks, which means outgoing connections will randomly take different paths (and thus appear to come from different IPs).
Neither outcome will likely be desirable.
Can you show the output of ip r in the container now?
root@c2:~# ip r
default via 10.177.108.1 dev eth0 proto dhcp src 10.177.108.109 metric 100
default via 192.168.1.1 dev eth1 proto dhcp src 192.168.1.50 metric 100
10.177.108.0/24 dev eth0 proto kernel scope link src 10.177.108.109
10.177.108.1 dev eth0 proto dhcp scope link src 10.177.108.109 metric 100
192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.50
192.168.1.1 dev eth1 proto dhcp scope link src 192.168.1.50 metric 100
Yeah, so you can see the two default routes out of each interface there, and the metric priority is the same, so I believe outbound connections will be load balanced over those two, meaning the lxdbr0 one will go through NAT and appear to be your LXD host, and the macvlan one will appear to be your container on the external network.