I have a Linux VM with NAT and PAT configured. Let's say ports 2000 and 2001 are forwarded to the VM. These ports are also configured for external access on a device such as a router using a domain name such as mydomain.com
. The following command is first run:
nc -klv 2000 # listens on port 2000
This service can be tested locally and externally:
nc -v localhost 2000 # Connection success
nc -v mydomain.com 2000 # Connection success
Now we test port 2001 which is not currently listening on the guest:
nc -v localhost 2001 # Connection refused
nc -v mydomain.com 2001 # Connection success (socket closes immediately after)
The problem is nc -v mydomain.com 2001
. The connection should be refused. It looks like VirtualBox automatically binds to forwarded ports on the host machine regardless of whether those ports are being listening to on the VM. How can this be resolved? Do I need to configure proxy settings?
nc -v mydomain.com
is executed from another host. If so, try doing that again, then on the VirtualBox host, enter the commandnetstat -tp | grep 2001
to see what process is bound to port 2001.tcp 0 0 collin-CS23-SH.hom:5555 collin-CS23-SH.ho:52308 TIME_WAIT -
. And what's the purpose of finding the process? It's a vbox configuration, no?