-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 [email protected]
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

5
  • 1
    Please copy&paster text to your question as text instead of showing screenshots. Commented Sep 15, 2020 at 14:30
  • ? Then it looks unreadable IMHO. And it is just console logs so not sure where this helps Commented Sep 15, 2020 at 14:36
  • 1
    meta.stackoverflow.com/q/285551 Copy&paste the text into the question and format it as a code block. Commented Sep 15, 2020 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! Commented Sep 15, 2020 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 Commented Sep 15, 2020 at 18:50

1 Answer 1

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.

7
  • Thanks but that seems to contradict posts like unix.stackexchange.com/questions/12885/…. Commented Sep 15, 2020 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: unix.stackexchange.com/a/12886/311645 But I might be wrong. Commented Sep 15, 2020 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. Commented Sep 15, 2020 at 14:24
  • Just realized I posted the wrong link initially unix.stackexchange.com/questions/145997/… Commented Sep 15, 2020 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. Commented Sep 15, 2020 at 18:26

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.