mac vmware fusion10 nat 模式网络配置

  • Post author:
  • Post category:其他


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=1,0
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 6.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: 09/12/2015 09:53:53
allow unknown-clients;
default-lease-time 1800;                # default is 30 minutes
max-lease-time 7200;                    # default is 2 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 1800;                # default is 30 minutes
        max-lease-time 7200;                    # default is 2 hours
}
host vmnet1 {
        hardware ethernet 00:50:56:C0:00:01;
        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 6.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: 09/12/2015 09:53:53
allow unknown-clients;
default-lease-time 1800;                # default is 30 minutes
max-lease-time 7200;                    # default is 2 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 1800;                # default is 30 minutes
        max-lease-time 7200;                    # default is 2 hours
        option netbios-name-servers 192.168.73.2;
        option routers 192.168.73.2;
}
host vmnet8 {
        hardware ethernet 00:50:56:C0:00:08;
        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 = 1
 
 
# Allows the source to have any OUI.  Turn this on if you change the OUI
# in the MAC address of your virtual machines.
allowAnyOUI = 1
 
 
# Controls if (TCP) connections should be reset when the adapter they are
# bound to goes down
resetConnectionOnLinkDown = 1
 
 
# Controls if (TCP) connection should be reset when guest packet's destination
# is NAT's IP address
resetConnectionOnDestLocalHost = 1
 
 
# Controls if enable nat ipv6
natIp6Enable = 0
 
 
# Controls if enable nat ipv6
natIp6Prefix = fd15:4ba5:5a2b:1008::/64
 
 
[tcp]
 
 
# Value of timeout in TCP TIME_WAIT state, in seconds
timeWaitTimeout = 30
 
 
[udp]
 
 
# Timeout in seconds. Dynamically-created UDP mappings will purged if
# idle for this duration of time 0 = no timeout, default = 60; real
# value might be up to 100% longer
timeout = 60
 
 
[netbios]
# Timeout for NBNS queries.
nbnsTimeout = 2
 
 
# Number of retries for each NBNS query.
nbnsRetries = 3
 
 
# Timeout for NBDS queries.
nbdsTimeout = 3
 
 
[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>
#8080 = 172.16.3.128:80
 
 
[incomingudp]
 
# UDP 端口映射
# UDP port forwarding example
#6000 = 172.16.3.0:6001


View Code


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

转载于:https://www.cnblogs.com/yuanpeng-java/p/9407980.html