ubuntu被卸载netplan后网络无法直连,只能通过vmware进入虚拟机。
1、通过ifconfig 设置ip跟网关
ifconfig eth160 192.168.1.33 netmask 255.255.255.0 up
eth160是要设置的网卡,192.168.1.33是要设置的IP,255.255.255.0是子网掩码
设置网关
route add default gw 192.168.1.1
2、设置DNS服务器
vi /etc/resolv.conf
nameserver 10.12.2.3
3、更新软件包地址及重装netplan
sudo apt-get update
sudo apt-get install netplan.io -y
4、 重新应用配置
sudo netplan apply
5、重启服务器 (非必须)
reboot