For CentOS 7

In a private network, servers communicate over local IPs that are not routed on the Internet. To use a server in a private network, you must configure the network interface on the server. To configure the network interface for the private network:

Requirements
  • You have created a private network.

  • You have assigned the desired server to the private network in the cloud panel.

Determining the Subnet Address and Subnet Mask of the Private Network

  • In the Network > Private network section, select the desired private network.

  • Make a note of the subnet address and the subnet mask. These are displayed in the Configuration area.

Configuring the Private Network Interface

  • Log on to the server.

  • If the server has been assigned to a private network, an additional, unconfigured network interface exists on the assigned server. To display this, enter the following command:

    [root@localhost ~]# ifconfig -a

    Example:

    [root@localhost ~]# ifconfig -a
    ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 212.227.155.186  netmask 255.255.255.255  broadcast 212.227.155.186
            inet6 fe80::250:56ff:fe3d:a0af  prefixlen 64  scopeid 0x20<link>
            ether 00:50:56:3d:a0:af  txqueuelen 1000  (Ethernet)
            RX packets 493  bytes 69834 (68.1 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 703  bytes 65683 (64.1 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
     
    ens224: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            ether 00:50:56:2d:5c:00  txqueuelen 1000  (Ethernet)
            RX packets 2  bytes 120 (120.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 59  bytes 9746 (9.5 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
     
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 68  bytes 5920 (5.7 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 68  bytes 5920 (5.7 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

  • Make a note of the name of the unconfigured network interface for the private network and the MAC address. In the above example, the name of the unconfigured network interface for the private network is ens224. The MAC address is 00:50:56:2d:5c:00.

  • Use vi to create the configuration file for the unconfigured interface. Example:

    [root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens224

  • To configure the private network, enter the following information:

    NAME="Private [NAME_OF_THE_PRIVATE_NETWORK_INTERFACE]"
    DEVICE="[NAME_OF_THE_PRIVATE_NETWORK_INTERFACE]"
    IPADDR="[IP-ADDRESS_OF_THE_SERVER_IN__THE_PRIVATE_NETWORK]"
    NETMASK="[SUBNET_MASK_OF_THE_PRIVATE_NETWORK]"
    HWADDR="[MAC-ADDRESS]"
    BOOTPROTO="none"
    ONBOOT="yes"
    USERCTL="no"

    Example

    NAME="Private ens224"
    DEVICE="ens224"
    IPADDR="192.168.2.2"
    NETMASK="255.255.255.0"
    HWADDR="00:50:56:2d:5c:00"
    BOOTPROTO="none"
    ONBOOT="yes"
    USERCTL="no

Please Note

To use a server in a private network, you must manually assign an IP address under which the server can be reached in the private network during the manual configuration of the network interface. This IP address cannot be routed to public networks.

You need the following information to define the IP address:

Subnet address: In this case, the subnet address specifies the private network.

Subnet mask: The subnet mask specifies which part of the IP address is used to identify the host (or server) and which part classifies the network itself.

Using this information, you can define the IP address under which the server should be accessible in the private network.

Example:

If the defined subnet address or network work area is 192.168.1.0 and the subnet mask 255.255.255.0 is used, this means that all computers or servers match in the first three bytes. In this example, you can use a maximum of 254 host addresses (192.168.1.1 to 192.168.1.254). For example, if you have assigned 2 servers to a private network, you can assign the IP addresses 192.168.1.1 and 192.168.1.2 to the respective servers.

Note

The editor vi has an insert mode and a command mode. You can enter the insert mode by pressing the i key. In this mode the entered characters are immediately inserted into the text. To enter the command mode, then press the ESC key. If you use the command mode, your keyboard input is interpreted as a command.

  • To exit vi and save the file, type the following command and then press Enter:

    :wq

  • To restart the network interface for the private network, enter the following command:

    [root@localhost ~]# nmcli connection reload

Checking the Configuration

To verify that the network interface for the private network is correctly configured, send a ping to the IP address of another server assigned to the private network.

Example:

root@localhost:~# ping -c 1 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.176 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.151 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.170 ms

--- 192.168.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2050ms
rtt min/avg/max/mdev = 0.151/0.165/0.176/0.018 ms

When the data packets are delivered to the server, you will know that the network interface is properly configured for the private network.