-
Apr 1st, 2023, 07:57 AM
#1
Access a local port in my Ubuntu VM from the Windows Host
Wow - I'm way outside my comfort zone.
I created a little SOCKET app with C++ in my Ubuntu VM running on my MS Surface Pro 7 in vmware
I've got a server and client app that runs in the VM properly - just sending a little test response.
How do I allow access to the port inside the linux VM from the Windows side?
I do not have ufw "active" - I just did a "sudo ufw status" and it's inactive.
Thanks! Steve
-
Apr 1st, 2023, 12:10 PM
#2
Re: Access a local port in my Ubuntu VM from the Windows Host
I can only answer how i do it in VirtualBox (no idea about vmware):
think of it the hosting software (VirtualBox, vmware) is kind of like a router: you want to „forward“ the port of the guest-os to the outside world, the host-os.
IIRC, there should be config-options available in the hosting software.
i remember defining port 5678 to map to port 3306 (MySQL) running in the guest.
hope you understand what i mean
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Apr 1st, 2023, 01:43 PM
#3
Re: Access a local port in my Ubuntu VM from the Windows Host
You should be able put the VM on the same network as the host machine. From there you treat the Linux instance as if it were just another physical computer on your network. That basically what I did here for me to be able to connect to the webserver inside the Linux instance. You can see about half way through the video that I compiled the WebServer, copied it to Linux, ran it and just connected to it from a web-browser in the host with no problems.
-
Apr 1st, 2023, 04:27 PM
#4
Re: Access a local port in my Ubuntu VM from the Windows Host
Niya is right, but there are basically two ways:
what Niya said (same network), which in VirtualBox is called a LAN-Bridge,
or with a NAT-Connection.
It was with the second that i could remap a different port
i‘d look for those two in vmware
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
May 30th, 2023, 10:44 AM
#5
New Member
Re: Access a local port in my Ubuntu VM from the Windows Host
Try using a NAT network connection. After obtaining the IP address of the Ubuntu VM, you can access the local port from the Windows host by launching a web browser or any other network application and entering the IP address of the Ubuntu VM along with the port number. For example, if your Ubuntu VM's IP address is 192.168.0.100 and your server application is active on port 8080, you can access it from the Windows host by entering "http://192.168.0.100:8080" in the web interface browser.
-
Sep 13th, 2024, 04:52 AM
#6
New Member
Re: Access a local port in my Ubuntu VM from the Windows Host
Originally Posted by MarkCros
Try using a NAT network connection.
Good suggestion! Also, to set up a NAT network in VirtualBox, make sure that “NAT” mode is selected in the network settings for your Ubuntu VM, and the port is forwarded correctly via the “Port Forwarding” settings. This is important if you want to provide access to an application from a Windows host. For example, for a web server on port 8080, you can configure port forwarding in VirtualBox like this:
Code:
Protocol: TCP
Host IP: 127.0.0.1
Host Port: 8080
Guest IP: 192.168.0.100
Guest Port: 8080
This way, you can access the web server at 127.0.0.1:8080 from the host.
And don't forget that the firewall on the Ubuntu VM can block access. Check the settings of UFW (if used) or another network firewall to see if it allows connections on the correct port
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|