Private VLAN

🚧

Private VLAN is currently in beta on the new Maxihost Experience. The feature will be rolling out gradually to all customers in the coming months.

Maxihost servers are configured with a public and a private interface with a Layer 3 network topology by default. You can use the Private VLAN feature to change selected servers to a Layer 2 topology.

Introduction

Private VLANs allow you to group servers in the same project within the same data center, enabling private communication between them. This is useful in a number of instances where you don't want or need traffic from specific servers going through the internet.

For example, if you have a server running a database that needs to communicate with a web app on a different server, you could have the database server connect privately to the web app server, increasing security and reliability. Another common use case is if you are managing services like DHCP.

Private VLAN packets do not go through the network layer and traffic is not filtered in any way. Maxihost does not charge for traffic on Private VLANs, either inbound or outbound.

You can create VLANs and assign servers to them from the dashboard or API from the Virtual Networks and Virtual Network Assignments resources.

Creating a Private VLAN

  1. Select the Team and Project you would like to create a Private VLAN for.
  2. Click on the Networking menu, then on Private VLAN.
  3. Click on Add VLAN on the top-right section of the page. A side modal will open so you can choose the region and add a description to your VLAN. The description is only used to help you identify what the VLAN is for.
  4. With the VLAN created, you can now select servers in the data center of the VLAN to be assigned to it.

Additional steps

The provisioning of the network on our switches is handled automatically after you assign your first server to a VLAN. Seen that Maxihost has no access to your servers, an additional step is required and you need to configure the VLAN on your Operating System.

See below on how to set up a Private VLAN for your Operating System.

Set up a Private VLAN

After creating and assigning your server to a Private VLAN, you need to set it up so it can actually send traffic through it. This is an additional step you need to make based on the Operating System you are using.

Windows Server

This will show you how to set up multiple VLANs on a single network interface when using Windows Server 2012 or later.

Required Setup

Windows Server Private VLAN required setup.Windows Server Private VLAN required setup.

Windows Server Private VLAN required setup.

  1. If you want to configure a single VLAN in the interface, go to Network Connections > Properties > Advanced tab > Select the VLAN ID field and add the desired value.

If you want multiple VLANs in the same interface, make sure that the property VLAN ID is set to 0 - otherwise, it will not work.

Setting the VLAN ID property to 0 when setting up multiple VLANs in the same interface.Setting the VLAN ID property to 0 when setting up multiple VLANs in the same interface.

Setting the VLAN ID property to 0 when setting up multiple VLANs in the same interface.

  1. Access your server's IPMI via the Remote Access feature.
  2. On your IPMI interface go to Server Manager > Local server and click on NIC Teaming.
NIC Teaming on your server's IPMI interface.NIC Teaming on your server's IPMI interface.

NIC Teaming on your server's IPMI interface.

  1. Create a new Team with a single interface by going to Teams > Tasks > New Team. Select the desired interface (e.g. 40GbE) and give it a name. Once you create the Team, your IP configuration will be cleaned and your server's internet connection will be lost until the end of the process. Select your Public interface for the private VLAN.
  1. Go to Adapter and Interfaces and click on TASKS > Add Interface. The first interface needs to have the VLAN ID 0 (zero) or Default.
  1. Configure the specific VLAN and click OK. The VLAN ID that you need to configure is the same displayed on your dashboard.
  1. To add another VLAN interface on the same port, repeat step #4.
  1. To assign an IP address to the new interface, click on Network Connections, and find the VLAN interface you have just added. Then, configure the IP similarly to any other interface. You need to configure the VLAN 0 with your public IP.

You can configure any IP address in your private VLAN (e.g.: 10.10.10.1/24) and you don't need to configure a Gateway in the private interfaces. Gateway information is only mandatory for ' Public' Interfaces.

Let's say you created three VLAN interfaces (VLANs 1,2,3) on the teaming interface and add three IP addresses, here is what you should see on the Server Manager window:

Troubleshooting

  • If you try to configure multiple VLANs, make sure that the value of the VLAN ID field in the properties Advanced tab is equal to 0.
  • Do not configure the primary virtual interface with the VLAN ID, as it needs to be on its default configuration (VLAN ID 0). When the port configuration is set up to native VLAN, do not change this VLAN configuration.

Ubuntu

This is mandatory for all Ubuntu versions.

  1. Load the 8021q module into the kernel.
sudo modprobe 8021q
  1. Install the VLAN package.
sudo apt install vlan

Ubuntu 16

  1. Create a new interface that is a member of a specific VLAN (VLAN ID 10 and physical interface eth1 are used for example purposes).

Keep in mind that you can only use physical interfaces as a base. Creating VLANs on virtual interfaces (i.e. eth0:1) will not work.

This command will add an additional interface next to the ones that have already been configured, so your existing configuration of eth1 will not be affected. Replace the information 'eth1' for your public interface.

sudo vconfig add eth1 10
  1. Assign an address to the new interface.
sudo ip addr add 10.0.0.1/24 dev eth1.10
  1. Start the new interface.
sudo ip link set up eth1.10

Additional set up

To make this setup permanent and avoid losing your configurations when your server reboots, do this:

  • Add the module to the kernel on boot:
sudo su -c 'echo "8021q" >> /etc/modules'
  • Create the interface and make it available when the system boots. Add the following lines to /etc/network/interfaces.d/50-cloud-init.cfg (change the values according to your scenario):
auto eth1.10
iface eth1.10 inet static
    address 10.0.0.1
    netmask 255.255.255.0
    vlan-raw-device eth1

Ubuntu 18 and Ubuntu 20

  1. Change the Netplan configuration file in /etc/netplan/50-cloud-init.yaml and add the configuration below at the end of the file (The VLAN 510 is an example, change the values accordingly)
vlans:
            vlan.510:
                    id: 510
                    link: eno1
                    addresses: [10.10.10.20/24]

The VLAN section is at the same level of indent as the ethernet key. Both are contained within the network

  1. Save the file and apply the configurations with the command below.
sudo netplan apply

This configuration is permanent, you don't need to do anything else.

CentOS 7/8 and Red Hat Enterprise Linux

  1. In Red Hat Enterprise Linux and Centos 7, the 8021q module is loaded by default. If necessary, you can make sure that the module is loaded by issuing the following command as root:
modprobe --first-time 8021q
modprobe: ERROR: could not insert '8021q': Module already in kernel
  1. To display information about the module, issue the following command:
modinfo 8021q
  1. See the modprobe(8) main page for more command options.

SETTING UP 802.1Q VLAN TAGGING USING IFCFG FILES

  1. Configure the parent interface in /etc/sysconfig/network-scripts/ifcfg-eth*X*, where X is a unique number corresponding to a specific interface, as follows. Replace 'eth' for your public interface
DEVICE=ethX
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
  1. Set the VLAN interface configuration in the /etc/sysconfig/network-scripts/ directory. The configuration file name should be the parent interface plus a . character followed by the VLAN ID number. For example, if the VLAN ID is 192, and the parent interface is eth0, then the configuration file name should be ifcfg-eth0.192:
DEVICE=ethX.192
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.1
PREFIX=24
NETWORK=192.168.1.0
VLAN=yes
  1. If there is a need to configure a second VLAN, with, for example, VLAN ID 193, on the same interface, eth0, add a new file with the name eth0.193 with the VLAN configuration details. Restart the networking service in order for the changes to take effect. As root issue the following command:
systemctl restart network

Did this page help you?