[lxc-users] Bind public IP that is available on host's ens3:1 to a specific LXD container?

Thomas Ward teward at ubuntu.com
Sat May 20 02:01:47 UTC 2017


Hello.

I've got a VDS from RamNode - which is essentially a KVM VPS with
dedicated CPUs, and larger RAM capacity.  This VDS has three IPs.  I'm
going to obfuscate them here, but essentially the host box is configured
like this:


# The primary network interface
auto ens3
iface ens3 inet static
    address 1.2.3.107
    netmask 255.255.255.0
    gateway 1.2.3.1
    dns-nameserver 8.8.8.8 8.8.4.4

auto ens3:1
iface ens3:2 inet static
    address 1.2.4.17
    netmask 255.255.255.0
    gateway 1.2.4.1
    dns-nameserver 8.8.8.8 8.8.4.4

auto ens3:2
iface ens3:2 inet static
    address 1.2.4.34
    netmask 255.255.255.0
    gateway 1.2.4.1
    dns-nameserver 8.8.8.8 8.8.4.4


Now, I've got a container I'd like to route the 1.2.4.17 to a specific
container once I've created it, but ens3 is the only actual physical NIC
on the system, and I don't have the ability to add any more physical NICs.

How would I go about routing 1.2.4.17 to the 'new' container I'm going
to create?

Note that by default, new containers are attached to an 'lxdbr0' which
NATs container traffic, this new container would have to reside outside
that obviously, but I'm not fluent in LXC/LXD networking so a guide
and/or how-tos for this would be wonderful to have.


------

Thomas



More information about the lxc-users mailing list