Phone sales support +39 0575 05077
  Phone technical support +39 0575 0508
 
Cloud Server > 9 - Virtual Switches and private networks > Configuring a private network in Linux Debian and Ubuntu Cloud Servers

9.3.4 Configuring a private network in Linux Debian and Ubuntu Cloud Servers Cloud Server Pro service guide

To configure the network in your Linux Cloud Servers, the network card connected to the Virtual Switch needs to have its own private IP address. To do this on Linux operating systems you need to connect to the Cloud Server via SSH or via the Recovery Console. You can also configure the network card in Linux either temporarily (until the next reboot), or permanently.
To configure the card temporarily, for diagnostic purposes or to check or test its functionality, proceed as follows:
  1. Run the ifconfig command like so:
    ifconfig <interface> <ip_address> netmask <netmask>
    where:
    <interface> is the card that you want to configure (eth0 eth1 eth2);
    <ip_address> is the private IP address that you wish to configure;
    <netmask> the sub netmask that you want to use;
    E.g. by running ifconfig eth2 95.110.153.24 netmask 255.255.255.0 you will configure the "eth2" adapter with the "95.110.153.24" IP and the "255.255.255.0" subnet mask.
  2. Run the ifconfig command:
    ifconfig <interface>
    to check that the card has been configured correctly (e.g. ifconfig eth2 to check the new setting on the card eth2).
To configure the network interface permanently, proceed as follows:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.99
netmask 255.255.255.0

  1. Run the command:
    nano /etc/network/interfaces
    to edit the configuration file.
  2. Edit the file by entering the data for the IP previously recorded for the network card that you want to configure. Remember that to move around inside the text file you can use the arrows and to enter the new text just add it below to the existing rows (in the example you are configuring the network card eth0 with the network IP 192.168.0.99 with netmask 255.255.255.0).
  3. Once you have finished entering your data press "CTRL+O" to save the changes and then "CTRL+X" to exit the editor.
To assign IP addresses we recommend that you follow some basic rules to avoid any problems. For more details see the Private IP Address.

Repeat the operation described above for all the Cloud Servers that are part of the network you are configuring. We remind you that the IP selected for each Cloud Server of your network must be unique, otherwise a clash of IP’s could be generated which prevents the communication between the Cloud Servers via the private network.