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)设置网络
[root@ip101 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@ip101 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
~