物理机设置
关闭VM的DHCP查看网关和DNS 虚拟机配置
设置静态IP重启网卡其他 物理机设置 关闭VM的DHCP
sudo vim /Library/Preferences/VMware Fusion/networking# 关闭answer VNET_8_DHCP no
查看网关和DNSvim /Library/Preferences/VMware Fusion/vmnet8/dhcpd.confsubnet 172.16.227.0 netmask 255.255.255.0 { range 172.16.227.128 172.16.227.254; # 可选的静态ip的范围 option broadcast-address 172.16.227.255; # 广播地址,也是我们的默认网关地址 option domain-name-servers 172.16.227.2; # DNS地址 option domain-name localdomain; default-lease-time 1800; # default is 30 minutes max-lease-time 7200; # default is 2 hours option netbios-name-servers 172.16.227.2; option routers 172.16.227.2;}host vmnet8 { hardware ethernet 00:50:56:C0:00:08; fixed-address 172.16.227.1; option domain-name-servers 0.0.0.0; option domain-name ""; option routers 0.0.0.0;}
虚拟机配置 设置静态IP# 1.查看使用的虚拟网卡ip addr# centos7vim /etc/sysconfig/network-scripts/ifcfg-ens33TYPE="Ethernet"BOOTPROTO="dhcp"DEFROUTE="yes"PEERDNS="yes"PEERROUTES="yes"IPV4_FAILURE_FATAL="no"IPV6INIT="yes"IPV6_AUTOCONF="yes"IPV6_DEFROUTE="yes"IPV6_PEERDNS="yes"IPV6_PEERROUTES="yes"IPV6_FAILURE_FATAL="no"IPV6_ADDR_GEN_MODE="stable-privacy"NAME="ens33"UUID="90a04425-edae-48cf-92c1-a2ed90b8b4a2"DEVICE="ens33"ONBOOT="yes"# 在最后加上:IP地址、子网掩码、网关、dns服务器IPADDR=172.16.227.131NETMASK=255.255.255.0GATEWAY=172.16.227.0DNS1=172.16.227.2
重启网卡# 重启虚拟机网卡systemctl restart network# 查看IP是否配置成功ip addr
其他ip addr可以看到所有IP,ifconfig看不到。
[wangfugui@localhost ~]$ ifconfigens33: flags=4163