1

I try to get an ssh-connection between two virtual machines. Therefore I have installed two vm's with Ubuntu-Gnome-16.04 guests on a Ubuntu-Gnome-14.04 host using Oracle VirtualBox 4.3.36.

I setup both vm's to the same internal network on adapter 1. Additionally I set the IPv4 addresses on each guest to static addresses:

  • Address: 192.168.44.10 on quest a and 192.168.44.11 on quest b

  • network mask: 255.255.255.0

  • gateway: 192.168.44.44

  • DNS-Server: 192.168.44.22

Then I can ping between the vm's:

usr@vb-a:~$ ping 192.168.44.11 -c4
PING 192.168.44.11 (192.168.44.11) 56(84) bytes of data.
64 bytes from 192.168.44.11: icmp_seq=1 ttl=64 time=0.155 ms
64 bytes from 192.168.44.11: icmp_seq=2 ttl=64 time=0.316 ms
64 bytes from 192.168.44.11: icmp_seq=3 ttl=64 time=0.308 ms
64 bytes from 192.168.44.11: icmp_seq=4 ttl=64 time=0.319 ms

--- 192.168.44.11 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.155/0.274/0.319/0.071 ms

and the other vm:

usr@vb-b:~$ ping 192.168.44.10 -c4
PING 192.168.44.10 (192.168.44.10) 56(84) bytes of data.
64 bytes from 192.168.44.10: icmp_seq=1 ttl=64 time=0.429 ms
64 bytes from 192.168.44.10: icmp_seq=2 ttl=64 time=0.308 ms
64 bytes from 192.168.44.10: icmp_seq=3 ttl=64 time=0.297 ms
64 bytes from 192.168.44.10: icmp_seq=4 ttl=64 time=0.243 ms

--- 192.168.44.10 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.243/0.319/0.429/0.069 ms

But the I try to open a ssh-connection I get this message:

usr@vb-a:~$ ssh [email protected]
ssh: connect to host 192.168.44.11 port 22: Connection refused

I started troubleshooting and check the ufw status on host and guest is inaktiv because maybe a firewall blocks this port. But ufw isn't active.

Where could be the fault?

Thanks in advance.

Alex

2
  • Firewall? IPtables?
    – Jakuje
    Commented May 1, 2016 at 16:27
  • I have installed firewall configuration at one guest. Under Services > ssh > ports port 22 tcp and udp are listed. Can you specify what I have to looking for?
    – Alex44
    Commented May 1, 2016 at 16:59

3 Answers 3

3

There's a couple of issues you need to explore. First, did you install openssh-server? If not, then

$ sudo apt-get install openssh-server

Usually, the UFW is modified to allow port 22 incoming connections when you install openssh-server. You can check that port 22 incoming is allowed by doing this:

$ sudo ufw status

Otherwise,

$ sudo ufw allow 22

Second, you are trying to login via the root user. The default configuration on ubuntu does not have a password for the root user. If you really want to set a root password (not recommended): $ sudo passwd

By default, PermitRootLogin in /etc/ssh/sshd_config is set to No on Ubuntu systems. Edit that file and change PermitRootLogin to Yes, save the file, and restart the service for the change to take effect.

$ sudo gedit /etc/ssh/sshd_config
$ sudo service ssh restart
1
  • Thanks - installing openssh-server helps! I already have write it as answer... but your answer is more helpful :)
    – Alex44
    Commented May 1, 2016 at 17:33
0

After installing firewall-config I looked into the basic set up of the ssh service and found this:

Secure Shell (SSH) is a protocol for logging into and executing commands on remote machines. It provides secure encrypted communications. If you plan on accessing your machine remotely via SSH over a firewalled interface, enable this option. You need the openssh-server package installed for this option to be useful.

Here comes the information that the package openssh-server has to be installed. After doing that on the guest and a restart of the vm I can use ssh.

-1

what i did is 1. Default NAT adapter kept as is 2. Created Host-only Adapter also with 'Deny' 3. and last but not least instaled openssh-server and sudo ufw allow 22

Somewhat followed what was discussed above

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .