一、VirtualBox的Ubuntu虛擬機設置
1、“網絡”-“連接方式:網絡地址轉換(NAT)”。
2、然後點“高級”-“端口轉發”-“添加新的端口轉發規則”。
協議(Protocol):TCP 主機IP(Host IP):127.0.0.1 主機端口(Host Port):2222 子系統IP(Guest IP):10.0.2.15 子系統端口(Guest Port):22
二、啟動VirtualBox的Ubuntu虛擬機並安裝安裝SSH Server
啟動VirtualBox的Ubuntu虛擬機,登錄後安裝SSH Server:
sudo apt-get install openssh-server
查看ssh服務是否開啟:
sudo ps -e |grep ssh
查看Ubuntu虛擬機的IP地址:
ifconfig -a
三、使用Putty連接VirtualBox的Ubuntu虛擬機
在Windows中運行Putty,Host Name(or IP address)處輸入127.0.0.1,Port處輸入2222,Connection type(連接類型)為SSH即可正常連接。