Access rancher installed in Virtualbox VM (Natted and port forwarded)?

  • I create a virtualbox VM.
  • I add port forwarding rules to it, so that I can SSH it. The forwarded port is 8888.
  • Now I want to access the rancher that I've installed from my browser. But I am not succeeding when I do that.
    Install Rancher on Rocky Linux 9 [Step-by-Step] | GoLinuxCloud
    Most of these tutorials like above assume you are not running on NATTed IP. I tried to tunnel with different configurations(one of them that doesn't work is shown below).

    But it always keeps getting failed.

You should be able access your NAT-ed VMs by configuring port forwarding in virtualbox GUI or using command line (vboxmanage)

https://docs.oracle.com/en/virtualization/virtualbox/6.0/user/network_nat.html

Are you using this ?
What is your host operating system ?

Can you provide more details, what errors are you getting from TCP stack.
Helpful tools from host side would be : nc IP PORT and traceroute.

Have you tried SOCKS option ?

1 Like

Hi @Ihattaren,

what do you mean by installed from my browser? That rancher is installed on the VM and you want to access its GUI via browser from your client?
If yes: The simpliest VB network setup is bridged. That means the VM is attached to the same network as the VB host, as if it were connected to a switch by a cable.
Screenshot_20240127_094951

Select the VB host's iface (network adapter) on which your local network's IP is attached, e.g. eth0 with 192.168.42.1/24 (list ifaces and IPs via ip a or ifconfig). The VM itself must be configured with an IP from the same network, e.g. 192.168.42.9/24, and with the host as gateway, i.e. 192.168.42.1 (or by DHCP). You should then be able to reach the VM via ssh user@192.168.42.9 (if ssh server is enabled on it) and the rancher GUI via https://192.168.42.9[:port] (ignore certificate warnings), assuming that no firewall/packet fiilter is active on the VM. Probably the GUI is listening on another port than the default-https 443, I don't know the software.

2 Likes

port forwarding indeed worked.