standinglynx

Advanced Network Segmentation in Proxmox: VLANs, Namespaces & Firewalls

Introduction

This guide walks you through setting up network segmentation in a Proxmox environment using native Linux tools like VLANs, network namespaces, bridges, and iptables. The setup creates an isolated lab environment that mimics corporate network zones, ideal for secure testing and experimentation.

Why Segment Networks?

Network segmentation enhances security and functionality in lab environments by:

Tools Used

Lab Topology

VLAN ID Purpose Sample CIDR
100 Management 192.168.X.0/24
200 External Simulation 10.100.X.0/24
300 Internal Services 172.16.X.0/24
400 Security Operations 10.50.X.0/24
999 Malware Analysis 192.168.254.0/30

Note: X represents variable octets for anonymization.

This topology simulates distinct security zones for controlled attacks, forensic analysis, and containment testing.

Expected Traffic Flow

This enforces strict access controls, mirroring real-world security practices.

Step-by-Step Setup

1. Create Namespaces and Bridges

# Create an isolated namespace
ip netns add analysis-env

# Set up a virtual bridge
ip link add lab-br type bridge
ip link set lab-br netns analysis-env
ip netns exec analysis-env ip link set lab-br up

Tip: Namespaces simulate routers or firewalls within a single host.

2. Connect with veth Pairs

ip link add veth0 type veth peer name veth1
ip link set veth1 netns analysis-env
ip link set veth0 up
ip netns exec analysis-env ip link set veth1 up
ip netns exec analysis-env ip link set veth1 master lab-br

Note: veth pairs act as virtual cables linking the host to the namespace.

3. Configure VLANs

ip netns exec analysis-env ip link add link lab-br name vlan200 type vlan id 200
ip netns exec analysis-env ip link set vlan200 up
# Repeat for VLANs 100, 300, 400, and 999 as needed

Tip: Script this step for larger setups to save time.

4. Assign IPs

ip netns exec analysis-env ip addr add 10.100.0.1/24 dev vlan200
# Assign IPs for other VLANs based on the topology

Ensure interfaces align with your planned IP scheme and subnet masks.

5. Set Up Routing and Firewall Rules

ip netns exec analysis-env iptables -A FORWARD -i vlan200 -o vlan300 -j ACCEPT
ip netns exec analysis-env iptables -A FORWARD -i vlan300 -o vlan200 -m state --state ESTABLISHED,RELATED -j ACCEPT

Recommendation: Use a default-deny policy (iptables -P FORWARD DROP) and allow only necessary traffic.

Validation

Verify the setup with these commands:

ip netns exec analysis-env ip addr show
ip netns exec analysis-env ip route show
ip netns exec analysis-env iptables -L -v -n

Test connectivity (e.g., ping, traceroute) between VLANs to confirm isolation and rule enforcement.


Next Topic: Building an isolated malware analysis environment with VLANs and namespaces.

Discuss this post: Bluesky

Description of GIF

Assisted by AI