IP Schema
The
development environment uses a logical subnet layout to keep
environments such as c2d and pxd separated while allowing internal
communication. Each environment receives dedicated subnets for
LXD
containers and
VirtualBox virtual machines.
Concept
- Isolation per environment: Every environment (for example
c2dorpxd) receives its own unique subnets. Traffic between thec2dandpxdenvironments remains completely separate. - Communication within an environment: Inside one environment the LXD containers and VirtualBox VMs can reach each other. Although they reside on different subnets, the host machine acts as a router and forwards traffic between the virtual network bridges via IP forwarding and NAT.
IP Schema Overview
The table below shows how a single /20 block provides the address space
for multiple environments. The LXD bridge (lxdbr1) is configured once
with this larger subnet. Environments are then logically separated by
assigning them non-overlapping ranges inside that block. Only the ranges
starting at 192.168.48.0 are shown.
| Environment | LXD Network (containers) | VirtualBox Network (VMs) |
|---|---|---|
| c2d | 192.168.48.0/24 | 192.168.49.0/24 |
| pxd | 192.168.50.0/24 | 192.168.51.0/24 |
| (reserved) | 192.168.52.0/24 | 192.168.53.0/24 |
| (reserved) | 192.168.54.0/24 | 192.168.55.0/24 |
The block 192.168.48.0/20 covers addresses 192.168.48.0 through
192.168.63.255. The following command configures the LXD bridge inside
this block:
lxc network set lxdbr1 ipv4.address=192.168.48.1/20
How Communication Works
Both LXD and VirtualBox create their own virtual network interfaces (bridges) on the host.
- LXD typically provisions a bridge such as
lxdbr1with gateway 192.168.48.1. - VirtualBox creates a host-only adapter with gateway 192.168.49.1.
When an LXD container (for example 192.168.48.5) sends traffic to a VirtualBox VM (for example 192.168.49.10), the packets follow these steps:
- The container forwards the traffic to its default gateway (the host at 192.168.48.1).
- The Linux host receives the packets. Because IP forwarding is enabled, the host routes the traffic to the VirtualBox interface.
- The VirtualBox VM replies; the host routes the response back to the originating LXD container.
No additional tunneling or software is required; standard Linux networking, together with the Vagrant, LXD, and VirtualBox configurations, handles the forwarding transparently.
Benefits
- Clear and predictable: It is immediately obvious which environment an IP address belongs to.
- Secure isolation: A container in the
pxdenvironment cannot reach resources in thec2denvironment because the host does not share routes between them. - Scalable: A single
/20provides addresses for several environments.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.