Hi everyone,
I’m running a small VPS hosting business and I’m starting looking into LXD as a potential replacement for OpenVZ but I’m finding many difficulties in setting up the network.
I need to set up the network so that all contaieners are availabel on the internet. I have read many posts on this form and elsewhere but I cant manage to make it work.
I have a basic Ubuntu 18.04 set up and thse are the steps I have been following:
I run the initial set up with all defaults so I have the managed bridged interface ready.
As first step I create the container:
root@server:~# lxc launch ubuntu:18.04 webserver
Creating webserver
Starting webserver
now the newly created container has DHCP assigned IP:
root@server:~# lxc list
±----------±--------±----------------------±---------------------------------------------±-----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±----------±--------±----------------------±---------------------------------------------±-----------±----------+
| webserver | RUNNING | 10.229.218.173 (eth0) | fd42:9f0f:a7e:c6c0:216:3eff:fe93:1bf1 (eth0) | PERSISTENT | 0 |
±----------±--------±----------------------±---------------------------------------------±-----------±----------+
Let’s say want to assign the following IP to webserver container: 104.218.16.147
I run the following commands:
lxc stop webserver
lxc network attach lxdbr0 webserver eth0
lxc config device set webserver eth0 ipv4.address 104.218.16.147
lxc start webserver
but I still see the old IP:
root@server:~# lxc list
±----------±--------±----------------------±---------------------------------------------±-----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±----------±--------±----------------------±---------------------------------------------±-----------±----------+
| webserver | RUNNING | 10.229.218.173 (eth0) | fd42:9f0f:a7e:c6c0:216:3eff:fe93:1bf1 (eth0) | PERSISTENT | 0 |
±----------±--------±----------------------±---------------------------------------------±-----------±----------+
Why is it like that? What I am doing wrong?