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.
-
Go to the VK Cloud management console.
-
Navigate to Cloud Computing → Bare Metal.
-
In the list of Bare Metal servers, click the name of the desired server.
-
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.
- Network name:
-
Go to the VK Cloud management console.
-
Navigate to Virtual Networks → Routers.
-
Click the name of the desired router.
-
Go to the Interfaces tab.
-
Add an interface for the internal network:
-
Click Add interface.
-
Enter the interface name. The name
my-private-interfaceis used as an example below. -
Select the
10.0.0.0/24subnet from the internal networkmy-netthat the Bare Metal server is connected to. -
Click Add.
-
Write down the internal IP address of the added interface.
The internal IP address
10.0.0.3will be used as an example.
-
-
Add an interface for the external network:
-
Click Add interface.
-
Enter the interface name.
-
Select any subnet from the
internetexternal network. -
Click Add.
-
Write down the external IP address of the added interface.
The external IP address
95.163.182.106will be used as an example.
-
-
Go to the DNAT tab.
-
Configure the DNAT rules:
- Click Add DNAT rule.
- Enter the rule name
my-dnat-rule. - Select the
my-private-interfaceinterface connected to the internal network. - In the Protocol field, select
All protocols and ports. - As the IP after translation, specify the internal IP address of the Bare Metal server
10.0.0.2. - Click Add.
Configure password access if it has not been done yet:
-
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.
-
If you are using the
rootaccount, create a separate user with thesudogroup:Ubuntu/DebianCentOS/RHEL/AlmaLinuxsudo useradd -m <USERNAME> \sudo usermod -aG sudo <USERNAME> -
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. -
End the SSH session:
quit
-
Connect to the server via the VNC console.
-
Enter the username and press ENTER.
-
Enter the password.
When entering the password, the entered characters are not displayed in the console.
-
Configure the network in the OS to work with the advanced router.
-
Check the route configuration and find out the interface name in the OS:
sudo ip route | grep defaultExample output:
default via 10.0.0.1 dev eth0 proto kernelHere
eth0is the interface name that is needed to create a new route. -
Delete the current
defaultroute:sudo ip route delete default -
Add a new
defaultroute 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
-
-
Connect to the server via SSH using the external address.
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.