以下是VirtualBox中Ubuntu虚拟机的远程控制方法及步骤:
sudo apt update && sudo apt install openssh-server
sudo systemctl start ssh && sudo systemctl enable ssh # 启动并开机自启
ip addr show
),无需端口转发。ssh username@虚拟机IP -p 端口号
(默认端口22)。sudo apt update && sudo apt install tightvncserver
vncserver :1 # 启动服务并设置密码(默认端口5901)
虚拟机IP:端口号
(如192.168.1.100:5901
),输入密码即可。sudo apt update && sudo apt install xrdp
sudo systemctl enable --now xrdp
sudo ufw allow 3389/tcp # 允许远程桌面端口
根据需求选择对应方法,NAT模式需重点配置端口转发,桥接模式更接近真实网络环境。