I am trying to set up a container with two interfaces:
1: eth0 based on the default, lxdbr0 to allow internet connection which is available via wifi
2: eth1 based on macvlan
eth0 is behaving as expected but eth1’s ip is not coming up.
Notes:
- When I set up a new container with macvlan only on eth0, an ip address is assigned and containers in host 1 and host 2 can ping each other.
- macvlan only works with ethernets. My ethernets are connected to a routher without internet connection. The router with internet connection does not have ethernet port to link supply internet connection to the other router (see diagram). But I must have internet connection to the containers for online installations and other fundumental functions.
- Also tried bridged network for eth1 but with similar results - no ip assiged to eth1.
Where am I going wrong(see my steps below)?..or is this setup valid(see diagram)?
The setup should be as below:
Below are the steps that I took:
# launch a1 with default with eth0 as a slave to lxdbr0
$ lxc launch ubuntu:22.04 a1
# stopped the container to setup eth1
$ lxc stop a1
# created the network macvlan-network
$ lxc network create macvlan-network --type=macvlan parent=br-enp0s31f6
# attached eth1 to a1
$ lxc network attach macvlan-network a1 eth1 eth1
# start the container
$ lxc start a1
# shell into a1, check the nics. No ip address assigned to eth1
$ lxc shell a1
root@a1:~# 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
32: eth0@if33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:16:3e:6b:93:c6 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.2.219/24 metric 100 brd 192.168.2.255 scope global dynamic eth0
valid_lft 3447sec preferred_lft 3447sec
inet6 fd42:98c5:aa08:d6b1:216:3eff:fe6b:93c6/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 3575sec preferred_lft 3575sec
inet6 fe80::216:3eff:fe6b:93c6/64 scope link
valid_lft forever preferred_lft forever
34: eth1@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:16:3e:b9:14:ed brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::216:3eff:feb9:14ed/64 scope link
valid_lft forever preferred_lft forever
root@a1:~#