How to Create a Private Network for Interconnecting Multiple VPS on Linux Server
In this wiki article, we'll walk you through the process of setting up a private network to interconnect multiple Virtual Private Servers (VPS). A private network allows these servers to communicate securely and efficiently, fostering collaboration and data transfer between them.
Why a Private Network?
A private network offers a dedicated and isolated space for communication between VPS instances. This isolation enhances security by preventing unauthorized access, ensuring that sensitive data and communications remain within the confines of the private network. Furthermore, a well-configured private network optimizes communication pathways, leading to increased efficiency in data exchange and resource utilization.
1. Enhanced Security:
Communication within the private network is shielded from external threats, mitigating the risks associated with public-facing interfaces.
2. Reduced Latency and Efficient Resource Utilization:
By communicating directly within the private network, VPS instances can experience lower latency compared to traversing external networks. This reduction in latency contributes to faster data transfer and response times, making efficient use of available bandwidth.
3. Efficient Data Replication:
In scenarios where data replication is crucial (e.g., distributed databases, storage clusters), a private network facilitates efficient and high-speed data replication between VPS instances. This efficiency ensures that replication processes do not unnecessarily consume external bandwidth.
Prerequisites:
-
VPS with a supported Linux distribution installed (e.g., Ubuntu, AlmaLinux).
-
Root or sudo access to the VPS instances
- To set up a private network, your VPS must be assigned a private
IP address
. To allocate aprivate IP
address for your VPS, please reach out to us via a support ticket.
Steps to configure a Private Network on VPS:
1. Login to your VPS.
2. Identify Network Interfaces:
Use ip link
to find the names of available network interfaces on your VPS.
ip link
This command will show you a list of network interfaces
along with their state, such as whether they are UP or DOWN. You can identify your network interfaces
by looking at their names, which are typically named ethX
, ensX
, or similar.
3. Create a Private Network
Public Network Interface:_ This interface is connected to the public internet and is used for communication with external entities, such as users accessing web services or other public-facing applications.
Private Network Interface:_ This interface is connected to a private, internal network. It's used for communication between servers within the same network or for backend services that should not be directly exposed to the public.
To establish a private network, a Virtual Private Server (VPS) would typically be configured with two network interfaces, one designated for the public network and the other for the private network. To create a Private Network, you can use the following command.
nmtui
The nmtui
(NetworkManager Text User Interface) interface will appear, allowing you to navigate through the menus using arrow keys, Tab, and Enter.
Go with Edit a Connection
Click on Add
It will ask to Choose the connection type
, Go with Ethernet
Provide a name (e.g., "PrivateConnection"), and set the device (select the appropriate network interface
)
Once you've selected the network interface
, configure the connection with the private IP
information:
Select IPv4 Configuration
Choose Manual
Add the private IP address
, subnet mask
and default gateway
.
Save
the configuration and exit
nmtui.
4. Activate the Connection:
After creating the connection profile, activate it using the following steps:
Run the following command
nmtui
Navigate Active a Connection
Select the Private Network profile and click on Activate
Please note that, on activationg the Private Network, Public profile will be stopped. So you will lost your current SSH session as it was connected using Public IP address.
After the activating a private network, you can access the server using VNC
or your another server, which is on the same datacenter.
5. Repeat for Other VPS:
If you have more VPS to connect internally, repeat these steps on each VPS. Ensure that each VPS has a unique private IP address
6. Verify Connectivity:
Confirm that the private network is configured correctly.
Ping SERVER_PRIVATE_IP_ADDRESS
By following these steps, you can establish a private network among your VPS instances, allowing seamless communication for various applications, data sharing, and improved security. This setup is particularly useful for scenarios where isolated communication is required between servers.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS