Here are the summary details of my network:
- Router Netgear/wireless capable, connected to the ISP via PPPoE Dynamic IP IPv4 and IPv6 support.
- Lab network is configured no DHCP server everything is configured manually network is 192.168.0.0/24
- I have an internal DNS server setup Pri = 192.168.0.101 Sec = 192.168.0.102 I resolve forward and reverse lookup internally fine
- I have a small server 16G 1 CPU 4 cores - this server 192.168.0.2 is running Debian 9.3 amd64 with currently lxd 2.21 installed using snap (thanks stgraber for one of those canonical seminars)
- I have a couple of systems on the network already running different things: chef-server = 192.168.0.111, chefdk = 192.168.0.3, other Linux OSes ubuntu = 192.168.0.3, debian = 192.168.0.4, solus = 192.168.0.5, etc all these machines are in the same network, they can ping/ssh each other via name thanks to the internal dns server.
Goal:
- I want to use the debian server 192.168.0.2 as my main LXD/LXC host or server I guess means the same correct me if I am wrong.
- I want to have the containers have an IP address assigned manually as if they were other OS as the ones described, e.g. container1 = 192.168.0.41, container2 = 192.168.0.42, container3 = 192.168.0.43 and so on.
- I want the containers to accessible from the internet and access the internet by themselves just like the no container ones I mentioned above. Currently, if I want to have access to one of the no container systems I do a port address translation in the Netgear router e.g. to access “nomachine” on the ubuntu system = 192.168.0.3 I do a NAT/PAT rule ssh to public address > port 12345 access internal to 192.168.0.3 on port 12345 I hope you understand what I mean, I would like to be able to do the same to the containers running on the Debian server 192.168.0.2.
Here is what I choose during the initial setup of lxd:
root@server1:~# lxd init
Do you want to configure a new storage pool (yes/no) [default=yes]?
Name of the new storage pool [default=default]: cstorage1
Name of the storage backend to use (dir, btrfs, ceph, lvm) [default=btrfs]:
Create a new BTRFS pool (yes/no) [default=yes]?
Would you like to use an existing block device (yes/no) [default=no]?
Size in GB of the new loop device (1GB minimum) [default=71GB]: 100
Would you like LXD to be available over the network (yes/no) [default=no]? yes
Address to bind LXD to (not including port) [default=all]:
Port to bind LXD to [default=8443]:
Trust password for new clients:
Again:
Would you like stale cached images to be updated automatically (yes/no) [default=yes]?
Would you like to create a new network bridge (yes/no) [default=yes]? no
LXD has been successfully configured.
root@server1:~# lxc network list
+---------+----------+---------+-------------+---------+
| NAME | TYPE | MANAGED | DESCRIPTION | USED BY |
+---------+----------+---------+-------------+---------+
| enp0s25 | physical | NO | | 0 |
+---------+----------+---------+-------------+---------+
As you can see I ended up with no bridge I am not sure if I can tell lxd/lxc to use the device enp0s25 as the bridge here is where I am not sure and I am stuck.
Currently, the networking settings look like:
root@server1:~# lxc network show enp0s25
config: {}
description: ""
name: enp0s25
type: physical
used_by: []
managed: false
Physical Interface Debian server:
root@server1:~# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether f0:de:f1:0b:b2:11 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.2/24 brd 192.168.0.255 scope global enp0s25
valid_lft forever preferred_lft forever
inet6 2405:6580:2cc0:100:c061:74fc:6474:781c/64 scope global temporary dynamic
valid_lft 585120sec preferred_lft 66573sec
inet6 2405:6580:2cc0:100:c832:d98d:ebbf:7fd4/64 scope global temporary deprecated dynamic
valid_lft 498895sec preferred_lft 0sec
inet6 2405:6580:2cc0:100:10a9:126:2045:f8b4/64 scope global temporary deprecated dynamic
valid_lft 412671sec preferred_lft 0sec
inet6 2405:6580:2cc0:100:fd79:3462:81fa:a233/64 scope global temporary deprecated dynamic
valid_lft 326448sec preferred_lft 0sec
inet6 2405:6580:2cc0:100:ad90:d5bd:10ba:4a42/64 scope global temporary deprecated dynamic
valid_lft 240223sec preferred_lft 0sec
inet6 2405:6580:2cc0:100:f13b:9a2f:3ba1:caa4/64 scope global temporary deprecated dynamic
valid_lft 153998sec preferred_lft 0sec
inet6 2405:6580:2cc0:100:e4d1:b80e:dd23:9c36/64 scope global temporary deprecated dynamic
valid_lft 67773sec preferred_lft 0sec
inet6 2405:6580:2cc0:100:f2de:f1ff:fe0b:b211/64 scope global mngtmpaddr noprefixroute dynamic
valid_lft 2591927sec preferred_lft 604727sec
inet6 fe80::f2de:f1ff:fe0b:b211/64 scope link
valid_lft forever preferred_lft forever
3: vboxnet0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
inet 192.168.56.1/24 brd 192.168.56.255 scope global vboxnet0
valid_lft forever preferred_lft forever
inet6 fe80::800:27ff:fe00:0/64 scope link
valid_lft forever preferred_lft forever
Storage:
root@server1:~# lxc storage list
+-----------+-------------+--------+----------------------------------------------+---------+
| NAME | DESCRIPTION | DRIVER | SOURCE | USED BY |
+-----------+-------------+--------+----------------------------------------------+---------+
| cstorage1 | | btrfs | /var/snap/lxd/common/lxd/disks/cstorage1.img | 1 |
+-----------+-------------+--------+----------------------------------------------+---------+
NOTE: I believe that storage was before default ZFS I guess that changed to btrfs. also, I am running VirtualBox on the same server but I guess that is not an issue, I am actually thinking of replacing it with LXD/LXC.
Thank you in advance for your help.