Cannot ssh to OEL7 VM

This is for discussing general topics about how to use VirtualBox.
Post Reply
Host2626
Posts: 4
Joined: 29. Apr 2015, 09:01

Cannot ssh to OEL7 VM

Post by Host2626 »

Hi, I am having a problem connecting through ssh from my host system to my vm: "The remote system refused the connection".

VM: VirtualBox 4.3.26, official appliance "Oracle DB Developer VM" (OEL 7.0); no modifications in the VM settings nor the OS
Host: Windows 7 Ultimate 64 bits
Client: SecureCRT 6.6.3 (running on the W7 host)

What I have checked/tried:

sshd is running in the VM, restarted many times durint tests anyway.

netstat -an: 0.0.0.0:22 LISTEN

Disabled the firewall from the GUI, "iptables -L" shows everything empty.

/etc/ssh/sshd_config doesn't show anything weird. For kicks, took that file from a physical OEL5.8 machine that is working fine, (restarted sshd of course), same "refused the connection".

From the windows host, "ipconfig/all" has shown that the VMs IP is "192.168.56.1". Another (non-existing) IP or port with no LISTEN in the VM gives the usual "connection timeout", so the "refused connection" shows that I am hitting the right machine on the right port.

Here are the uncommented lines from sshd_config:

AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv XMODIFIERS
AuthorizedKeysFile .ssh/authorized_keys
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_rsa_key
PasswordAuthentication yes
PermitRootLogin yes
Protocol 2
PubkeyAuthentication yes
Subsystem sftp /usr/libexec/openssh/sftp-server
SyslogFacility AUTHPRIV
UsePAM yes
UsePrivilegeSeparation sandbox # Default for new installations.
X11Forwarding yes

What else should I check? Does one have to do anything special for an ssh connection from a host system to a VM? Maybe the official appliance is "special"? New things to do in OEL7? I'd like to make sure before I spend time installing a fresh OEL to make my own appliance.

Thanks.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Cannot ssh to OEL7 VM

Post by scottgus1 »

192.168.56.1 is the IP address that Virtualbox, by default, gives to the host's host-only-network virtual network card. If you have successfully installed Virtualbox with all the options, your host will show a device on it with 192.168.56.1 for an IP, even before you have any guests. Guests would get a different IP in the 192.168.56.### range, if the guest is set to attach to the host-only network and if the host-only network has the DHCP server turned on (see Virtualbox GUI, File menu, Preferences, Network, right-click the host-only network your guest is attached to, edit it, see the IP address range and whether the DHCP server is on and what range it hands out.) Or guests can have a static IP assigned by the user.

You will need to check what kind of network arrangement you've set your guest to have in the Virtualbox settings (see Virtualbox GUI, the guest's network settings, the "Attached To:" dropdown), and then check the guest's IP address it thinks it has, and report back. As a hint, use host-only if you just want to connect between host and guest, or Bridged if you have a network and router already and want other PCs on the network to access your guest, too. NAT won't work easily, if at all, for originating-outside-the-guest communication. See the help file on the different network modes available.
Host2626
Posts: 4
Joined: 29. Apr 2015, 09:01

Re: Cannot ssh to OEL7 VM

Post by Host2626 »

Great explanation. It is working fine now, thanks.
Post Reply