Setting Up a Private Network for a Cloud Server (Debian/Ubuntu)
Please use the “Print” function at the bottom of the page to create a PDF.
In a private network, the servers communicate via local IPs that are not routed on the Internet. To use a server in a private network, the first step is to assign the server in the Cloud Panel to the desired private network. Once the server is assigned to the desired private network, there is an additional, unconfigured network interface on it. You must configure this network interface on the server.
To configure the network interface, follow the steps below:
Prerequisites
- You have created a private network. 
- You have assigned the intended server to the private network in the Cloud Panel. 
- Determine the file name of the network interface. To do this, enter the following command: - [root@localhost ~]# ip addr - Example: - [root@localhost ~]# ip addr 
 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
 inet 127.0.0.1/8 scope host lo
 valid_lft forever preferred_lft forever
 inet6 ::1/128 scope host
 valid_lft forever preferred_lft forever
 2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
 link/ether 00:50:56:2b:2c:68 brd ff:ff:ff:ff:ff:ff
 inet 212.227.209.26/32 brd 212.227.209.26 scope global dynamic ens192
 valid_lft 33737sec preferred_lft 33737sec
 inet6 fe80::250:56ff:fe2b:2c68/64 scope link
 valid_lft forever preferred_lft forever
 3: ens224: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
 link/ether 00:50:56:20:cf:11 brd ff:ff:ff:ff:ff:ff- In this example, the name of the unconfigured network interface for the private network is ens224. 
- To use a server on a private network, you must manually assign an IP address where the server can be reached on the private network as part of the manual configuration of the network interface. This IP address cannot be routed to public networks . To configure the desired static IP address, enter the static IP address and the network mask 255.255.255.0 under etc/network/interfaces. 
 Example:- [root@localhost ~]# vi /etc/network/interfaces - auto ens224 
 iface ens224 inet static
 address 192.168.2.1
 netmask 255.255.255.0- Example: - # This file describes the network interfaces available on your system 
 # and how to activate them. For more information, see interfaces(5).
 
 source /etc/network/interfaces.d/*
 
 # The loopback network interface
 auto lo ens192
 iface lo inet loopback
 
 # The primary network interface
 allow-hotplug ens192
 iface ens192 inet dhcp
 iface ens192 inet6 manual
 pre-up sleep 5
 up dhclient -6 -nw -v ens192
 down dhclient -6 -r -v ens192
 
 auto ens224
 iface ens224 inet static
 address 192.168.2.1
 netmask 255.255.255.0
Note
The vi editor 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, press the ESC key afterwards. When you use the command mode, your keyboard inputs are interpreted as a command.
- To restart the interface, enter the following command: - [root@localhost ~]# ifup ens224 - The server is accessible on the private network. 
Checking the Configuration
To verify that the network interface is configured correctly for the private network, send a ping to the IP address of another server assigned to the private network.
 Example:
root@localhost:~# ping -c 1 192.168.2.2
 PING 192.168.2.1 (192.168.2.2) 56(84) bytes of data.
 64 bytes from 192.168.2.2: icmp_seq=1 ttl=64 time=0.176 ms
 64 bytes from 192.168.2.2: icmp_seq=2 ttl=64 time=0.151 ms
 64 bytes from 192.168.2.2: icmp_seq=3 ttl=64 time=0.170 ms
 --- 192.168.2.2 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 packets are delivered to the server, the network interface has been configured for the private network.