VMware虚拟机配置静态IP
程序员文章站
2022-03-10 21:05:39
...
修改本地NAT IP
打开“网络和共享中心”-“更改适配器设置”-“VMware Network Adapter VMnet8”-右键属性-双击IPV4协议 修改如下:
VMware设置修改
编辑-虚拟网络编辑器 修改如下:
点击NAT设置 修改如下:
虚拟机内的设置(Ubuntu)
aaa@qq.com:~# cd /etc/network/
aaa@qq.com:~# mv interfaces interfaces.bak
aaa@qq.com:~# cp interfaces.bak interfaces
aaa@qq.com:~# vim interfaces
修改如下:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto ens0
iface ens0 inet static
address 192.168.5.130
netmask 255.255.255.0
gateway 192.168.5.2
dns-nameserver 114.114.114.114
继续
aaa@qq.com:~# vim /etc/resolv.conf
修改
nameserver 114.114.114.114
重启虚拟机
aaa@qq.com:~# reboot
测试能否ping通外网
#显示网络信息
aaa@qq.com:~# ifconfig
#ping外网
aaa@qq.com:~# ping www.baidu.com
#ping主机
aaa@qq.com:~# ping 192.168.5.1
下一篇: pip杂七杂八小问题