Skip to main content

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

  1. Connect to the server via SSH or via the KVM console.

  2. View the name of the configuration file for the netplan utility:

    ls /etc/netplan/

    The response will show the name of the configuration file. For example:

    01-netcfg.yaml

    Copy the name of the configuration file.

  3. Open the netplan utility configuration file with the vi text editor:

    vi /etc/netplan/<file_name>

    Specify <file_name> — the name of the configuration file that you copied in step 2.

  4. Add or change the parameter values of the public network interface:

    network:
    version: 2
    renderer: networkd
    ethernets:
    <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 example 203.0.113.2;
    • <mask> — subnet mask, for example, for a public shared subnet the mask is 24;
    • <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.
  5. Press ESC.

  6. Exit the vi text editor with your changes saved:

    :wq
  7. Apply the configuration:

    netplan apply
  8. Optional: reboot the server.

Configure the network interface of the private network

  1. Connect to the server via SSH or via the KVM console.

  2. View the name of the configuration file for the netplan utility:

    ls /etc/netplan/

    The response will show the name of the configuration file. For example:

    01-netcfg.yaml

    Copy the configuration file name.

  3. Open the configuration file of the netplan utility using the text editor vi:

    vi /etc/netplan/<file_name>

    Specify <file_name> — the configuration file name that you copied in step 2.

  4. 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.
  5. Press ESC.

  6. Exit the vi text editor with your changes saved:

    :wq
  7. Apply the configuration:

    netplan apply
  8. Optional: reboot the server.

  9. Optional: assign a private IP address to the server in the Control Panel.

Configure the network interfaces of the public and private networks

  1. Connect to the server via SSH or KVM console.

  2. View the name of the netplan utility configuration file:

    ls /etc/netplan/

    The output will display the name of the configuration file. For example:

    01-netcfg.yaml

    Copy the configuration file name.

  3. Open the netplan utility configuration file with the vi text editor:

    vi /etc/netplan/<file_name>

    Specify <file_name> — the configuration file name you copied in step 2.

  4. Modify the configuration file of the netplan utility:

    4.1. Add or change values for the network interface settings of the public network:

    network:
    version: 2
    renderer: networkd
    ethernets:
    <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 is 24;
    • <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 netplan utility configuration file
    network:
    version: 2
    renderer: networkd
    ethernets:
    eth0:
    addresses:
    - 203.0.113.2/24
    gateway4: 203.0.113.1
    nameservers:
    addresses:
    - 188.93.16.19
    - 188.93.17.19
    eth1:
    addresses:
    - 192.168.0.2/24
  5. Press ESC.

  6. Exit the vi text editor and save your changes:

    :wq
  7. Apply the configuration:

    netplan apply
  8. Optional: reboot the server.

  9. Optional: assign a private IP address to the server in the control panel.