I have a host with a public IP h.h.h.h on Ubuntu 18.04. I have 2 LXD containers running on it also on Ubuntu 18.04. I am having difficulty assigning public IPs (let’s say c.c.c.1 and c.c.c.2) to the containers. I tried to follow this post:
and did the following:
host: lxc network set lxdbr0 ipv4.routes c.c.c.1/32
c1: ip -4 addr add dev eth0 c.c.c.1/32
I couldn’t ping c.c.c.1 from elsewhere. When I added c.c.c.1 to the host, I could ping it which means my hosting company’s routing is working.
What am I missing? Is routing not the right way? Should I forward traffic from host through the bridge to containers? If so, how to do that?
Routing is probably not going to work in my case because as soon as I did “lxc network set lxdbr0 ipv4.routes c.c.c.2/32” on the host, I couldn’t ping c.c.c.1 on the host any more. So how to support 2 containers with public IPs?
Thanks a lot!
PS: Additional information:
# lxc profile show default config: environment.http_proxy: "" user.network_mode: "" description: Default LXD profile devices: eth0: name: eth0 nictype: bridged parent: lxdbr0 type: nic name: default used_by: - /1.0/containers/a - /1.0/containers/b
The container “b” was created with this default profile and yet it has nothing about the bridge:
# lxc config device show vps605 root: path: / pool: default type: disk
Is this wrong?