Results 1 to 6 of 6

Thread: Access a local port in my Ubuntu VM from the Windows Host

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    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

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,738

    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

  3. #3
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,703

    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.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  4. #4
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,738

    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

  5. #5

    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.

  6. #6
    New Member
    Join Date
    Sep 2024
    Location
    LA
    Posts
    1

    Re: Access a local port in my Ubuntu VM from the Windows Host

    Quote Originally Posted by MarkCros View Post
    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
  •  



Click Here to Expand Forum to Full Width