Skip to main content

Configure a network interface on a server

Last update:

To connect a 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 when using OS auto-installation for Linux. For Windows OS, you can configure the private network interface only manually.

You can view the parameters for configuration in the control panel: in the top menu, click ProductsDedicated ServersServers → server page → tab Network.

Configure the public network interface

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

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

    vi /etc/netplan/01-netcfg.yaml
  3. Add or change the values for the public network interface settings:

    network:
    ethernets:
    <eth_name>:
    addresses:
    - <ip_address>/<mask>
    gateway4: <gateway>
    nameservers:
    addresses: [<dns_servers>]
    renderer: networkd
    version: 2

    Specify:

    • <eth_name> — name of the public network interface;
    • <ip_address> — public IP address of the server with a subnet mask, for example 203.0.113.2;
    • <mask> — subnet mask, for example 24;
    • <dns_servers> — DNS servers. We recommend using Selectel recursive DNS servers, but you can specify any available DNS servers;
    • <gateway> — gateway.
  4. Press ESC.

  5. Exit the vi text editor saving your changes:

    :wq
  6. Apply the configuration:

    netplan apply
  7. Optional: reboot the server.

Configure a private network interface

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

  2. Open the netplan utility configuration file with the vi:

    vi /etc/netplan/01-netcfg.yaml
  3. Add or change the values of the private network interface settings:

    <eth_name>:
    addresses: [<ip_address>]

    Specify:

    • <eth_name> — the name of the private network interface;
    • <ip_address> — the private IP address of the server with a subnet mask, for example 192.168.0.2/24.
  4. Press ESC.

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

    :wq
  6. Apply the configuration:

    netplan apply
  7. Optional: reboot the server.

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