Problem with host only network for ssh

Discussions about using Linux guests in VirtualBox.
Post Reply
ichbinfranz
Posts: 3
Joined: 16. Nov 2018, 16:52

Problem with host only network for ssh

Post by ichbinfranz »

Dear all,

I run virtualbox Version 5.2.26 r128414 (Qt5.6.3) on macOS 10.14.2.

I created a host only adapter

Code: Select all

$ ifconfig
vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	ether 0a:00:27:00:00:00
	inet 192.168.56.1 netmask 0xffffff00 broadcast 192.168.56.255
I can ping the address.

in the virtual machine I activated a host only adapter but it has no ip4-address?

Code: Select all

ifconfig:
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::a00:27ff:fead:1dad  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:ad:1d:ad  txqueuelen 1000  (Ethernet)
        RX packets 214  bytes 51846 (51.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 154  bytes 29033 (29.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
and openssh-server is running:

Code: Select all

$ sudo service ssh status
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-02-09 05:40:46 CET; 15h ago
  Process: 1786 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
  Process: 1780 ExecReload=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
  Process: 616 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 623 (sshd)
    Tasks: 1 (limit: 4664)
   CGroup: /system.slice/ssh.service
           └─623 /usr/sbin/sshd -D

févr. 09 05:40:47 franz-VirtualBox systemd[1]: Reloading OpenBSD Secure Shell server.
févr. 09 05:40:47 franz-VirtualBox sshd[623]: Received SIGHUP; restarting.
févr. 09 05:40:47 franz-VirtualBox systemd[1]: Reloaded OpenBSD Secure Shell server.
févr. 09 05:40:47 franz-VirtualBox sshd[623]: Server listening on 0.0.0.0 port 22.
févr. 09 05:40:47 franz-VirtualBox sshd[623]: Server listening on :: port 22.
févr. 09 05:45:56 franz-VirtualBox systemd[1]: Reloading OpenBSD Secure Shell server.
févr. 09 05:45:56 franz-VirtualBox sshd[623]: Received SIGHUP; restarting.
févr. 09 05:45:56 franz-VirtualBox sshd[623]: Server listening on 0.0.0.0 port 22.
févr. 09 05:45:56 franz-VirtualBox sshd[623]: Server listening on :: port 22.
févr. 09 05:45:56 franz-VirtualBox systemd[1]: Reloaded OpenBSD Secure Shell server.
when i try to connect from the host:

Code: Select all

ssh 192.168.56.1 -vvv
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.56.1 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.56.1 [192.168.56.1] port 22.
debug1: connect to address 192.168.56.1 port 22: Connection refused
ssh: connect to host 192.168.56.1 port 22: Connection refused
In ubuntu I receive an error message concerning the network connector enp0s8 :connection failed activation of network connection failed

Thanks for your help in advance.
Last edited by socratis on 9. Feb 2019, 22:31, edited 1 time in total.
Reason: Enclosed the information in [code] tag for better readability
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Problem with host only network for ssh

Post by socratis »

ichbinfranz wrote:in the virtual machine I activated a host only adapter but it has no ip4-address?
That depends on how you've configured:
  1. the HostOnly network and if you have the DHCP server enabled
  2. the network in your guest and whether you have it DHCP enabled or with a static IP
when i try to connect from the host:
  • ssh 192.168.56.1 -vvv
That's your HostOnly server IP. You're trying to connect to your own host, not to your VM. And why are you trying to ssh to your VM since it doesn't have an IP?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
ichbinfranz
Posts: 3
Joined: 16. Nov 2018, 16:52

Re: Problem with host only network for ssh

Post by ichbinfranz »

my bad,

I had to add to /etc/network/interfaces

Code: Select all

auto enp0s8
iface enp0s8 inet static
address 192.168.56.10
netmask 255.255.255.0
restart and connect to the right address
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Problem with host only network for ssh

Post by socratis »

So, that means it's working now?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply