Mac Vmware NAT模式

Posted xidianzxm

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mac Vmware NAT模式相关的知识,希望对你有一定的参考价值。

1、NAT模式原理

技术图片

2、MAC上关于Vmware的配置

1)/Library/Preferences/VMware?Fusion/networking
MacBookPro:~ zhangxm$ vi /Library/Preferences/VMware\\ Fusion/networking

VERSION=1,0
answer VNET_1_DHCP yes
answer VNET_1_DHCP_CFG_HASH 282ECBC1747A334B158378BDD29695FCC0EA7007
answer VNET_1_HOSTONLY_NETMASK 255.255.255.0
answer VNET_1_HOSTONLY_SUBNET 192.168.1.0
answer VNET_1_VIRTUAL_ADAPTER yes
answer VNET_8_DHCP no#默认为yes
answer VNET_8_DHCP_CFG_HASH 5E259BE6665EA8FCF09FF225BEDC717CD3797414
answer VNET_8_HOSTONLY_NETMASK 255.255.255.0
answer VNET_8_HOSTONLY_SUBNET 192.168.8.0
answer VNET_8_NAT yes
answer VNET_8_VIRTUAL_ADAPTER yes

如果用DHCP方式

MacBookPro:~ zhangxm$ vi /Library/Preferences/VMware\\ Fusion/vmnet8/
dhcpd.conf      dhcpd.conf.bak  nat.conf        nat.conf.bak    nat.mac         
MacBookPro:~ zhangxm$ vi /Library/Preferences/VMware\\ Fusion/vmnet8/dhcpd.conf
-----------------------------------------------------------
...

subnet 192.168.8.0 netmask 255.255.255.0 {
        range 192.168.8.128 192.168.8.254;
        option broadcast-address 192.168.8.255;
        option domain-name-servers 192.168.8.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 192.168.8.2;
        option routers 192.168.8.2;
}
host vmnet8 {
        hardware ethernet 00:50:56:C0:00:08;
        fixed-address 192.168.8.1;
        option domain-name-servers 0.0.0.0;
        option domain-name "";
        option routers 0.0.0.0;
}

...

2) /Library/Preferences/VMware Fusion/vmnet8/nat.conf
MacBookPro:~ zhangxm$ vi /Library/Preferences/VMware\\ Fusion/vmnet8/nat.conf

# VMware NAT configuration file
  
[host]

# NAT gateway address
ip = 192.168.8.2  #文件第一行就是网关ip.可以自己修改修改,尝试下.注意的是.此处修改了,linux的eth0网卡配置文件里的网关也要改,这两处的ip要相同.
netmask = 255.255.255.0

# VMnet device if not specified on command line
device = vmnet8
...

3、Linux 虚机(CentOS)设置网络

[[email protected] network-scripts]# pwd
/etc/sysconfig/network-scripts
[[email protected] network-scripts]# vi ifcfg-ens33 
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.8.101
GATEWAY=192.168.8.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=cf39fb18-bcb2-426f-b210-1f756096caa3
DEVICE=ens33
ONBOOT=yes
~                 

以上是关于Mac Vmware NAT模式的主要内容,如果未能解决你的问题,请参考以下文章

VMware中centos6.5 minimal 使用NAT模式联网

vmware安装centos,ping不通外网(公司绑定mac和ip)

VMware在桥接模式下无法上网!!!怎么解决?

Mac VMware Fusion Centos7 静态ip配置

VMware Fusion怎么设置网络连接MAC系统

Mac VMware Fusion安装CentOs 7后的无法联网问题