PS:首先要将网络适配器设置为NAT模式。
刚用虚拟机安装完ubuntu后,实用ifconfig提示找不到命令:
用sudo apt install net-tools也提示错误:Package 'net-tools' has no installation candidate.
原因:系统缺少安装相关软件的包,需要更新软件源
su root也切换不到root模式下:
最后执行sudo apt-get update 执行成功:
再次执行sudo apt-get install net-tools就可以了。
然后再次执行ifconfig就可以执行成功了:
参考博客地址: