How to connect two virtual machines (Windows & Ubuntu) on VMWare? - networking

I am trying to connect two virtual machines Ubuntu and Windows (the host is Windows) on VMWare Workstation to test the sending of Mosquitto messages (MQTT) between the two machines, but I am a novice in network art. So I have no idea on how to proceed. I have tried to set an IP adress to each machine with the option "Custom virtual network" but it's not working...
Please help me on this.

I finally could make it work :
The two machines have to be connected with NAT
The Windows firewall has to be disabled
The IP address of the subscribed machine has to be specified in the mosquitto line command when testing the sending of MQTT messages between the two machines.
mosquitto_pub -h [IP address] -t test -l
If not, mosquitto send messages to the local host by default.

Related

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

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.

SSH from Virtualbox Guest to DynDNS address

I have Windows 10 as host with a Manjaro installation as Guest on Virtualbox.
I have set a Debian server on another house with ssh installed. I have setup a dyndns on Debian's network so I can access it remotely.
For example..
From address 12.34.56.78 I ssh to foo.dyndns.org:1234. This port redirects me to 192.168.1.5:22 always as this is my Debian machine and the connection is established. I am able to do this from Windows 10 as well as my android and any other device in 12.34.56.78 or by 3G.
But..
When I try to do this
$ ssh foo.dyndns.org:1234
from the Manjaro Guest in Virtualbox I get the following error:
ssh: Could not resolve hostname foo.dyndns.org:1234: Name or service not known
So I did ifconfig and I saw my inet address was 10.0.2.15. I changed virtualbox's network adapter from NAT to Bridged so I can get a lan ip and I got the host's ip, 192.168.2.4. So I gave it another try and still didn't work.
Also, if i try to connect from vm to server while I'm in the same network
$ ssh user#192.168.2.5:22
it works. In this case virtualbox's network adapter was NAT.
This command works if I try from my android (connectbot).
I can connect the same way from PuTTY from Windows.
So my questions are:
Can it be done?
If so, how? (and why?)
Can a VBox Guest get lan ip that's not the same as the host's?
Is there any more information I should provide?
I have searched for a couple of days in here and on google and all I found where solutions on how someone can ssh INTO a vm. No one (from what I saw) asked the opposite.
Checking manual page for ssh reveals the format of command-line options:
ssh [...] [-p port] [...] [user#]hostnamessh
This simply describes, that you need to change
ssh foo.dyndns.org:1234
to
ssh -p 1234 foo.dyndns.org
if the domain resolves correctly to the ip address.

Host Only connection NetBSD to Windows

I have NetBSD-4.0.1-x68k installed as a guest virtual machine on Windows (using the XM6i 68030 emulator for windows 7). I am trying to setup a host only connection on the NetBSD guest. However, I can't ping the guest from the host unless I run:
tcpdump -i ne0 #executed on guest
ping 192.168.2.17 #executed on host
ping 192.168.2.1 #executed on guest
Right after I run these commands in that order I can continue to ping successfully ...but not forever, after a certain point I am unable to ping again from neither the host nor guest. Also, when I restart the system, I still can only do pings unless I do the above process beforehand, and again, not forever.
Is there anyway I can setup this host only connection without using tcpdump as a short term temporary handicap?
I turns out on the latest version of XM6i. In order to get a complete 68030 networking emulation you need to use tcpdump command on boot. So there is no way around this.

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.

TCP traffic can't be routed from guest to host on Windows hosting Solaris 10 on Virtual PC

I boot the machine and immediately issue a ping command to the VPC guest OS (Solaris 10). I use the ping -t 10.3.6.63 (windows) command so that the ping continues on the windows machine.
This is what I get "Reply from 10.3.6.63: Destination host unreachable."
I log in to the solaris desktop and realize that my domain name was not resolved it is now at "unknown." I ping my host machine from the guest machine and immediately I get the pings to succeed on the host machine. If I continue to let the ping continue the connection remains stable and I can connect to some services on the guest machine from the host machine.
If I disable the ping service the connection will eventually die. My Oracle client will say connection refused for example.
I re issue the ping command notice that I get "Reply from 10.3.6.63: Destination host unreachable" again.
This time I cannot ping from the guest OS. So I run an arp -d uspqlnb339 (domain name of host PC) and then re-issue the ping command from the guest OS; it succeeds and the pings start working.
What is causing this network path from being disrupted?
I run snoop on the guest account and I do see a lot of failure from the DNS server serving my host machine. For example
"DNS R Error: 2(Server Fail) unkown -> uspqlsv131 DNS C _nfsv4idmapdomain Internet TXT ?"
Perhaps this is a DNS issue. Is there any way to turn this off on Solaris 10?

Resources