Hello,
Here is a tutorial to create with the graphical interfaces 2 Vlans between 1 Proxmox server and 1 OPNsense router.
Do not hesitate to make remarks for improvement or correction.
So our starting infrastructure is this (Boths hosts are physicals):
On OPNsense:
pve-admin-guide-> 3.3.8. VLAN 802.1Q
"traditional" VLAN on the Linux bridge: In contrast to the VLAN awareness method, this method is not transparent and creates a VLAN device with associated bridge for each VLAN. That is, creating a guest on VLAN 5 for example, would create two interfaces eno1.5 and vmbr0v5, which would remain until a reboot occurs.
VLAN awareness on the Linux bridge: In this case, each guest’s virtual network card is assigned to a VLAN tag, which is transparently supported by the Linux bridge. Trunk mode is also possible, but that makes configuration in the guest necessary.
Here is a tutorial to create with the graphical interfaces 2 Vlans between 1 Proxmox server and 1 OPNsense router.
Do not hesitate to make remarks for improvement or correction.
So our starting infrastructure is this (Boths hosts are physicals):
Code:
+------------+ +-----------------+
| | | |
| | | |
| | NetCard: ProxmoxVlans | |
| OPNsense +-----------------------------------------------+ Proxmox |
| | NetCard: enp35s0f0 | |
| | | |
| | | |
+------------+ +-----------------+
On OPNsense:
- Go to "Interfaces" -> "Other Types" -> "VLAN"
- Click on the "Add" button at the top right
- Choose the information below by clicking on "Save"
- Parent interface: choose your "ProxmoxVlans" NetCard, for me is "re1 (xx‑xx‑xx‑xx‑xx‑xx) [ProxmoxVlans]"
- VLAN tag: your VLAN ID, by exemple "10" (do not use id "0" is the default VLAN id)
- VLAN priority: some QOS, I let : "Best Effort (0,default)"
- Description: "VLAN10 for Proxmox"
- Create a 2nd VLAN
- Parent interface: "re1 (xx‑xx‑xx‑xx‑xx‑xx) [ProxmoxVlans]"
- VLAN tag: "20"
- VLAN priority: "Best Effort (0,default)"
- Description: "VLAN20 for Proxmox"
- Go to "Interfaces" -> "Assignments" -> at the bottom, where it says "New interface". We’ll create a virtual interface that will be one of our VLANs.
- choose one of the VLANs you have created. "vlan 10 on re1 (VLAN10 for Proxmox)"
- In "Description", put the name of the interface that you will see in the list of interrfaces. "PVLAN10"
- same with the other VLAN (20 for me)
- "vlan 20 on re1 (VLAN20 for Proxmox)"
- "PVLAN20"
- Go to "Interfaces" -> you first VLAN "PVLAN10"
- Enable Interface
- set the ip configuration, for exemple
- IPv4 Configuration Type: Static IPv4
- Static IPv4 configuration: 192.168.10.1/24
- same with the other VLAN
- For activate the DHCP (optional) Go to "Services" -> "DHCPv4" -> your vlans interfaces (PVLAN10)
- Enable DHCP server on the PVLAN100 interface
- Save
pve-admin-guide-> 3.3.8. VLAN 802.1Q
"traditional" VLAN on the Linux bridge: In contrast to the VLAN awareness method, this method is not transparent and creates a VLAN device with associated bridge for each VLAN. That is, creating a guest on VLAN 5 for example, would create two interfaces eno1.5 and vmbr0v5, which would remain until a reboot occurs.
Code:
+----------------------------+ +------------------------------------------------------------------------+
| | | |
| | | Vnetcard: enp35s0f0.10 |
| OPNsense | | +--- VLAN 10 ----- Bridge vmbr010 --+ |
| | | | | +--------------+ |
| | | | | | VMtest | |
| VNetCard: PVLAN10 ----+ | | | | | | |
| | | | | Proxmox +---+-eth0 | |
| | |PNetCard: ProxmoxVlans | | | | |
| +--+--------------------------------------------+-+ +---+-eth1 | |
| | | NetCard: enp35s0f0 | | | | | |
| | | | | Vnetcard: enp35s0f0.20 | +--------------+ |
| VNetCard: PVLAN20 ----+ | | +--- VLAN 20 ----- Bridge vmbr020 --+ |
| | | |
+----------------------------+ +------------------------------------------------------------------------+
- Go to your PVE -> Network -> Create -> Linux VLAN
- Name: enp35s0f0.<your VLAN id>; for exemple for VLAN 10: enp35s0f0.10
- "Vlan raw device" and "VLAN Tag" are automatically filled
- The same with enp35s0f0.20
- Create now a Linux Bridge
- Name: vmbr010
- Bridge ports: enp35s0f0.10
- And a other bridge with enp35s0f0.20
- Create a VM with 2 network cards on "Hardware"
- the fisrt with Bridge vmbr010
- the second with Bridge vmbr020
- If you not use Cloud-Init :
- Start the VM
- list the correct name of your VMs networks cards execute
cat /proc/net/dev
- and go to modify the file /etc/network/interfaces (for Debian OS family) for add the second network interface (See below for an example)
- reboot
- execute
ip a
to check
- If you use Cloud-Init:
- Set the IP by the menu Cloud-Init
- Start VM
- execute
ip a
to check
- If you not use Cloud-Init :
Code:
#/etc/network/interfaces
allow-hotplug ens18
iface ens18 inet dhcp
# second interface
allow-hotplug ens19
iface ens19 inet dhcp
# or for set ip manualy
allow-hotplug ens19
iface ens19 inet static
address 192.168.20.2/24
gateway 192.168.20.1
VLAN awareness on the Linux bridge: In this case, each guest’s virtual network card is assigned to a VLAN tag, which is transparently supported by the Linux bridge. Trunk mode is also possible, but that makes configuration in the guest necessary.
Code:
+----------------------------+ +------------------------------------------------------------------------+
| | | |
| | | Proxmox Bridge vmbr0.10 |
| OPNsense | | +--- VLAN 10 --+ |
| | | | | +--------------+ |
| | | | | | VMtest | |
| VNetCard: PVLAN10 ----+ | | | | | | |
| | | | +-----------+ +---+-eth0 | |
| | |PNetCard: ProxmoxVlans | | | | | |
| +--+--------------------------------------------+- Bridge vmbr0 -+ | +---+-eth1 | |
| | | NetCard: enp35s0f0 | | | | | |
| | | | | Bridge vmbr0.20 | +--------------+ |
| VNetCard: PVLAN20 ----+ | | +--- VLAN 20 --+ |
| | | |
+----------------------------+ +------------------------------------------------------------------------+
- Go to your PVE -> Network -> Create -> Linux Bridge
- Name: vmbr0
- Set "Vlan aware"
- Bridge ports: enp35s0f0
- Create a VM with 2 network cards on "Hardware"
- the first
- Bridge: vmbr0
- VLAN Tag: 10
- the second
- Bridge: vmbr0
- VLAN Tag: 20
- the first
- If you not use Cloud-Init :
- Start the VM
- list the correct name of your VMs networks cards execute
cat /proc/net/dev
- go to modify the file /etc/network/interfaces (for Debian OS family) for add the second network interface (See example above)
- reboot
- execute
ip a
to check
- If you use Cloud-Init:
- Set the IP by the menu Cloud-Init
- Start VM
- execute
ip a
to check
- If you not use Cloud-Init :