Link to home
Start Free TrialLog in
Avatar of Christopher Stewart
Christopher StewartFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Putty connects to VM running on one PC but does not on another.

I have a an Oracle Linux VM running in Oracle Virtual box. I am trying to connect to the VM using Putty but I get the message 'Network Error: Connection Refused'. If i ping the VM that works. 'ifconfig', executed from the console shows the expected IP address and netmask info. The same VM, running on my laptop (I know it's the same because it's the same Oracle appliance OVA), I can communicate with that VM using putty so ssh must be working. 


The VM on both computers are using host only networking.

Avatar of Scott Silva
Scott Silva
Flag of United States of America image

Connection refused is either SSHD not running, not configured, not allowing the user or firewall...
so just use telnet <ip address> 22

does it connect ? (or make a connection)
Avatar of Christopher Stewart

ASKER

I switched off my firewall on the Windows host but that made no difference.  Connections to the same VM running on my laptop works, why would sshd be running on one copy of the VM but not on another?

I tried using telnet from putty but that did not work either.
I also tried stopping the firewall on the Linux VM by using 'systemctl stop firewalld'
Not sure what you mean by "the same vm running on another computer"
The exact vm or a copy?
If a copy is the network card pointed to the existing network card on the non working machine?
So if putty or telnet do not connect to port TCP 22.

1. there is no service listening on TCP 22
2. there is communication error, or wrong IP Address.

have a look at this article to confirm 22 is listening in the VM

https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/
Imported the same OVA file in VirtualBox on 2 separate computers. On the laptop it works on the desktop it does not.

I ran the 'netstat -tulpn | grep LISTEN' command as suggested in the article above and to the output attached.


Screenshot-2023-02-17-230933.png
unfortunately you are not providing information on which anything can be based.
can you ping the VM to which you are trying to connect but can not?

netstat -rn on the VM to whcih you are trying to connect but fail.
The image shows that the SSH service is running and listening on all interfaces, 0.0.0.0:22 LISTEN

Connection refused could also be the result of a TCP_WRAPPERS rules

more /etc/hosts.allow /etc/hosts.deny
check the IP of your windows system.

check the VMs /var/log/secure to see whether it has info why a connection was denied.
Are both Vms similarly configured to get an IP on the LAN versus being NAT.
Can the problematic VM be accessesvia Purty from the host on which it is running?i
I have provided all of the information suggested.

The screenshot 'Screenshot 2023-02-18 104717.png' shows the results from more /etc/hosts.allow /etc/hosts.deny.
The word document attached 'Desktop PC' shows the network setup on the host PC and details from the VM. Also shown is the contents of '/var/logs/secure'. I would have preferred to FTP the file and attach it but I could not.

Also included in the word doc is a screen dump showing the output from 'netstat -rn'.

The word document 'Laptop PC' shows the same from the system where Putty does connect. I have also attached the output for netstat and a copy of the secure file from the laptop.


I only see one Image attached in this thread. the Files you attached, are they in different question threads on this topic?

Or the Documents werre not attached?

what is the OVA, can anyone download it ?


Hang on here


The VM on both computers are using "host only networking."


that only allows communication  between host and VM ?


So just to confirm you are on the HOST and using PuTTY to communication connect to the Guest VM ?


and Oracle Virtual box is running on two different Windows Hosts, and one works (which is your laptop) and one does not ? (which is your computer).


Have you just tried to confirm for test purposes, changing to NAT and Bridged, and check again if a NAT and Bridged connection work (ssh) just to prove the Host Only networking is broken.

Yes I am using Putty to communicate between the host PC and the VM. I tried changing to NAT and bridged and they did not work either. NAT changed the IP address of the VM causing the failure of the software running on the VM.

The OVA in question is an Oracle applications Appliance VM. Anyone can download it from 'https://edelivery.oracle.com/osdc/faces/SoftwareDelivery'. It is rather large, zipped it is 70Gb. Assembled and unzipped 300Gb
NAT changed the IP address of the VM causing the failure of the software running on the VM.

It is normal for the IP Address to change if changing from Host only to NAT or Bridged, as for failure of the VM, not sure don't know the VM.

Rather large at 300GB!

:-)
I'll check and test here, but if you have already imported into the laptop, and it works, then must be something wrong with Desktop PC configuration.

 Oracle applications Appliance VM - gives many appliances, if you could be more specific, as to exact name.
The particular VM I am running is 'Oracle VM Virtual Appliances for Oracle E-Business Suite 12.2.10'
When you run the VM from virtual box, can you confirm ssh is running on the one to which you are failing to connect?
You posted one image, but it is not clear to me which one, the one that is working or the one that does not?
Does the VM to which you are not able to connect, access the outside?
ping 8.8.8.8

