Host PC fails to access Webmin which is installed on CentOS in VirtualBox

Webmin can be accessed over SSH after forwarding the port.

Now I am trying to access Webmin’s control panel on my computer outside virtualbox but on the same computer, but it doesn’t load.

I tried using the same port forwarding settings as is working fine for SSH, for both port 80 and port 10000, but it still doesn’t load. The browser error says,

This site can’t be reached
The connection was reset.

Here’s my network settings for port forwarding in virtualbox:

enter image description here

Steps to reproduce:

  1. Install fresh CentOS 7 x64 (latest)
  2. Install Webmin
  3. yum update -y
  4. Add Port Forwarding rule for 2222 to 22 to make SSH work
  5. No iptables are installed. Just vanilla CentOS 7 x64 latest with Webmin latest freshly installed.
  6. Open browser on computer (the same computer running VirtualBox & SSH but outside VirtualBox), and go to http://127.0.0.1:10000

It fails to connect.

enter image description here

This is what I want to see (pulled screenshot from the internet):
enter image description here

I also tried accessing from 192.168.x.x (my PC’s IP), but I get connection refused:

enter image description here

I tried forwarding port 10000 to my local pc’s IP port 10000 too, but still doesn’t work:

enter image description here

I can’t use bridged because port forwarding is greyed out.

enter image description here

I did try setting up a bridged connection, but then even SSH wouldn’t connect, as well as either my host PC’s IP (http://192.168.x.x:10000) or (http://127.0.0.1:10000)

To troubleshoot I ran nmap in SSH:

# nmap 192.168.x.x -p 10000 -sU -sT -Pn --reason

Starting Nmap 6.40 ( http://nmap.org ) at 2022-06-14 21:33 EDT
Nmap scan report for DESKTOP-CHTUIRP (192.168.x.x)
Host is up, received user-set (0.0013s latency).
PORT      STATE    SERVICE          REASON
10000/tcp filtered snet-sensor-mgmt no-response
10000/udp filtered ndmp             port-unreach from 10.x.x.x

Nmap done: 1 IP address (1 host up) scanned in 0.47 seconds

Then I tried from localhost, but localhost (127.0.0.1) seems to be up.

# nmap 127.0.0.1 -p 10000 -sU -sT -Pn --reason

Starting Nmap 6.40 ( http://nmap.org ) at 2022-06-14 21:35 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up, received user-set (0.021s latency).
PORT      STATE SERVICE          REASON
10000/tcp open  snet-sensor-mgmt syn-ack
10000/udp open  ndmp             udp-response

Nmap done: 1 IP address (1 host up) scanned in 0.98 seconds

also seems to be up from the guest IP (10.x.x.x)

# nmap 10.x.x.x -p 10000 -sU -sT -Pn --reason

Starting Nmap 6.40 ( http://nmap.org ) at 2022-06-14 21:41 EDT
Nmap scan report for 10.x.x.x
Host is up, received user-set (0.00021s latency).
PORT      STATE SERVICE          REASON
10000/tcp open  snet-sensor-mgmt syn-ack
10000/udp open  ndmp             udp-response

Nmap done: 1 IP address (1 host up) scanned in 0.79 seconds

How to connect and log into WebMin that is installed in VirtualBox, in a browser on the host PC?

Asked By: user7211

||

UPDATE: SOLVED IT!! I’m leaving this data here, like my other questions, to hopefully help others.

The problem was threefold.

  1. Firewall: I DID have a firewall installed. firewall-cmd --state and it returned running.

To debug, I stopped the firewall with systemctl stop firewalld (it hung, but I
pressed CTRL+C to terminate the command) then ran firewall-cmd --state and it returned not running.

But now make sure to re-enable firewall if you haven’t:

systemctl start firewalld

Now you don’t want to leave your firewall running. So since I know what firewall I have, now I can open the port 10000:

`firewall-cmd --permanent --zone=public --add-port=10000/tcp`

With that command run, now you will be able to access port 10000.

  1. Port forwarding: I had also updated the port forwarding in VirtualBox to this:

enter image description here

Yes, I chose 127.0.0.5, but it should probably work now anyway if I
used 127.0.0.1 too, I just used .5 which is one of the localhost
numbers to help narrow down the problem)

  1. Hostname problem: After that, http://127.0.0.5:10000 gave this error:

enter image description here

So I clicked that link, and didn’t load, but that’s because I never set up a hostname (that’s the default on CentOS install if you don’t change it).

Change hostname with this:

hostname 127.0.0.1

Yes I set hostname to the IP since I didn’t have any domains on it of course.

Then after that I went to the https version:

https://127.0.0.5:10000 

(because I had port forwarded 127.0.0.5 in VirtualBox settings pictured above)

And after passing the SSL error, it loaded up WebMin!

enter image description here

Success!!

Answered By: user7211