LINUX.ORG.RU

[virtualbox] ssh

 


0

1

Хочу получить ssh-доступ к системе, установленной в виртуалке. VirtualBox, debian-6.0.

Перекинул порты, таким образом 2222 порт localhost будет портом 22 в виртуалке. Sshd на дебиане поставил.

Нмап на локальной машине показывает, что 2222 порт торчит из виртуалки, правда с несколько причудливым сервисом.

$> nmap localhost

Starting Nmap 5.51 ( http://nmap.org ) at 2012-03-08 23:42 MSK
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00054s latency).
Not shown: 998 closed ports
PORT     STATE SERVICE
2222/tcp open  EtherNet/IP-1
6000/tcp open  X11

Нмап в виртуалке говорит, что на 22 висит ssh. Но законнектиться не удаётся

$> ssh -l lk -p 2222 localhost
ssh_exchange_identification: Connection closed by remote host

Что ещё нужно сделать?

Включить мозг

sdio ★★★★★
()

А почему не обращаться по айпишнику виртуалки на порт, который у нее есть?

unfo ★★★★★
()

Да, guest ip и host ip - должны быть адресами во внутренней сети виртуалбокса, а не 127.0.0.1

unfo ★★★★★
()
Ответ на: комментарий от garmonbozia

10.0.2.15. Снаружи оно не пингуется.

NAT

Включить мозг

You will need to know which ports on the guest the service uses and to decide which ports to use on the host (often but not always you will want to use the same ports on the guest and on the host). You can use any ports on the host which are not already in use by a service. For example, to set up incoming NAT connections to an ssh server in the guest, use the following command:

VBoxManage modifyvm «VM name» --natpf1 «guestssh,tcp,,2222,,22»

With the above example, all TCP traffic arriving on port 2222 on any host interface will be forwarded to port 22 in the guest. The protocol name tcp is a mandatory attribute defining which protocol should be used for forwarding (udp could also be used). The name guestssh is purely descriptive and will be auto-generated if omitted. The number after --natpf denotes the network card, like in other parts of VBoxManage.

sdio ★★★★★
()

Тип сети Host Only, а не как по дефолту NAT

Jurik_Phys ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.