Get Virtualizor

VLAN

Overview

This article explains network settings when using VLAN (KVM, Proxmox KVM & XenServer)

How to enable VLAN

Go to Admin Panel -> Create IP Pool

Note: VLAN is supported for KVM and XenServer virtualization.

  • Gateway : As provided by the data center.
  • Netmask : As provided by the data center.
  • VLAN : Please check the Enable VLAN option.
  • VLAN Bridge : Enter vlan bridge as configured on the server.
  • Adding IP : Please add ip range to the pool .

Note : VLAN is supported for KVM and XenServer virtualization.
VLAN bridge must have an IP address assigned (even a dummy IP will work)
This will avoid known issue where VPS using VLAN network do not get their IPs configured through DHCP

Note: VLAN configuration is not done by Virtualizor and it should be configured by your system / network admin. Virtualizor will just use the VLAN bridge name in VPS configuration.

Following is the sample configuration file for VLAN with id : 192 .

Centos

~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1.192
DEVICE=eth1.192
ONPARENT=yes
VLAN=yes
NM_CONTROLLED=no
BRIDGE=Vbr0
~]# cat /etc/sysconfig/network-scripts/ifcfg-Vbr0
DEVICE=Vbr0 
TYPE=Bridge 
BOOTPROTO=static 
IPADDR=10.0.0.1
NETMASK=255.255.255.0 
ONBOOT=yes 
IPV6INIT=yes 
IPV6ADDR=2607:f0d0:1002:0011:0000:0000:0000:0002
IPV6_DEFAULTGW=2607:f0d0:1002:0011:0000:0000:0000:0001

Ubuntu 16 and lower (ifupdown)

~]# cat /etc/network/interfaces
auto eth1
iface eth1 inet static
address 192.168.1.10   
netmask 255.255.255.0   
gateway 192.168.1.1  

auto eth1.192 
iface eth1.192 inet manual

auto Vbr0
iface Vbr0 inet manual
bridge_ports eth1.192
bridge_stp off
address 10.0.0.1
netmask 255.255.255.0

NOTE: Above sample is just an example for VLAN bridge file, it may vary as per your datacenter configuration. Please contact your datacenter for setting up VLAN on your server.

Ubuntu 18 and above (Netplan)

This is just an example of the VLAN network configuration of Ubuntu 18 (netplan) with regular interface.
The actual configuration may vary as per your datacenter network settings.


Example file : /etc/netplan/01-netcfg.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      dhcp4: no
  bridges:
    viifbr0:
      addresses: 
        - 10.1.3.43/24
      interfaces: [ ens3 ]
      gateway4: 10.1.3.1
      macaddress: 00:16:3e:7f:ae:93
      nameservers:
         addresses:
           - 8.8.8.8
           - 8.8.4.4
           - 2001:4860:4860::8888
           - 2001:4860:4860::8844
    Vbr300:
       interfaces: [vlan300]
  vlans:
     vlan300:
      id: 300
      link: ens3

This is just an example of the VLAN network configuration of Ubuntu 18 (netplan) with bonded interface.
The actual configuration may vary as per your datacenter network settings.

Example file : /etc/netplan/01-netcfg.yaml

network:
    bonds:
        bond0:
            interfaces:
            - eth0
            - eth1
            parameters:
                lacp-rate: fast
                mode: 802.3ad
                transmit-hash-policy: layer2
    ethernets:
        eth0: {}
        eth1: {}
    version: 2
    bridges:
        viifbr0:
          addresses: 
          - 10.1.3.43/24
        interfaces: [ bond0 ]
        gateway4: 10.1.3.1
        macaddress: 00:16:3e:7f:ae:93
        nameservers:
          addresses:
          - 8.8.8.8
          - 8.8.4.4
          - 2001:4860:4860::8888
          - 2001:4860:4860::8844

        Vbr3013:
          addresses:
          - 1.2.3.4/24
          interfaces: [bond0.3013]
          gateway4: 1.2.3.254
          nameservers:
            addresses:
            - 8.8.8.8
            - 8.8.4.4
    vlans:
        bond0.3013:
          id: 3013
          link: bond0

Almalinux 8.x / 9.x

You can try these commands for creating vlan bridge assuming the vlan ID is 100 and interface name is eno1
Add bond interface name(instead of eno1) if you are planning to use bonded NICs

# nmcli connection add type vlan con-name eno1.100 ifname eno1.100 vlan.parent eno1 vlan.id 100
# nmcli connection add type bridge con-name vlan100 ifname vlan100

# nmcliconnection modify vlan100 bridge.stp no  //Add this if your server provider blocks ports on switch due to BPDU flooding

# nmcli connection modify vlan100 ipv4.addresses 'your-ip/netmask' ipv4.gateway 'your-gateway' ipv4.dns '8.8.8.8'  ipv4.method manual  //replace the network details of your vlan subnet

# nmcli connection modify vlan100 ipv6.addresses 'your-ipv6-ip/64' ipv6.gateway 'your-ipv6-gateway' ipv6.dns '2001:4860:4860::8888' ipv6.method manual  //add ipv6 if there is any

# nmcli connection modify eno1.100 master vlan100

# nmcli connection modify vlan100 connection.autoconnect-slaves 1

# nmcli connection up vlan100

    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list