Skip to content

VLAN configuration between servers

In this article

Information

If you order several servers, it is possible to switch between them. VLAN allows you to unite traffic on servers into a local network. In this case, traffic between servers is not counted. Another benefit of configuring a VLAN between servers is to improve data security.

The procedure for the organization of switching the servers depends on the location of the client's servers. The cost and options for connecting the service are presented here.

Note

If you need to configure a VLAN between servers located at a considerable distance from each other, then you should contact our engineers. They will set up the connection and perform the necessary network settings.

Attention

If the servers are located in the same rack, you need to contact our engineers, and they will plug in additional network cards. The servers will be connected directly. In this case, the network settings can be made independently.

For network adapter settings, use IP addresses from the range of gray subnets (i.e. those addresses that are not used):

  • 10.0.0.0/8;
  • 172.16.0.0/12;
  • 192.168.0.0/16.

VLAN configuration on servers of Linux family

To connect to the server, you can use the SSH protocol or one of the remote access methods provided in the Invapi control panel. After connecting to the server, you must perform the following actions:

  1. Check the name of the second network interface:

    ip link show
    
    In the following examples, the name of the network interface eth1 will be used. The name may differ: in modern distributions, interfaces are usually named, for example, eno2, enp2s0 or ens19.

  2. Configure the second network interface.

    The network interface configuration can be done in two ways:

    • Using the ip command;
    • By changing the configuration file (or NetworkManager profile). This method is preferred because it allows you to keep the network settings after the server reboots.

IP command

Performed on the server with the first network interface:

ip address add 192.168.0.1/24 dev eth1
ip link set eth1 up

In the above example, the second network interface eth1 is configured to the first IP address from the gray subnet 192.168.0.0/24. In each case, different addresses can be used, but they must be unique within the same subnet.

Similar action must be performed on the second dedicated server (if there are more than two, then on each). The setting is produced to the second address from the selected subnet. In our example – 192.168.0.2:

ip address add 192.168.0.2/24 dev eth1
ip link set eth1 up

Note

Settings made with the ip command are valid until the server reboots. To keep them, use the method of changing the configuration file.

Method of changing the configuration file

In all examples, no gateway is set on the second interface (DEFROUTE=no, never-default, no gateway): the default route must remain on the main interface with the public IP address.

CentOS 7 / CentOS 8

In CentOS 7 and CentOS 8, the network configuration is located in the /etc/sysconfig/network-scripts/ifcfg-<interface_name> file, for example:

/etc/sysconfig/network-scripts/ifcfg-eth1

On the first server, the configuration file must be edited as follows:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=no
IPADDR=192.168.0.1
NETMASK=255.255.255.0
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth1
UUID="UUID_ID"
DEVICE=eth1
ONBOOT=yes

On the second:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=no
IPADDR=192.168.0.2
NETMASK=255.255.255.0
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth1
UUID="UUID_ID"
DEVICE=eth1
ONBOOT=yes

To use the new configuration, you must restart the network service on all servers that are united into a single VLAN:

systemctl restart network

Note

In CentOS 8, the ifcfg-* files are processed by NetworkManager. If the network service is not installed, apply the settings with the nmcli connection reload and nmcli connection up eth1 commands.

AlmaLinux, Rocky Linux 9-10

In AlmaLinux, Rocky Linux and CentOS Stream 9-10, the network is configured through NetworkManager. Create a profile for the second interface without a gateway and without a default route.

On the first server:

nmcli connection add type ethernet con-name private-eth1 ifname eth1 ipv4.method manual ipv4.addresses 192.168.0.1/24 ipv4.never-default yes ipv6.method disabled
nmcli connection up private-eth1

On the second server:

nmcli connection add type ethernet con-name private-eth1 ifname eth1 ipv4.method manual ipv4.addresses 192.168.0.2/24 ipv4.never-default yes ipv6.method disabled
nmcli connection up private-eth1

The profile is saved in the /etc/NetworkManager/system-connections/private-eth1.nmconnection file and applied at every boot. If a profile already exists for the interface (check with the nmcli connection show command), change it with nmcli connection modify instead of creating a new one.

Ubuntu 22.04, 24.04, 26.04

In Ubuntu, the network is configured through netplan. Create a separate file, for example /etc/netplan/60-private.yaml, with the following content (on the second server, specify the address 192.168.0.2/24):

network:
  version: 2
  ethernets:
    eth1:
      dhcp4: false
      addresses:
        - 192.168.0.1/24

Set the file permissions and apply the configuration:

sudo chmod 600 /etc/netplan/60-private.yaml
sudo netplan try

The netplan try command applies the settings and automatically rolls them back if the changes are not confirmed within 120 seconds. This protects you from losing access to the server.

Debian 12, 13

In Debian, add a description of the second interface without the gateway parameter to the /etc/network/interfaces file (or to a separate file in the /etc/network/interfaces.d/ directory). On the second server, specify the address 192.168.0.2/24:

auto eth1
iface eth1 inet static
    address 192.168.0.1/24

Bring the interface up:

sudo ifup eth1

Checking the connection

After configuring all servers, check the connection:

ping -c 3 192.168.0.2

VLAN configuration on Windows servers

To connect to the server, you can use the RDP protocol or one of the remote access methods provided in the Invapi control panel. After connecting to the server, you must perform the following actions:

Information

Setting the IP address in Windows Server - the instructions apply to all supported Windows Server versions.

  1. Network interface configuration.

    Viewing the name of the second network interface:

    netsh interface ip show config | findstr "interface"
    

    Setting up a second network interface on the first server:

    netsh interface ipv4 add address "Ethernet 2" 192.168.0.1 255.255.255.0
    

    Review of the application of settings

    netsh interface ip show addresses "Ethernet 2"
    

    Attention

    These operations must be performed on each of the servers connected to the VLAN. The IP addresses are changed according to the server's serial number when connected.

  2. Checking the switching:

    ping -n 3 192.168.0.2
    
question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×