Configure a network interface on a server
To connect the server to a private and public network, configure the network interfaces on the server.
The network interface for the private network will be configured automatically only during Linux OS auto-installation. For Windows OS, you can configure the private network interface only manually.
You can view configuration parameters in the control panel: in the top menu, click Products → Dedicated Servers → Servers → server page → Network tab.
Configure the public network interface
Ubuntu
Debian
CentOS
Windows
Ubuntu 20.04 LTS
Ubuntu 22.04 LTS, 24.04 LTS
-
Connect to the server via SSH or via the KVM console.
-
View the name of the configuration file for the
netplanutility:ls /etc/netplan/The response will show the name of the configuration file. For example:
01-netcfg.yamlCopy the name of the configuration file.
-
Open the
netplanutility configuration file with thevitext editor:vi /etc/netplan/<file_name>Specify
<file_name>— the name of the configuration file that you copied in step 2. -
Add or change the parameter values of the public network interface:
network:version: 2renderer: networkdethernets:<eth_name>:addresses:- <ip_address>/<mask>gateway4: <gateway>nameservers:addresses:- <dns_server_1>- <dns_server_2>Specify:
<eth_name>— public network interface name;<ip_address>— public IP address of the server, for example203.0.113.2;<mask>— subnet mask, for example, for a public shared subnet the mask is24;<gateway>— gateway;<dns_server_1>,<dns_server_2>— DNS servers. We recommend using Selectel recursive DNS servers, but you can specify any available DNS servers.
-
Press ESC.
-
Exit the
vitext editor with your changes saved::wq -
Apply the configuration:
netplan apply -
Optional: reboot the server.
Configure the network interface of the private network
Ubuntu
Debian
CentOS
Windows
-
Connect to the server via SSH or via the KVM console.
-
View the name of the configuration file for the
netplanutility:ls /etc/netplan/The response will show the name of the configuration file. For example:
01-netcfg.yamlCopy the configuration file name.
-
Open the configuration file of the
netplanutility using the text editorvi:vi /etc/netplan/<file_name>Specify
<file_name>— the configuration file name that you copied in step 2. -
Add or change the parameter values of the private network interface:
<eth_name>:addresses:- <ip_address>/<mask>Specify:
<eth_name>— the name of the private network interface;<ip_address>— the private IP address of the server, for example,192.168.0.2;<mask>— the private subnet mask, for example,24.
-
Press ESC.
-
Exit the
vitext editor with your changes saved::wq -
Apply the configuration:
netplan apply -
Optional: reboot the server.
-
Optional: assign a private IP address to the server in the Control Panel.
Configure the network interfaces of the public and private networks
Ubuntu
Debian
CentOS
Windows
Ubuntu 20.04 LTS
Ubuntu 22.04 LTS, 24.04 LTS
-
View the name of the
netplanutility configuration file:ls /etc/netplan/The output will display the name of the configuration file. For example:
01-netcfg.yamlCopy the configuration file name.
-
Open the
netplanutility configuration file with thevitext editor:vi /etc/netplan/<file_name>Specify
<file_name>— the configuration file name you copied in step 2. -
Modify the configuration file of the
netplanutility:4.1. Add or change values for the network interface settings of the public network:
network:version: 2renderer: networkdethernets:<public_eth_name>:addresses:- <public_ip_address>/<mask>gateway4: <gateway>nameservers:addresses:- <dns_server_1>- <dns_server_2>Specify:
<public_eth_name>— the name of the public network interface;<public_ip_address>— the public IP address of the server, for example,203.0.113.2;<mask>— the public subnet mask, for example, for the public shared subnet the mask is24;<gateway>— the gateway;<dns_server_1>,<dns_server_2>— the DNS servers. We recommend using Selectel recursive DNS servers, but you can specify any available DNS servers.
4.2. After the public network interface data block, add or change values for the private network interface settings:
<private_eth_name>:addresses:- <private_ip_address>/<mask>Specify:
<private_eth_name>— the name of the private network interface;<private_ip_address>— the private IP address of the server, for example,192.168.0.2;<mask>— the private subnet mask, for example,24.
Example of the
netplanutility configuration filenetwork:version: 2renderer: networkdethernets:eth0:addresses:- 203.0.113.2/24gateway4: 203.0.113.1nameservers:addresses:- 188.93.16.19- 188.93.17.19eth1:addresses:- 192.168.0.2/24 -
Press ESC.
-
Exit the
vitext editor and save your changes::wq -
Apply the configuration:
netplan apply -
Optional: reboot the server.
-
Optional: assign a private IP address to the server in the control panel.