How to do port forwarding on VMWare Player 14.1.2 (Ubuntu 18.04 guest, Windows 10 host)? - portforwarding

I have a VMWare Player (14.1.2 build-8497320) running a Ubuntu 18.04 guest on a Windows 10 host. The Ubuntu guest has a LAMP stack that runs a few web applications. I am using NAT to connect the Ubuntu guest to the Windows host's network.
I can access these applications by using the local IP address of the guest (e.g., http://192.168.80.128/mediawiki) from my Windows host. But I want to access it like so from my Windows host: http://localhost/mediawiki. I think this should be possible if I can forward the port 80 of my Ubuntu guest to that of the Windows host.
How do I make this happen please? I don't have access to VMWare Workstation and its Virtual Network Editor.
Edit: I should probably add the motivation for wanting to do this. Basically, I want to avoid figuring out the IP address of the virtual machine everytime I access the web applications.
The (further) reason is that the local IP address of the Ubuntu guest might (I suspect) change, and that will affect quite a few things, such as the base URLs configured in the webapps' configuration files (e.g., the $wgServer variable in LocalSettings.php of MediaWiki).

VMWare Player supports port forwarding over NAT natively:
In the file C:\ProgramData\VMware\vmnetnat.conf put under section [incomingtcp] a line like:
80 = 192.168.80.128:80
Then restart the VMWare NAT Service :
net stop "VMWare NAT Service"
net start "VMWare NAT Service"
Source/credits: https://hitchhikingtheweb.wordpress.com/2014/09/02/portforwarding-with-vmware-player-and-nat/
Also: VMWare documentation of this

You can do it using SSH Tunneling for example.
From windows you open a tunnel from the windows port 80 to the ubuntu port 80.
You can do it using Putty on Windows and having the ssh deamon running on ubuntu, which I guess you should already have.
There are many tutorials on how to do this.
I'll add just one link, but you can always google it and find one that suites you.
Portforwarding with SSH (Putty)
For the possible changes in the guest’s ip:
If you can’t fix the ip in settings then perhaps you can edit the windows hosts file and add a host name for the current Ubuntu ip. Then build the urls using the host name. If the ip changes you change it in the hosts file.

Related

How Do I Remote Desktop to a VMWare Windows 10 VM, not the base machine?

I have a PC running Windows 10. On that PC I have VMWare hosting a Windows 10 VM. I can run the VM without issue from the local machine. The VM has a typical Windows PC Name, different from the base machine.
When I try to make a Remote Desktop connection from a different PC to the VM using the VM PC Name, it connects to the base machine. I can see the VM running on the base machine and control it.
I need to be able to run several VM's on this base machine and then use RDP to run remote desktop sessions on the VM's.
Other configuration info:
The VM Network is configured as NAT and I have followed the instructions here
(https://kb.vmware.com/s/article/1018809)
If I change to Bridged for the Network then I can ping my other PC from the VM if I set up a
fixed IP address - nothing if I try DHCP but that may be due to company network constraints.
In Bridged mode, I can't ping back to the VM from my other PC. (Edit: fixed, this was just Network Discovery and Firewall settings)
I need this system running on Windows 10 as our IT department doesn't want to support my application (even though they agree to it being used) which means I can't go to a Windows Server option. Also, the VM's need to be Windows 10 for application compatibility.
All the equipment under test is in the same LAN subnet and on a single, dumb switch.
Any help would be appreciated.
Launch the menu item VM > Settings.
Search the start menu for command prompt from within the virtual machine. Enter ipconfig in the prompt and search for a value following the IPv4 Address. Record this address for later use.
Now select the menu item Edit > Virtual Network Editor.
Select the NAT network type and then choose NAT Settings.
From this new prompt, click Add to include a new port forwarder.
Enter the following information: Host Port: 9997, Type: TCP, Virtual machine IP address: Enter the IP you recorded in Step 2.
note: This port number is 3389 by default, Save any open prompts so the configuration changes can take place.
The final step is to enable RDP connections from within the operating system itself.

Windows: How to redirect udp traffic to another port

I currently have a virtual machine running on Windows. The VM is running Linux and has a virtual box network between the windows machine and the linux machine. The VM is running a application that I want to be able to connect to from the outside world.
To make this possible I tried port forwarding from the windows internet interface, to the windows virtualbox interface. Finally I created another port forward from the windows virtualbox interface to the Virtual machine interface.
netsh interface portproxy add v4tov4 listenport=5000 listenaddress=10.11.65.103 connectport=7890 connectaddress=192.168.56.1
netsh interface portproxy add v4tov4 listenport=7890 listenaddress=192.168.56.1 connectport=5000 connectaddress=192.168.56.101
So if I connect to the 10.11.65.103:5000 on the Windows Machine it will be the same thing as connecting to 192.168.56.101:5000 of the VM.
[Win Internet Intf] [Win VM Intf] [VM intf]
10.11.65.103:5000<----->192.168.56.1:7890 <------> 192.168.56.101:5000
Unfortunately, this is not working for me... Can someone tell me why? Am I using port forwarding correctly?
If you use a bridged network adapter your Linux machine should pick up an IP off the host network (if you have DHCP enabled on the network, or set a static IP on the linux box). Then you should then not need the port forwarding.
If you cant use that approach and are using a NAT adapter (which it looks like you are), then you will need to enable port forwarding within VB. The details are in section 6.3 of the VB Help with this in place you should only then need the first port forward, VB will be doing the second.
Dont forget to make sure the relevant firwalls on the Windows and Linux machines are open.

Virtualbox -- configuring two VMs to talk to each other / host and internet

Host: Windows 7 running lastest VBox + Extension pack
Vm1: lubuntu 3.10
Vm2: Ubuntu server 12.04.3
Problem: Can't get VMs talk/ping each other AND ping the internet at the same time
NAT: VMs have same IP, using ping/ssh is like checking connectivity/connecting to self, lol; can ping internet, can't ping each other
Bridged: VMs get unique IP; can ping each other, not the internet
Host-only: VMs get unique IP; can ping each other; not the internet
Internal network:
intnet, needs to be defined/added to windows 7, however, window 7 not accepting VBOXMANAGE add command, giving errors. VMs wait for network configuration, another 60 seconds and start without a network.
What else can I do?
Change VM to use NAT Network, generic driver... ???
edit /etc/network/interfaces?
change route?
use squid?
Following Lubuntu Networking Message pops up in Lunbutu GUI:
network service discovery disabled
your cuurent network has a .local domain which is not recommended and incompatible with the avahi network service discovery the service has been disabled.
Can anyone help?
Refresh your MAC address using Virtual Box machine settings and remove the kernel’s networking interface rules file so that it can be regenerated:
sudo rm -f /etc/udev/rules.d/70-persistent-net.rules
sudo reboot
It will work for your clone VM.

Connect to VM running on the same computer without LAN

I have a windows 2003 VM running on my windows xp machine.
The machine name of the VM is itdom.domain.com
The windows xp host machine is disconnected from the LAN.
I want to be able to connect to the VM from the host and vice versa using there computer names. For example the URL http://itlab.domain:7080/domainsm must be accessible from the host computer.
Is there any configuration that I can do on any of the machine to do this.
Just because you have no physical network connection doesn't stop you setting up networking on the host and guest machines. One way of doing this is to add an IP address to the host machine's physical network port and create a bridged network on that port so that the guest can also see it.
You don't say which VM technology you are using, but in many of them you can setup an internal network between the host and guest. All you need to do then is edit each hosts file to add a hostname for the IP address of the other machine. You may also need to configure firewalls to allow access between the two.
No doubt there are also other ways to achieve this.

Connect to server in vmware player while host is not connected to a network

I am using VMWare Player 3.1.0 on Host OS Windows 7 Professional 64-bit. My guest is is SUSE Linux ES 10. My guest OS (SUSE) runs JBoss App Server which I access from host using HTTP. I used a "Bridged" connection to set up all this.
My problem:
When I am connected to network on the Host (using wired network adapter) I can connect to the http server on the Guest OS and browse the application. However, when I am disconnected from the network on Host (unplugged the wire), I cannot access to the guest OS app server and browse the application. I use the guest OS ifconfig command to find out ip address of the guest OS. This ip address does not change whether connected or disconnected. I have even tried using Wireless Data card, but that does not work either.
I have tried "NAT" as well as "Host Only" connection and rebooted the guest but it does not work either. I think for some reason the guest OS can only recognize the physical network card (which is disconnected).
I need to run this machine (my laptop) independently of the network because I use this for demo and need to be able to connect from my host OS to Guest OS.
I am not sure I understand exactly what you are trying to do, but I do know setting up a working NAT configuration will offer you the most flexibility.
Click the networking icon and select settings, Select NAT.
Follow these steps on your Unix OS
cd /etc/sysconfig/network-scripts
Make a backup of your ethernet adapter configuration
cp ifcfg-eth0 ifcfg-eth0.bak
Next modify the settings to look like the following:
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="What ever was here on your system"br/>
NM_CONTROLLED="yes"
ONBOOT="yes"
Save your changes
Restart your network adapters
/etc/init.d/network restart
Try nslookup www.google.com
You should now be able to connect back and forth from your Windows Host and Linux guest.
theJay28
-p.s. I had screenshots, but I do not have the 10 points yet to post images.
I figured that the solution is to restart the VM after making the changes to the NetWork setting on the VMWare. I selected Network for the VM as "Host Only" shutdown the VM and started it again. After that I was able to do what I wanted to do (i.e. browse the web application on guest from the browser in the host machine) without connecting the host to the network.
So key to the solution in my case was to make the network changes and restart the VM.
Any comments suggestions welcome...

Resources