Skip to main content

L2 Network

An L2 Network in Apache CloudStack provides Layer 2 connectivity only (switching / VLAN). CloudStack attaches VMs to the VLAN or broadcast domain and does not deploy a virtual router for Layer 3 services.

Routing, DHCP, DNS, firewall, NAT, load balancing, and VPN must come from external infrastructure (physical gear or a network appliance VM) — not from a CloudStack virtual router.

Setup vs feature
UserData and password-enabled templates

L2 networks do not support UserData. Password-enabled templates that rely on UserData for password injection cannot be used on L2 networks. Plan templates and guest setup accordingly.

What is an L2 Network?

ConceptBehaviour
LayerLayer 2 only — same VLAN / broadcast domain
Virtual routerNot created
IP addressingExternal DHCP or static config on the guest
Security / NAT / LBExternal firewall, router, or appliance
CloudStack roleAttach VMs to the L2 segment

For most public-cloud style tenants who want CloudStack to handle DHCP, NAT, and public IPs automatically, prefer an Isolated Network or VPC. Use L2 for advanced networking where the provider or customer controls Layer 3.

Typical use cases

1. Integrate with existing enterprise networks

Enterprises often already have physical routers, firewalls (FortiGate, Palo Alto, Cisco ASA), DHCP servers, and DNS.

Instead of an isolated network with a CloudStack virtual router, create an L2 Network and connect VMs to the existing VLAN.

Example: VLAN 200 exists in the datacenter. Corporate DHCP assigns IPs. Corporate firewall controls traffic. CloudStack only attaches VMs to VLAN 200.

2. VNF / network appliance deployments

VNF (Virtual Network Function) appliances — virtual firewalls and routers such as FortiGate, pfSense, VyOS, Cisco CSR, or MikroTik — often need a plain L2 segment. CloudStack attaches guest VMs (and the appliance) to that VLAN while the VNF handles routing and security.

VM1 ----\
VM2 ----- VLAN / L2 segment ---- VNF appliance ---- Internet
VM3 ----/

CloudStack does not create a virtual router for that segment.

3. Stretch a broadcast domain across hypervisors

L2 keeps VMs on different hosts in the same broadcast domain and subnet.

Example: Web server on Host A and database on Host B, both on VLAN 400, same subnet — they communicate as if on one LAN.

4. Bare-metal or hybrid environments

Use L2 when VMs must talk directly to physical servers, storage appliances, or existing VLANs without CloudStack routing in the path.

What CloudStack does not provide on L2

Because there is no virtual router, L2 networks do not include:

ServiceOn L2?
DHCPNo — use external DHCP or static IPs
DNSNo — external
Source NATNo — external
Firewall rules (CloudStack VR)No — external
Port forwardingNo — external
Load balancing (CloudStack VR)No — external
VPN (CloudStack VR)No — external
UserDataNo — see warning above

L2 vs Isolated Network

FeatureL2 NetworkIsolated Network
VLAN / L2 connectivityYesYes
Virtual routerNoYes
DHCPExternalCloudStack VR
DNSExternalCloudStack VR
NATExternalCloudStack VR
FirewallExternalCloudStack VR
Public IP management (CloudStack)NoYes
Enterprise / existing network fitStrongLimited
Best for most public-cloud tenantsNoYes

See Isolated Network for VR, Source NAT reuse, and CMP billing behaviour.

When providers use L2 in CMP / CloudStack

L2 is commonly used when you need to:

  • Offer VLAN-backed private networks
  • Let customers bring their own firewall / router VM
  • Integrate CloudStack with enterprise networking
  • Build topologies with external appliances instead of CloudStack virtual routers
Prefer Isolated or VPC for standard tenants

For typical public cloud users, Isolated or VPC networks are preferred because CloudStack automatically provides DHCP, NAT, firewalling, and public IP management. L2 is for advanced scenarios where full Layer 3 control stays outside CloudStack.

L2 packages in CMP

Configure L2 (and Isolated) packages under Settings → Billing Setup → Rate Cards → Default → Packages → Network. Packages are compulsory — set pricing to 0 if L2 is free. Set enable_network_billing = true globally when you want network billing on; that applies to all Network packages, not one package at a time.

See Network packages.

Create L2 Network (CMP)

Customers create an L2 network from Networking → Networks (or Create → network type L2, depending on portal navigation).

CMP intro text on the form: L2 provides connectivity across instances while customers bring their own firewalls for maximum configurability.

img/screenshots/cmp-l2-network-create.png

Screenshot: CMP — Create L2 Network

Create form

Choose Project

Required. Project that owns the network (for example Default).

Select Location

Required. Zone / datacenter where the L2 network is created (for example SC-SIM-ZONE-1).

Network Name

Required. Display name for the L2 network.

Network Description

Optional. Short description for the customer and admin views.

Billing Cycle

Required. Cycle used for network package pricing (for example Hourly). Price shown comes from the Network package for that zone ($0 if the package is free).

Click Create Network to provision. CMP creates the L2 guest network in CloudStack using the L2 network offering mapped on the rate card — customers do not enter Gateway, Netmask, or CIDR (those stay external).

No CloudStack Layer 3

After create, Gateway / Netmask / CIDR show as NA on the details page. Configure guest IPs via external DHCP or static addressing, and use your own firewall/VNF for routing and security.

L2 network details page (CMP)

Open the network from Networking → Networks. The details page shows summary actions and tabs for that L2 network.

img/screenshots/cmp-l2-network-details.png

Screenshot: CMP — L2 network details (Details tab)

Header actions

ActionPurpose
EditUpdate display details where allowed
RefreshReload status from CloudStack
DeleteDelete the L2 network (when no longer needed and policy allows)

The header also shows name, status, created time, project, and zone.

Tabs

TabWhat customers manage here
DetailsRead-only summary of the L2 network (see fields below)
Associated VMsVMs attached to this L2 network

Unlike VPC or Isolated networks, L2 details typically do not include Public IP, Network ACL, or VPN tabs — CloudStack is not providing VR-based L3 services on this network.