-1

I have the following VBox...

enter image description here

I check and ssh is running

enter image description here

So I try to forward the request

enter image description here

and then I to ssh from host...

$node % ssh -v -p 40 me@127.0.1.1
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /.../.ssh/config
debug1: /.../.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to 127.0.1.1 [127.0.1.1] port 40.
debug1: connect to address 127.0.1.1 port 40: Operation timed out
ssh: connect to host 127.0.1.1 port 40: Operation timed out

What am I missing?

Update

I have confirmed it works with bridged but I want to use NAT

Jackie
  • 134
  • 1
    Please copy&paster text to your question as text instead of showing screenshots. – Bodo Sep 15 '20 at 14:30
  • ? Then it looks unreadable IMHO. And it is just console logs so not sure where this helps – Jackie Sep 15 '20 at 14:36
  • 1
    https://meta.stackoverflow.com/q/285551 Copy&paste the text into the question and format it as a code block. – Bodo Sep 15 '20 at 15:44
  • Bodo is correct; it makes it easier for answerers (and future readers) to compare, troubleshoot, and answer your question if it has text as text. Thank you! – Jeff Schaller Sep 15 '20 at 15:59
  • @Bodo I know how to do that but it still looks like crap @JeffSchaller I would get that if it was code but you aren't going to be able to recreate my ip a command locally – Jackie Sep 15 '20 at 18:50

1 Answers1

0

In VirtualBox you can't access a guest directly from the host when using a NAT'ed network interface.

A common solution for this, is to use bridged mode or create a second host only interface for host to guest communication.

However, it seems that setting up port forwarding should be possible if you require a NAT'ed interface, as you have mentioned in the comments, but it seems that you might have an error in the forwarding rule.

The ip command show the guest ip to be: 10.0.2.15 But in the forwarding rule you used: 10.2.0.15 as ip address.

johan
  • 101
  • Thanks but that seems to contradict posts like https://unix.stackexchange.com/questions/12885/how-to-reach-a-vbox-guest-from-host-when-using-nat-networking. – Jackie Sep 15 '20 at 14:10
  • 1
    @Jackie, I agree if the accepted answer there is correct? I have never been able to make it work. I would agree with: https://unix.stackexchange.com/a/12886/311645 But I might be wrong. – johan Sep 15 '20 at 14:21
  • thanks but even that answer says "You may configure special port forwarding rules to reach the boxes" (talks about how you cant access the whole network but I don't need that). So I think there is a way to do it so technically your answer is wrong (at least given my question) the question is if it is wrong, how do I get it to work. – Jackie Sep 15 '20 at 14:24
  • Just realized I posted the wrong link initially https://unix.stackexchange.com/questions/145997/trying-to-ssh-to-local-vm-ubuntu-with-putty – Jackie Sep 15 '20 at 15:10
  • From that post it sure seems to be possible. It seems that your forwarding rule might be wrong. I have updated my answer. – johan Sep 15 '20 at 18:26
  • Good catch let me confirm – Jackie Sep 15 '20 at 18:51
  • No dice I changed it to match but it is still not working. – Jackie Sep 15 '20 at 18:57