what happens?
Uploaded the files again
Laptop-PC.docx
Desktop-PC.docx
I cannot access the outside internet from the VM on either the desktop or the laptop. But that was not important. I can see on both VM's that the gateway setting was not set.
Host only network

Communications between host and guest only
Yes I know. I am only trying to communicate between the host and the VM. I am trying to use putty to communicate with the vm
Cam you confirm that your LAN laptop, desktop PCs themselves are not on the192.168.1.0 network?
Ip overlap..

On the desktop and related VM, change the host to. VM network from 255.255.0.0 to 255.255.255.0

And see if it makes a difference to allow the desktop putty connection from how to VM.

Make sure the VM on the desktop host reflects the change in netmask.
That was a reminder to everyone why the VM does not have internet access

I’ll download VM later but let oks PC config specific if it works on laptop
Changed the netmask as suggested, please see attachment 'Change Netmask.docx'. No change.
Change-Netmask.docx
You have a configuration error.
Your VM and the Virtual network gateway on the host are using the same IP 192.168
1.11
It seems that based on your current configuration 192.168.1.11 is the default gateway for the VM.

Change the VM IP to something like 192.168.1.1 mask 255.255.255.0 and gateway of 192.168.1.11 and you shouod have access from the host running putty to connect to the VM on IP 192.168.1.1



Sorry for the delay in getting back. Away at work.
You've lost me, where do I have a gateway set?
If memory serves me correctly, the document you uploaded reflects the IP on the host as ending in .11  and this is the same IP that the VM has on this host.

The IP of the HOST's VirtualBox adapter is the Gateway for the VM guests to use not.

Change the VM guest's IP to anything other than 192.168.1.11 and use the 192.168.1.11 as the gateway if you need this VM to be able to connect out.

note once you change the IP of the VM to anything other than .11.
the host will be able to connect to the VM via the new IP.
Make the VM have the IP 192.168.1.2 netmask 255.255.255.0 default gateway 192.168.1.11
Ah, on the windows internet adapter. I changed that to 192.168.1.2 and the netmask to 255.255.255.0. Still made no difference.
Christopher, you seem the exact opposite of what was suggested.

your setup is
       
                                       / Computer Host 1 <=> VM1
Internet <=> router <=> Switch <=>
                                                   \Computer host 2 <host VirtualBox IP 192.168.1.2>  <=> <VM IP 192.168.1.11 what is the gateway it is pointing to 192.168.1.1?>

Once you changed the HOST Virtual adapter IP to 192.168.1.2, can you ping 192.168.1.11 still and can you ssh to it now?

Can you repost the same data you did last time.
From The VM : ip addr, netstat -rn
from the Host: ipconfig /all

Please note that in the prior post, the status of the Media on the VirtualBox adapter seems to have suggested Media State:  Media Disconnected


Perhaps it was clipped. If possible from the host, post text versus images,
right-click, mark and you can select the entire output through scrolling from the top down.

Usually, the VirtualBox host Adapter would be automatically, .1 as the default routing the first IP is used as the default gateway.
Yes I did actually try pinging the VM from windows. That did work, just that putty does not work. Actually it was originally set to 192.168.1.1 but while trying all kinds of stuff when trying to determine why this does not work I did change that and forgot to put it back.
Screenshot-2023-02-27-115959.png
Screenshot-2023-02-27-115819.png
Double check your VM firewall settings do you allow ssh through the firewall UFw, Firewalld, iptables?
is ssh running on the VM?
ps -ef | grep ssh


also on the host
arp -a 192.168.1.11

compare it the HW address on the VM to make sure they match, alpha-numeric characters only, disregard the : in the windows output.

This is to confirm you are accessing/connecting to the same system/vm.
ssh is running on the VM. The arp command confirms that the MAC address actually used by the VM matches the configuration in the software. Please see screenshots.

What is even more weird is that I can access the Oracle application from the browser (has shown in the last two screen shots), it is just terminal access which does not work.
Tried shutting down iptable in order to disable the firewall, got the message iptables service not loaded as shown in last screendump
Screenshot-2023-02-27-145945.png
Screenshot-2023-02-27-163600.png
Screenshot-2023-02-27-164712.png
Screenshot-2023-02-27-173825.png
you may have firewalld
ps -ef | grep firewalld

try sudo firewall-cmd --list-all

the item you are looking for is Services: and to see whether ssh is on that list.

ASKER CERTIFIED SOLUTION
Avatar of Christopher Stewart
Christopher Stewart
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial