一、 NAT模式网络访问
(1)在linux中输入命令ifconfig查看网络信息
(2)在mac中输入命令ifconfig查看网络信息
lo0: flags=<UP,LOOPBACK,RUNNING,MULTICAST> mtu
options=<RXCSUM,TXCSUM>
inet6 :: prefixlen
inet 127.0.0.1 netmask 0xff000000
inet6 fe80::%lo0 prefixlen scopeid 0x1
nd6 options=<PERFORMNUD>
gif0: flags=<POINTOPOINT,MULTICAST> mtu
stf0: flags=<> mtu
en0: flags=<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu
ether a4:5e::ec:ff:3f
inet6 fe80::a65e:60ff:feec:ff3f%en0 prefixlen scopeid 0x4
inet 192.168.199.185 netmask 0xffffff00 broadcast 192.168.199.255
nd6 options=<PERFORMNUD>
media: autoselect
status: active
en1: flags=<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu
options=<TSO4,TSO6>
ether 6a::::6a:e0
media: autoselect <full-duplex>
status: inactive
en2: flags=<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu
options=<TSO4,TSO6>
ether 6a::::6a:e1
media: autoselect <full-duplex>
status: inactive
p2p0: flags=<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu
ether :5e::ec:ff:3f
media: autoselect
status: inactive
awdl0: flags=<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu
ether 7a:d1:9a:f2:6c:
inet6 fe80::78d1:9aff:fef2:6c10%awdl0 prefixlen scopeid 0x8
nd6 options=<PERFORMNUD>
media: autoselect
status: active
bridge0: flags=<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu
options=<RXCSUM,TXCSUM,TSO4,TSO6>
ether a6:5e::ce:c0:
Configuration:
id ::::: priority hellotime fwddelay
maxage holdcnt proto stp maxaddr timeout
root id ::::: priority ifcost port
ipfilter disabled flags 0x2
member: en1 flags=<LEARNING,DISCOVER>
ifmaxaddr port priority path cost
member: en2 flags=<LEARNING,DISCOVER>
ifmaxaddr port priority path cost
nd6 options=<PERFORMNUD>
media: <unknown type>
status: inactive
vboxnet0: flags=<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu
ether 0a:::::
inet 192.168.56.2 netmask 0xffffff00 broadcast 192.168.56.255
vmnet1: flags=<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu
ether :::c0::
inet 192.168.227.1 netmask 0xffffff00 broadcast 192.168.227.255
vmnet8: flags=<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu
ether :::c0::
inet 172.16.53.1 netmask 0xffffff00 broadcast 172.16.53.255
发现多了两个vmnet1,vmnet8接口,玩过VMware的都知道这是虚拟网络,vmnet1是host-only的方式,vmnet8是NAT的方式。
(3)查看VMware Fusion配置
@webm ➜ ~ sudo more /Library/Preferences/VMware\ Fusion/networking
VERSION=,
answer VNET_1_DHCP yes
answer VNET_1_DHCP_CFG_HASH ****
answer VNET_1_HOSTONLY_NETMASK 255.255.255.0
answer VNET_1_HOSTONLY_SUBNET 192.168.227.0
answer VNET_1_VIRTUAL_ADAPTER yes
answer VNET_8_DHCP yes
answer VNET_8_DHCP_CFG_HASH ****
answer VNET_8_HOSTONLY_NETMASK 255.255.255.0
answer VNET_8_HOSTONLY_SUBNET 172.16.53.0
answer VNET_8_NAT yes
answer VNET_8_VIRTUAL_ADAPTER yes
(4)编辑System ech0网络,
选择IP4Settings
Method选择"Manual"
点击Add
ip地址: 172.16.53.100
netmask: 255.255.255.0
gateway: 172.16.53.2
(5)vi /etc/sysoconfig/network-scripts/ifcfg-eth0
添加一行 DNS1=172.16.53.2(网关地址)
(6) vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=yeahwell.abc.com
(6)vi /etc/hosts
文件尾添加一行 172.16.53.100 yeahwell.abc.com
service network restart
(7)网络断开并重新连接
(8)ping www.baidu.com