Configure the network interface on the server
To connect the server to private and public-network, configure the network interfaces on the server.
The network interface for the public network is configured automatically only when automatic OS installation. The interface for a private network must always be configured manually.
You can view the settings for configuration in Control Panel on the server page → Network tab.
Configure the network interface of the public network
- Ubuntu
- Debian
- CentOS
- Windows
-
Open the
netplan
utility configuration file with the vi text editor:vi /etc/netplan/01-netcfg.yaml
-
Add or change the values of the public network interface settings:
<eth_name>:
addresses: [<ip_address>/<mask>]
gateway4: <gateway>
nameservers:
addresses: [<dns_servers>]Specify:
<eth_name>
is the name of the network interface of the public network;<ip_address>/<mask>
— public IP address of the server with subnet mask (for example: 188.93.23.36/29);<gateway>
is a gateway;<dns_servers>
— DNS servers. DNS Selectel: 188.93.16.19, 188.93.17.19.
-
Press the
ESC
key. -
Exit the
vi
text editor with the changes saved::wq
-
Apply the configuration:
netplan apply
-
Optional: reboot the server.
-
Open the network interfaces configuration file with the vi text editor:
vi /etc/network/interfaces
-
Add or change the values of the public network interface settings:
auto <eth_name>
iface <eth_name> inet static
address <ip_address>
netmask <mask>
gateway <gateway>
dns-nameserver <dns_servers>Specify:
<eth_name>
is the name of the network interface of the public network;<ip_address>
— the public IP address of the server (for example: 188.93.23.36);<gateway>
is a gateway;<mask>
is the subnet mask;<dns_servers>
— DNS servers. DNS Selectel: 188.93.16.19, 188.93.17.19.
-
Press the
ESC
key. -
Exit the vi text editor with your changes saved:
:wq
-
Restart the network:
service networking restart
-
Optional: reboot the server.
-
Output information about the network interfaces:
ip address
-
Create or open a public network interface configuration file with the vi text editor:
vi /etc/sysconfig/network-scripts/ifcfg-<eth_name>
Specify
<eth_name>
as the name of the network interface. -
Add or change the values of the network interface settings:
NAME=""<eth_name>"
ONBOOT=yes
NETBOOT=yes
BOOTPROTO=static
HWADDR=""<mac_address>"
IPADDR=""<ip_address>"
NETMASK=""<mask>"
GATEWAY=""<gateway>"
TYPE=EthernetSpecify:
<eth_name>
is the name of the network interface of the public network;<mac_address>
— MAC address of the network device;<ip_address>
— IP address (for example: 188.93.23.36);<mask>
is the subnet mask;<gateway>
is a gateway.
-
Press the
ESC
key. -
Exit the vi text editor with your changes saved:
:wq
-
Restart the network:
systemctl restart network
-
Optional: reboot the server.
An example of changing network settings in CentOS is in the blog article Configuring Networking in CentOS 7.
-
Open the Network and Sharing Center.
-
Open the network interface of the public network.
-
Press Properties.
-
From the list, select IPv4.
-
Press Properties.
-
Specify the network interface parameters:
- IP-address — public IP address of the server (for example: 188.93.23.36);
- Subnet mask — subnet mask.
-
Press OK.
Configure the network interface of the private network
- Ubuntu
- Debian
- CentOS
- Windows
-
Open the
netplan
utility configuration file with the vi text editor:vi /etc/netplan/01-netcfg.yaml
-
Add or change values for the network interface settings of the private network:
<eth_name>:
addresses: [<ip_address>]Specify:
<eth_name>
is the name of the network interface of the private network;<ip_address>
— private IP address of the server (for example: 192.168.0.2/24).
-
Press the
ESC
key. -
Exit the vi text editor with your changes saved:
:wq
-
Apply the configuration:
netplan apply
-
Optional: reboot the server.
-
Open the network interfaces configuration file with the vi text editor:
vi /etc/network/interfaces
-
Add or change values for the network interface settings of the private network:
auto <eth_name>
iface <eth_name> inet static
address <ip_address>Specify:
<eth_name>
is the name of the network interface of the private network;<ip_address>
— private IP address of the server (for example: 192.168.0.2/24);
-
Press the
ESC
key. -
Exit the vi text editor with your changes saved:
:wq
-
Restart the network:
service networking restart
-
Optional: reboot the server.
-
Output information about the network interfaces:
ip address
-
Create or open the private network interface configuration file with the vi text editor:
vi /etc/sysconfig/network-scripts/ifcfg-<eth_name>
Specify
<eth_name>
as the name of the network interface of the private network. -
Add or change the values of the network interface settings:
NAME=""<eth_name>"
ONBOOT=yes
BOOTPROTO=none
IPADDR=""<ip_address>"Specify:
<eth_name>
is the name of the network interface of the private network;<ip_address>
— private IP address of the server (for example: 192.168.0.2/24);
-
Press the
ESC
key. -
Exit the vi text editor with your changes saved:
:wq
-
Restart the network:
systemctl restart network
-
Optional: reboot the server.
An example of changing network settings in CentOS is in the blog article Configuring Networking in CentOS 7.
-
Open the Network and Sharing Center.
-
Open the network interface of the private network.
-
Press Properties.
-
From the list, select IPv4.
-
Press Properties.
-
Specify the network interface parameters:
- IP-address — private IP address of the server (for example: for example: 192.168.0.2);
- Subnet mask — subnet mask.
-
Press OK.