Posts: 1
Joined: Thu May 16, 2019 6:57 am

Creation of ethernet interface for Lxc containers on raspberry pi

Thu May 16, 2019 7:21 am

Hi all,
I am doing some research on LXC containers.I have tried with running containers on raspberry pi and was successfull.Now i want use host's network on my ubuntu container ie i need a ethernet interface on raspberry pi for enabling network on my container.

Procedure i have followed so far to create the br0
->Installed brctl the utility and ifupdown.
->Following changes were made to interfaces file to automatically set up the bridge br0.
iface br0 inet dhcp
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
iface br0 inet6 dhcp
->Created /etc/systemd/network/ file, and added the following:

->Edited /etc/rc.local and added the following.
## put hacks here

# fix for br0 interface
/sbin/ifup br0
# kick networkd as well
/bin/systemctl restart systemd-networkd
echo "Bridge is up"
exit 0
->made rc.local as executable and rebooted the pi to follow the changes.
After the reboot rasberry pi failed to establish a wifi connection.
when i tried to connect to a wifi network.It shows a error a message as ERROR:could not communicate with wpa_supplicant.

Please do support.

Posts: 3548
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Creation of ethernet interface for Lxc containers on raspberry pi

Thu May 16, 2019 10:24 am

Don't sue me for saying this but LXC (and LXD more so) is a dead-end, it is being wiped out of relevance by Docker.
It's all the same linux container techniques but the toolkit that manipulates them differs. And there are many more Docker users than LXC users.

This being said.
- Perhaps you can clarify your post as to where you are configuring networking: in the host or in the guest?
- Installing ifupdown is by and large an unfortunate decision these days. Esp. if you also use systemd-networkd.
- Your bridge specification à la ifupdown style looks ok. By now you could do exactly the same using the standard "ip" command and optionally the "bridge" command and get rid of both ifupdown and brctl-utils.
- Manipulating the network from rc.local is only ok for testing. Systemd starts networking during boot and there is a legacy service for ifupdown that by default should do "ifup -a" at the right moment.
- Your post is all about ethernet and suddenly you mention wifi failure. What does wifi have to do with all this? Failure in the guest or the host?

I'll add 2 bits of trivia just in case:
1. Adding a wifi client interface to a bridge is not possible. Adding a wifi access point interface to a bridge is possible. This is by the WiFi standards, there is no way around this law short of not using wifi (eg using a non-wifi compliant driver)
2. If your intention is to move the WiFi interface to the guest, you have to move the adapter's phy to the guest's network namespace and not the adapter itself. See here for details (my own question, dug out by the magic of Google. S. Graber is the authority on LXC/LXD.)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Networking and servers”