mac vmware fusion10 nat 模式网络配置
1.虚拟机选择 nat 模式
虚拟机-->网络适配器-->网络适配器设置-->连接网络适配器(对勾)-->与我的 mac共享
2.vmnet1 & vmnet8 的配置文件位于 "/Applications/Vmware Fusion.app/Contents/Library" , 可修改默认地址也,vmnet8 还可以添加映射端口。
# cd /Library/Preferences/VMware\ Fusion
# cat networking
VERSION=,
answer VNET_1_DHCP yes
answer VNET_1_DHCP_CFG_HASH 6345810A7A91B075370FF0B472FA9334687AEB5A
answer VNET_1_HOSTONLY_NETMASK 255.255.255.0
answer VNET_1_HOSTONLY_SUBNET 172.19.173.0
answer VNET_1_VIRTUAL_ADAPTER yes
answer VNET_8_DHCP yes
answer VNET_8_DHCP_CFG_HASH 42662E369263BA0C7E405795C5A7F90C25D878FD
answer VNET_8_HOSTONLY_NETMASK 255.255.255.0
answer VNET_8_HOSTONLY_SUBNET 172.19.73.0
answer VNET_8_NAT yes
answer VNET_8_VIRTUAL_ADAPTER yes # cat vmnet1/dhcpd.conf
# Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet1.
#
# This file was automatically generated by the VMware configuration program.
# See Instructions below if you want to modify it.
#
# We set domain-name-servers to make some DHCP clients happy
# (dhclient as configured in SuSE, TurboLinux, etc.).
# We also supply a domain name to make pump (Red Hat .x) happy.
# ###### VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" #####
# Modification Instructions: This section of the configuration file contains
# information generated by the configuration program. Do not modify this
# section.
# You are free to modify everything else. Also, this section must start
# on a new line
# This file will get backed up with a different name in the same directory
# if this section is edited and you try to configure DHCP again. # Written at: // ::
allow unknown-clients;
default-lease-time ; # default is minutes
max-lease-time ; # default is hours subnet 172.19.173.0 netmask 255.255.255.0 {
range 172.19.173.128 172.19.173.254;
option broadcast-address 192.168.173.255;
option domain-name-servers 192.168.173.1;
option domain-name localdomain;
default-lease-time ; # default is minutes
max-lease-time ; # default is hours
}
host vmnet1 {
hardware ethernet :::C0::;
fixed-address 192.168.173.1;
option domain-name-servers 0.0.0.0;
option domain-name "";
}
####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" ####### # cat vmnet8/dhcpd.conf
# Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet8.
#
# This file was automatically generated by the VMware configuration program.
# See Instructions below if you want to modify it.
#
# We set domain-name-servers to make some DHCP clients happy
# (dhclient as configured in SuSE, TurboLinux, etc.).
# We also supply a domain name to make pump (Red Hat .x) happy.
# ###### VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" #####
# Modification Instructions: This section of the configuration file contains
# information generated by the configuration program. Do not modify this
# section.
# You are free to modify everything else. Also, this section must start
# on a new line
# This file will get backed up with a different name in the same directory
# if this section is edited and you try to configure DHCP again. # Written at: // ::
allow unknown-clients;
default-lease-time ; # default is minutes
max-lease-time ; # default is hours subnet 192.168.73.0 netmask 255.255.255.0 {
range 192.168.73.128 192.168.73.254;
option broadcast-address 192.168.73.255;
option domain-name-servers 192.168.73.2;
option domain-name localdomain;
default-lease-time ; # default is minutes
max-lease-time ; # default is hours
option netbios-name-servers 192.168.73.2;
option routers 192.168.73.2;
}
host vmnet8 {
hardware ethernet :::C0::;
fixed-address 192.168.73.1;
option domain-name-servers 0.0.0.0;
option domain-name "";
option routers 0.0.0.0;
}
####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" ####### # cat vmnet8/nat.conf
# VMware NAT configuration file [host] # NAT gateway address
ip = 192.168.73.2
netmask = 255.255.255.0 # VMnet device if not specified on command line
device = vmnet8 # Allow PORT/EPRT FTP commands (they need incoming TCP stream ...)
activeFTP = # Allows the source to have any OUI. Turn this on if you change the OUI
# in the MAC address of your virtual machines.
allowAnyOUI = # Controls if (TCP) connections should be reset when the adapter they are
# bound to goes down
resetConnectionOnLinkDown = # Controls if (TCP) connection should be reset when guest packet's destination
# is NAT's IP address
resetConnectionOnDestLocalHost = # Controls if enable nat ipv6
natIp6Enable = # Controls if enable nat ipv6
natIp6Prefix = fd15:4ba5:5a2b:::/ [tcp] # Value of timeout in TCP TIME_WAIT state, in seconds
timeWaitTimeout = [udp] # Timeout in seconds. Dynamically-created UDP mappings will purged if
# idle for this duration of time = no timeout, default = ; real
# value might be up to % longer
timeout = [netbios]
# Timeout for NBNS queries.
nbnsTimeout = # Number of retries for each NBNS query.
nbnsRetries = # Timeout for NBDS queries.
nbdsTimeout = [incomingtcp] # TCP 端口映射
# Use these with care - anyone can enter into your VM through these...
# The format and example are as follows:
#<external port number> = <VM's IP address>:<VM's port number>
# = 172.16.3.128: [incomingudp] # UDP 端口映射
# UDP port forwarding example
# = 172.16.3.0:
3.查找子网掩码和 dns 地址
mac ->系统偏好设置->网络->高级
NETMASK=255.255.254.0(子网掩码)
DNS1=172.19.160.145
DNS2=172.19.160.146
4.修改Centos7中ifcfg-xxx文件
vi /etc/sysconfig/network-scripts/ifcfg-ens33
增加或修改
BOOTPROTO="static",
IPADDR="172.19.163.11",
NETMASK="255.255.255.0",
DNS1="172.19.160.145",
DNS2="172.19.160.146",
GATEWAY="172.19.163.2",
ONBOOT="yes"
5.重启网络(失败reboot linux 重启 vmware)
service network restart