Nothing too spectacular, I’m afraid. I had to consolidate some physical machines, all running Gentoo Linux. For each, I simply created a Gentoo LXC container and then replaced the rootfs (in
/var/lib/lxc/NAME/rootfs) with the one from the physical server.
The significant changes from the physical systems were:
* rc_provide="net" in rc.conf because base networking is controlled externally
* rc_sys="lxc" may or may not be necessary
* Disable various net setup services
On the host OS (Debian) I have interfaces like this:
auto ipvl-main
iface ipvl-main inet manual
pre-up ip link add link eth0 name ipvl-main type ipvlan mode l2
post-down ip link delete ipvl-main
In the container config, they are referenced this way:
lxc.net.2.type = phys
lxc.net.2.link = ipvl-main
lxc.net.2.ipv4.address = 1.2.3.4/29
lxc.net.2.ipv4.gateway = 1.2.3.1
lxc.net.2.ipv6.address = abcd::2/128
lxc.net.2.ipv6.gateway = fe80::1
lxc.net.2.flags = up
Later on, I removed the dedicated IP address and set up a reverse proxy instead.
Oh yeah, all containers are of course privileged containers. With unprivileged containers, various things may not work as expected.