Virtual Switch > Configuring a private network on Linux Cloud Servers

05 Configuring a private network on Linux Cloud Servers

 
The operations described may affect the system and data, potentially causing malfunctions or data loss:
  • always back up your data or the entire server externally before performing any operation;
  • if available, create a snapshot of the server from the management panel before making changes to the system;
  • for unmanaged services, you are responsible for managing the operating system and software;
  • if in doubt, consult a trusted system administrator or check the latest official documentation for the operating system or software in use.

Before proceeding

Before configuring the private network in the operating system: You can configure the network interface temporarily, for testing or verification purposes, or permanently.

Temporarily configuring the private network on Linux

The temporary configuration remains active until the next Cloud Server restart.

To temporarily configure the network interface:
  • access the Linux Cloud Server via SSH or using the available console;
  • run the following command:

    ifconfig <interface> <ip_address> netmask <netmask>

    where:
    • <interface>

      is the network interface connected to the Virtual Switch;
    • <ip_address>

      is the private IP address you want to configure;
    • <netmask>

      is the private network netmask.
  • for example:

    ifconfig eth2 192.168.0.11 netmask 255.255.255.0

  • verify the configuration by running:

    ifconfig <interface>

    for example:

    ifconfig eth2

Permanently configuring the private network on Linux

The procedure for making the private network configuration permanent depends on the Linux distribution and version.

CentOS 5.x - CentOS 6.x

  • run the following command:

    system-config-network

  • in the graphical interface, use the arrow keys and the Tab key to select Device Configuration, then press Enter;

  • identify the network interface connected to the Virtual Switch and press Enter;

  • configure the private IP address and netmask in the corresponding fields, then confirm with OK, save with Save and exit with Quit.

CentOS 6.x - Alternative method

  • open the network interface configuration file:

    nano /etc/sysconfig/network-scripts/ifcfg-eth0

    replacing eth0 with the network interface you want to configure;
  • configure the interface parameters. For example:

    DEVICE=eth0
    NM_CONTROLLED=no
    ONBOOT=yes
    TYPE=Ethernet
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=yes
    IPV6INIT=no
    NAME="System eth0"
    BOOTPROTO=none
    IPADDR=192.168.0.11
    NETMASK=255.255.255.0

  • save the changes with CTRL+O and close the editor with CTRL+X;
  • if necessary, check the network configuration in the following file:

    nano /etc/sysconfig/network

  • to apply the changes, run:

    /etc/init.d/network restart

Repeat the procedure for all Linux Cloud Servers you want to connect to the private network, assigning each network interface a unique private IP address belonging to the same network and using the corresponding netmask.

What to do after configuration

After configuring the private network on the Cloud Servers, verify the private network configuration and check that the Cloud Servers can communicate correctly using their respective private IP addresses.