CentOS 7.x lxc container networking
To configure lxc container networking, we can use software bridges on the host. For creating desired network using software bridges refer to CentOS 7.x Managing virtual networks using libvirt virsh command
Once network bridge is available to configure lxc container to use the desired bridge use following steps:
- Ensure that container is stopped
- Edit /var/lib/lxc/<container-name>/config file
- Update 'lxc.network.link' value to desired bridge name
- Start container and verify
- Note that if the network requires static IP addressing then appropriate guest network configuration must be done.
Update default lxc container bridge
To make a specific network-bridge default for all new containers edit '/etc/lxc/default.conf' and update value of 'lxc.network.link' in this file appropriately.