VK Cloud logo

Configuring public access via an advanced router

Access to a Bare Metal server via an external network IP address can be configured using advanced routers.

Preparatory steps

  1. If you do not have a Bare Metal server, order one.
  2. Create an advanced router.

1. Get the server network information

  1. Go to the VK Cloud management console.

  2. Navigate to Cloud Computing → Bare Metal.

  3. In the list of Bare Metal servers, click the name of the desired server.

  4. Go to the Network tab.

    Save the network parameters of your Bare Metal server; you will need them later. The following values will be used as an example:

    • Network name: my-net;
    • Gateway: 10.0.0.1;
    • CIDR: 10.0.0.0/24;
    • IP address: 10.0.0.2.

2. Configure the advanced router

  1. Go to the VK Cloud management console.

  2. Navigate to Virtual Networks → Routers.

  3. Click the name of the desired router.

  4. Go to the Interfaces tab.

  5. Add an interface for the internal network:

    1. Click Add interface.

    2. Enter the interface name. The name my-private-interface is used as an example below.

    3. Select the 10.0.0.0/24 subnet from the internal network my-net that the Bare Metal server is connected to.

    4. Click Add.

    5. Write down the internal IP address of the added interface.

      The internal IP address 10.0.0.3 will be used as an example.

  6. Add an interface for the external network:

    1. Click Add interface.

    2. Enter the interface name.

    3. Select any subnet from the internet external network.

    4. Click Add.

    5. Write down the external IP address of the added interface.

      The external IP address 95.163.182.106 will be used as an example.

  7. Go to the DNAT tab.

  8. Configure the DNAT rules:

    1. Click Add DNAT rule.
    2. Enter the rule name my-dnat-rule.
    3. Select the my-private-interface interface connected to the internal network.
    4. In the Protocol field, select All protocols and ports.
    5. As the IP after translation, specify the internal IP address of the Bare Metal server 10.0.0.2.
    6. Click Add.

3. Configure password access

Configure password access if it has not been done yet:

  1. Connect to the Bare Metal server via SSH using the internal IP address.

    To complete this step, you will need to create an intermediate host in the form of a virtual machine with a Floating IP address.

  2. If you are using the root account, create a separate user with the sudo group:

    sudo useradd -m <USERNAME> \sudo usermod -aG sudo <USERNAME>
  3. Set a password:

    sudo passwd <USERNAME>

    Here <USERNAME> is the name of your account. If the OS was installed from VK Cloud images, you can use the default account name.

  4. End the SSH session:

    quit

4. Configure the network in the OS

  1. Connect to the server via the VNC console.

  2. Enter the username and press ENTER.

  3. Enter the password.

    When entering the password, the entered characters are not displayed in the console.

  4. Configure the network in the OS to work with the advanced router.

    1. Check the route configuration and find out the interface name in the OS:

      sudo ip route | grep default

      Example output:

      default via 10.0.0.1 dev eth0 proto kernel

      Here eth0 is the interface name that is needed to create a new route.

    2. Delete the current default route:

      sudo ip route delete default
    3. Add a new default route via the advanced router:

      sudo ip route add default via <INTERNAL_INTERFACE_IP_ADDRESS> dev <INTERFACE>

      Here:

      • <INTERNAL_INTERFACE_IP_ADDRESS> — the address assigned to the internal interface when configuring the advanced router.
      • <INTERFACE> — the interface name in the system.

      Example:

      sudo ip route add default via 10.0.0.3 dev eth0
  5. Connect to the server via SSH using the external address.

Delete unused resources

The created resources are billed and consume computing resources. If you no longer need them:

  • Stop the intermediate host to use it later, or delete it permanently.
  • Cancel the Bare Metal server lease.
  • Delete the Floating IP address assigned to the intermediate host. Floating IP addresses present in the project are billed even if they are not bound to any service.
Was this article helpful?