This is a follow-up question from: Make virtualbox get a different IP address than my laptop. I ended up with these /etc/hosts files on both my laptop running Ubuntu 14.04 (the host) and my virtualbox running Ubuntu 14.04 (the guest):   localhost   gsamaras  // gsamaras-VirtualBox master    // the host slave-1   // the guest

I obtained the IPs with this answer. When I set the virtualbox to eth0, this won't return anything and the network seems to be disconnected, so in the virtualbox, I have this setting:

Devices -> Network -> Bridged Adapter (name wlan0)

I can ssh from guest to host with ssh master, but when on master, I am getting:

gsamaras@gsamaras:~$ ssh slave-1
ssh: connect to host slave-1 port 22: Connection refused

Also notice that, when on guest, I am getting:

gsamaras@gsamaras-VirtualBox:~$ ssh localhost
ssh: connect to host localhost port 22: Connection refused

How to fix it?


From guest:

gsamaras@gsamaras-VirtualBox:~$ netstat -an | grep -w LISTEN | grep -w 22

From master:

gsamaras@gsamaras:~$ ping slave-1
PING slave-1 ( 56(84) bytes of data.
64 bytes from slave-1 ( icmp_seq=1 ttl=64 time=0.360 ms
  • Are you sure the message is connect to host slave-1 port 22 and not connect to host localhost port 22 in your last test?
    – jlliagre
    Jan 23, 2016 at 23:33
  • Good catch @jlliagre, I am posting from the master and the copy paster from the guest is hard. :)
    – gsamaras
    Jan 23, 2016 at 23:38

2 Answers 2


Simple way to check the ssh service is up and running locally on the guest:

ssh localhost


netstat -an | grep -w LISTEN | grep -w 22

If not installed, have a look to https://askubuntu.com/questions/51925/how-do-i-configure-a-new-ubuntu-installation-to-accept-ssh-connections

  • I updated my question, both give "bad" results.
    – gsamaras
    Jan 23, 2016 at 23:41
  • You are confusing ssh clients and servers. You need to install the ssh client package on the guest.
    – jlliagre
    Jan 24, 2016 at 0:07
  • I had done that, but it wasn't enough. I installed ssh server and everything is fine now.
    – gsamaras
    Jan 24, 2016 at 0:09
  • 1
    Sorry, I obviously meant install the server packages on the guest.
    – jlliagre
    Jan 24, 2016 at 0:11
  • 1
    I know. :) You might want to update your answer with this super relevant question: askubuntu.com/questions/51925/…
    – gsamaras
    Jan 24, 2016 at 0:16

Check List:

  1. Are you able to Ping Slave-1 ?
  2. Slave-1 IPtables have allowed SSH port ? Stop IPTables and try once.

     service iptables stop
  3. Slave-1 is having SSH service running or not ? If yes try restarting once.

    service sshd start
    service sshd stop
    service sshd restart
  4. Make sure you didnt changed SSH default port.

  • I updated my question just when you posted, does this affect your answer?
    – gsamaras
    Jan 23, 2016 at 23:29
  • @gsamaras Follow my checklist and let me know if still you are facing issue and update shows ssh service may be not running in your Slave-1
    – Raja G
    Jan 23, 2016 at 23:30
  • I pinged slave-1 from the master successfully. I do not know to do the rest of the steps. :/
    – gsamaras
    Jan 23, 2016 at 23:42
  • @gsamaras updated
    – Raja G
    Jan 23, 2016 at 23:45
  • @gsamaras yes in Slave-1
    – Raja G
    Jan 23, 2016 at 23:47

You must log in to answer this question.

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