Page 1 of 1
Networking: Linux Guest, Host-Only+NAT, unable to ssh in.
Posted: 7. Aug 2009, 13:46
by refactored
Further to another thread, I've configured 2 NICs in my CentOS guest. VBoxAdditions are installed.
eth0 is set to NAT, with DHCP enabled. eth1 is set to "Host Only", with a static IP:
Code: Select all
DEVICE=eth1
ONBOOT=yes
IPADDRESS=192.168.57.101
NETMASK=255.255.255.0
NETWORK=192.168.57.0
BROADCAST=192.168.57.255
BOOTPROTO=none
TYPE=Ethernet
eth0 and eth1 have to be taken down and brought back up after booting before they'll work.
The host-only adapter is set to 192.168.57.1, with DHCP enabled on 192.168.57.100 (range 101 to 254).
The guest can successfully ping itself, ping google.com, and ssh into itself. It can't ping the DHCP server, nor the host on either it's real network address or 192.167.57.1.
The host can successfully ping the guest, but can't be accessed via ssh. It looks as though vboxnet0 is configured correctly on the host.
Can someone advise as to why the host can't communicate with the guest other than by pinging?
Re: Networking: Linux Guest, Host-Only+NAT, unable to ssh in.
Posted: 7. Aug 2009, 15:01
by baf
your broadcast does not match the rest
IPADDRESS=192.168.57.101
NETWORK=192.168.57.0
BROADCAST=192.168.56.255
Shouldn't that be a 57 instead?
Re: Networking: Linux Guest, Host-Only+NAT, unable to ssh in.
Posted: 7. Aug 2009, 15:14
by refactored
Sorry, it is actually 57 - that was a typo while duplicating the details for the post.
Re: Networking: Linux Guest, Host-Only+NAT, unable to ssh in.
Posted: 7. Aug 2009, 15:50
by baf
OK how does the output from
look from both the host and the guest
also in the guest:
Re: Networking: Linux Guest, Host-Only+NAT, unable to ssh in.
Posted: 7. Aug 2009, 16:06
by refactored
baf: thanks for the response. I don't have access to the machine right now, but when I get back to it is there anything I should be looking for from those commands that would stand out or might be missing? I know that `ifconfig -a` showed that the IPs were set correctly for both interfaces, and that ssh was listening on `tcp :::22`. I tried ssh changing the Host in /etc/ssh/ssh_config from "*" to "192.168.57.101" but no joy.
I'll give more details when I'm back in-front of the machine.

Re: Networking: Linux Guest, Host-Only+NAT, unable to ssh in.
Posted: 7. Aug 2009, 16:28
by baf
if tcp :::22 was the only mention of 22 then its only listening on ipv6 which probably wont work.
you should also have a line like
Code: Select all
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
Re: Networking: Linux Guest, Host-Only+NAT, unable to ssh in.
Posted: 7. Aug 2009, 16:43
by refactored
I see. That's odd, because the machine I'm using right now has the same guest OS and it has the same entry (:::22), doesn't have an entry for 0.0.0.0:22, but I can still SSH in. This guest uses a static IP on the host's network though - not sure whether that would make a difference.
I'll see whether I can find some details on how to configure SSH correctly for dual NICs.
That doesn't explain why I can't ping the host's dhcp server. Is that possible at all, or is it disabled?
Re: Networking: Linux Guest, Host-Only+NAT, unable to ssh in.
Posted: 7. Aug 2009, 16:51
by baf
Well default config is ipv4+ipv6 all interfaces but have you tried restarting sshd after you have the interfaces started?
It feels odd that you have to bring them up and down.
You could try explicitly enabling it in sshd_config with
Code: Select all
Port 22
AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::
And then restarting sshd.
Re: Networking: Linux Guest, Host-Only+NAT, unable to ssh in.
Posted: 7. Aug 2009, 16:59
by refactored
baf wrote:have you tried restarting sshd after you have the interfaces started?
Yes; I've seen similar issues before. No joy.
baf wrote:It feels odd that you have to bring them up and down.
I'd put this down to the fact that there are 2 NICs - I've heard that if they start in the wrong order, you have to restart them in order to get them working. Usually a problem when they're both the same card make/model. I've just not gotten round to fixing this yet. I'll probably change the 2nd NIC's card model to help with this.
I'll try changing the SSH config and see where I get.
Any idea on pinging the host from the guest? Just so if ssh doesn't work I know they're still communicating.
Re: Networking: Linux Guest, Host-Only+NAT, unable to ssh in.
Posted: 7. Aug 2009, 17:07
by baf
Well without seeing ifconfig and netstat output its hard to guess.
Re: Networking: Linux Guest, Host-Only+NAT, unable to ssh in.
Posted: 10. Aug 2009, 22:00
by refactored
Interesting; with the vbox management program running but without the vm running it still pings.