Project Phoenyx – Part 3: Network & The Engine
Step 4: The Internal Network (VLAN)
A server cluster is like a team in an office. Sometimes you need to shout things to each other without the customers (the internet) hearing. We want a "private line" between Server01 and Server02. This is safer and faster for our backups.
We use a VLAN (Virtual LAN) for this. Imagine it like a second, invisible network card.
Server01 gets internal IP:
10.0.0.1Server02 gets internal IP:
10.0.0.2
Ubuntu uses Netplan for this. The configuration is powerful, but picky about spaces (YAML format).
Open the configuration:
sudo nano /etc/netplan/00-installer-config.yaml
Add the VLAN section. Attention: Your physical interface (here eth0) might be named ens18 or something else. Check this first with ip a.
network:
version: 2
ethernets:
eth0: # Your physical interface
dhcp4: true
vlans:
vlan10:
id: 10
link: eth0
addresses: [10.0.0.1/24] # IMPORTANT: On Server02 enter .2 here!
Save (CTRL+O) and close (CTRL+X). Then apply:
sudo netplan apply
Let's test the line! Type on Server01: ping 10.0.0.2. If it replies, the connection is up!
Step 5: Docker Installation
Now we install the engine. In our modern architecture, we no longer install services "directly" on the server, but in containers. This keeps the system clean.
We use the official Docker source, as the Ubuntu standard sources are often outdated.
1. Preparation & Keyring:
sudo apt install -y ca-certificates curl gnupg sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg
2. Add Source:
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
3. Installation:
sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
After this block, the command docker ps should work.
Step 5.5: Docker Tuning (daemon.json)
Docker is running, but the default settings are not optimal for a professional setup. We need to teach Docker how to behave in the network and how to handle logs.
Create or edit the configuration file:
sudo nano /etc/docker/daemon.json
Insert the following content:
{
"ipv6": true,
"fixed-cidr-v6": "fd00:1:be:a:7000::/80",
"default-address-pools": [
{
"base": "172.25.0.0/14",
"size": 25
},
{
"base": "fd00:1:be:a:7002::/80",
"size": 123
}
],
"log-driver": "json-file",
"log-opts": {
"max-size": "29m",
"max-file": "10"
}
}
- Network Hygiene: By default, Docker assigns networks somewhat randomly. With
172.25.0.0/14, we reserve a huge range that is cleanly split into /25 subnets. This is enough for over 2000 Docker networks! - Conflict Prevention: Tools like Mailcow often use the
172.22.1.0/24network. By forcing Docker to stay in the 172.25.x.x range, we prevent IP conflicts that are very hard to debug later. - Disk Protection: Containers can be "chatty." Without limits (
log-opts), log files can grow indefinitely and fill up your disk. We limit this to 10 files of 29MB each.
To apply the changes, restart Docker:
sudo systemctl restart docker
Step 6: Organization is Key
A typical beginner mistake: docker-compose.yml files scattered wildly in the home directory (/home/user/project1, /home/user/test). This becomes chaotic.
We are establishing an industry standard: All container data belongs in /opt/containers. This makes backups child's play – we only need to back up this one folder.
# Create directory sudo mkdir -p /opt/containers # Give rights to your user (so you don't need sudo for file operations) sudo chown -R $USER:$USER /opt/containers
Conclusion & Outlook
The foundation is laid! We have updates, security, an internal network, and a cleanly configured Docker engine with log rotation and fixed IP ranges. We also have a clean folder structure.
With this, the "dry" work is done. In the next part, we will install our first container: Traefik, which will ensure that all our services are securely accessible via HTTPS.