visualbox nat方式聯網時ssh無法訪問虛擬機的解決辦法

In NAT mode (the default one), virtualbox does not give you the possibility to directly connect to your guest os.

Running a server as a guest in a VirtualBox virtual machine isn’t much good when you can’t network with the guest OS from your host machine. Instead of setting up host interface networking, you can simply port forward though VirtualBox’s NAT. Once port forwarding is set up, any computer on your network will be able to network with your guest OS though forwarded ports on your host.

所以,如果虛擬機利用NAT聯網時,如果想利用putty或者ssh訪問虛擬機時,就必須設置好端口轉發。

可以通過命令方式實現端口轉發,也可以通過visual box的界面直接進行設置:





上面這樣設置的意思就是:ssh訪問host(即localhost)時:ssh localhost,自動會轉到虛擬機上去。



這樣就能訪問guestos了。






發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章