Mac VMware Fusion Centos7 静态ip配置

1.把网络配置nat模式

2.在mac终端到这个目录下
cd /Library/Preferences/VMware\ Fusion/vmnet8
cat nat.conf

#NAT gateway address
ip = 172.16.15.2
netmask = 255.255.255.0

这里的ip就是虚拟机的网关地址,netmask就是子网掩码

cat dhcpd.conf

subnet 172.16.15.0 netmask 255.255.255.0 {
range 172.16.15.128 172.16.15.254;
option broadcast-address 172.16.15.255;
option domain-name-servers 172.16.15.2;
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.15.2;
option routers 172.16.15.2;
}

range就是静态ip的范围

3.设置虚拟机固定ip
cd /etc/sysconfig/network-scripts
vi ifcfg-ens33

BOOTPROTO="static"
IPADDR=172.16.15.130
GATEWAY=172.16.15.2
NETMASK=255.255.250.0
DNS1=114.114.114.114

注:DNS要和mac的DNS保持一致

4.重启网卡
service network restart

ping baidu.com 试试

你可能感兴趣的:(linux)