VMware Fusion 设置VMnets

作者: 分类: 默认分类 时间: 2017-03-14 评论: 暂无评论

macOS Sierra 10.12.2
VMware Fusion 专业版 8.5.2 (4635224)

下个月就是铁三的企业赛了,也拿到了企业赛的样题,给了三个虚拟机,拓扑如下:

t3sec.png

三个虚拟机需要配置VMnet2VMnet3以模拟外网的Web服务器和内网的AD服务器。如果在Windows上的VMware Workstation,直接虚拟机网络编辑器里新建一下就可以了,但是在macOS上使用的VMware Fusion却没有相应的功能。这个问题让我折腾了一晚上。

此处以新建Host OnlyVMnet2为例,步骤如下:

  1. 进到/Library/Preferences/VMware Fusion目录下,有如下文件:

     -r--r--r--  1 root  wheel   31  3 14 16:28 lastLocationUsed
     -rw-r--r--  1 root  wheel  547  8  7  2016 license-fusion-80-e3-201505
     -rw-r--r--  1 root  wheel  774  3 14 16:28 networking
     -rw-r--r--  1 root  wheel  774  3 14 16:26 networking.bak.0
     drwxr-xr-x  4 root  wheel  136  8 13  2016 vmnet1
     drwxr-xr-x  7 root  wheel  238 12 12 19:05 vmnet8
    
  2. 复制vmnet1文件夹到vmnet2

     sudo cp -R vmnet1 vmnet2
     
    
  1. 打开编辑vmnet2/dhcpd.conf,修改subnethardware ethernethost vmnet2

     # Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet2.
     #
     # 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: 03/14/2017 16:28:20
     allow unknown-clients;
     default-lease-time 1800;                # default is 30 minutes
     max-lease-time 7200;                    # default is 2 hours
     
     subnet 192.168.50.0 netmask 255.255.255.0 {
         range 192.168.50.128 192.168.50.254;
         option broadcast-address 192.168.50.255;
         option domain-name-servers 192.168.50.1;
         option domain-name localdomain;
         default-lease-time 1800;                # default is 30 minutes
         max-lease-time 7200;                    # default is 2 hours
     }
     host vmnet2 {
         hardware ethernet 00:50:56:C0:00:02;
         fixed-address 192.168.50.1;
         option domain-name-servers 0.0.0.0;
         option domain-name "";
     }
     ####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
    
  2. 编辑networking文件,复制vmnet1除了hash(Fusion运行后会自动生成)那一行外的其他行,并改成vnet_2,并修改相应的subnet

     VERSION=1,0
     answer VNET_1_DHCP yes
     answer VNET_1_DHCP_CFG_HASH 44F249DB802B30A43EF0419917C9221A00062DD1
     answer VNET_1_HOSTONLY_NETMASK 255.255.255.0
     answer VNET_1_HOSTONLY_SUBNET 172.16.66.0
     answer VNET_1_VIRTUAL_ADAPTER yes
     answer VNET_2_DHCP yes
     answer VNET_2_HOSTONLY_NETMASK 255.255.255.0
     answer VNET_2_HOSTONLY_SUBNET 192.168.50.0
     answer VNET_2_VIRTUAL_ADAPTER yes
     answer VNET_8_DHCP yes
     answer VNET_8_DHCP_CFG_HASH 45EDA6BACAF6B7103EE36B3757D1A39A82BA7EF1
     answer VNET_8_HOSTONLY_NETMASK 255.255.255.0
     answer VNET_8_HOSTONLY_SUBNET 192.168.160.0
     answer VNET_8_NAT yes
     answer VNET_8_VIRTUAL_ADAPTER yes
     add_nat_portfwd 8 tcp 8084 192.168.160.215 8084
     add_bridge_mapping en5 2
     add_bridge_mapping en0 3
    
  3. 运行Fusion,即可在网卡选项里找到vmnet2了。

完工,这下可以来耍耍铁三的企业赛了。

标签: Fusionvmnet

声明:文章基本原创,允许转载,但转载时必须以超链接的形式标明文章原始出处及作者信息。

添加新评论