Advanced Networking Configuration - Tokamak Networking Scripts for VMware Fusion

    VM@Work Tokamak 2.0.0

    Network Utility

    Dave Parsons

    1.0    Introduction

    1.1 Background

    These scripts replace the default network configuration processing for  VMware Fusion. New features are made available that match those found in  the other hosted VMware products, such as Workstation and Server. The  new capabilities introduced by these scripts are based on the  functionality provided by VMware Workstation 6.0 for Linux. This  includes the capability of:

     

    • Adding new vmnets
    • Deleting vmnets
    • Modifying connection types: e.g. bridged, hostonly, nat
    • Changing IP addresses
    • Changing the physical interface used for bridged connections

     

    Reference material for the use of this software can be found in  documentation for the network configuration scripts for VMware  Workstation 6.0 for Linux. This is available online at the VMware web  site, and can also be downloaded in PDF format. Questions can be asked  at the VMware Communities in the Fusion forum, and also check out the  search facility to see if the question has been answered before.

     

     

    The code is copyrighted Dave Parsons and also contains copyrighted  VMware code. I must please ask that you do not re-post the code or  modify without consulting me first. VMware kindly gave me explicit  permission to re-distribute their code. I am happy to take feedback and  any patches that may be useful to others.

     

     

    1.2 What's New?

    VersionFeature
    2.0.0Fixed scripts to work on Fusion 1.1.3 and 2.0.0.
    1.0.3New "reapply" command to re-apply current settings.
    1.0.2Fixed issues where daemons stopped due to incorrect start/stop order.
    1.0.1Private test version.
    1.0.0Initial version.


    2.0    Getting Started

    2.1 System Requirements

    The current release of the VM@Work Tokamak scripts have been tested with the following releases of VMware Fusion:

     

    • VMware Fusion 1.0.0 (build 51348)
    • VMware Fusion 1.1.0 (build 62573)
    • VMware Fusion 1.1.1 (build 72241)
    • VMware Fusion 1.1.2 (build 87978)
    • VMware Fusion 1.1.3 (build 94249)
    • VMware Fusion 2.0.0 (build 116369)

     

    Versions of Mac OS X were used during testing include:

     

    • Leopard
    o    10.5.4
    o    10.5.5

    Also you will need to be comfortable using the terminal to run bash and  Perl scripts, plus running with root privileges. Running as root can be  accomplished either with the "sudo" command or enabling the root  account. The commands shown do not shown sudo on the command line for  brevity.

     

    2.2 Installation

    Close VMware Fusion before doing any network changes!

     

    Decompress the archive into a folder using Finder or the Terminal "gzip"  command. Now all operations need to be carried out either using sudo or  root account, as we will be modifying files owned by root. We need to  setup the system to use the scripts as well as backup the existing  configuration files. Open installation folder in the console and run the  following command:

     

     

    ./tokamak.sh --install

     

     

    You will get output similar to this, although there may be differences  due to IP addresses and other machine specific network settings.

     

    When the network settings are displayed, the script pauses for you to view the information. Press the "Esc" key to continue.

     

     

    VM@Work Tokamak 2.0.0: Installer started

     

    VM@Work Tokamak 2.0.0: Stop daemons and kexts

     

    VM@Work Tokamak 2.0.0: Create backup folder

     

    VM@Work Tokamak 2.0.0: Save original files

     

    VM@Work Tokamak 2.0.0: Set boot script

     

    You have already setup networking.

     

     

    Would you like to skip networking setup and keep your old settings as they are?

     

    (yes/no)

    yes

     

    VM@Work Tokamak 2.0.0: Display settings

     

    The following virtual networks have been defined:

     

     

    . vmnet1 is a host-only network on private subnet 192.168.48.0.

     

    . vmnet8 is a NAT network on private subnet 192.168.197.0.

     

     

    VM@Work Tokamak 2.0.0: Extended network scripting - Dave Parsons

     

    Host-only/NAT networking on vmnet1 using

    192.168.48.1/255.255.255.0 is running

     

    DHCP server on vmnet1 is running

     

    Host-only/NAT networking on vmnet8 using

    192.168.197.1/255.255.255.0 is running

     

    DHCP server on vmnet8 is running

     

    NAT networking on vmnet8 is running

     

    VM@Work Tokamak 2.0.0: Installer completed

     

     

    During the installation existing network configuration is maintained,  and a backup is stored in the "backup" folder. When uninstalling the  software, your original files and network settings will be restored.

     

     

    The main script is called "tokamak.sh" and has a variety of options:

     

     

    VM@Work Tokamak 2.0.0

     


    Usage: ./tokamak.sh {--install|--uninstall|--reinstall|--modify|--reset|--reapply|--display}

    --install   - setup the Tokamak replacement scripts and configure networks

    --uninstall - remove the Tokamak replacement scripts and reset networks

    --reinstall - reset and reinstall Tokamak

    --modify    - modify networks

    --reset     - reset and reconfigure networks

    --reapply   - reapply current configuration

    --display   - display current network settings

     

     

     

    3.0    Configuring Network

    The network configuration is modified using the "tokamak.sh" command.  Again this operation must be done with root privileges.

     

    ./tokamak.sh --modify

     

     

    This will take you through the configuration of the network settings. At  the end of the re-configuration the Fusion network components will be  restarted. In this sample I am re-configuring the vmnet1 and vmnet8 IP  addresses used.

     

     

    You have already setup networking.

     

     

    Would you like to skip networking setup and keep your old settings as they are?

     

    (yes/no)

    yes

    n

     

    Do you want networking for your virtual machines? (yes/no/help)

    yes

    y

     

    Would you prefer to modify your existing networking configuration using the

     

    wizard or the editor? (wizard/editor/help)

    wizard

    e

     

    The following virtual networks have been defined:

     

     

    . vmnet1 is a host-only network on private subnet 192.168.48.0.

     

    . vmnet8 is a NAT network on private subnet 192.168.197.0.

     

     

    Do you wish to make any changes to the current virtual networks settings?

     

    (yes/no)

    no

    y

     

    Which virtual network do you wish to configure? (0-99)

    1

     

    The network vmnet1 has been reserved for a host-only network.  You may  change it, but it is highly recommended that you use it as a host-only  network.  Are you sure you want to modify it? (yes/no)

    no

    y

     

    What type of virtual network do you wish to set vmnet1?

     

    (bridged,hostonly,nat,none)

    hostonly

    h

     

    Configuring a host-only network for vmnet1.

     

     

    The host-only network is currently configured to use the private subnet

     

    192.168.48.0/255.255.255.0.  Do you want to keep these settings?

    yes

    n

     

    Do you want this program to probe for an unused private subnet? (yes/no/help)

    yes

    n

     

    What will be the IP address of your host on the private network?

    172.16.1.1

     

    What will be the netmask of your private network?

    255.255.255.0

     

    The following virtual networks have been defined:

     

     

    . vmnet1 is a host-only network on private subnet 172.16.1.0.

     

    . vmnet8 is a NAT network on private subnet 192.168.197.0.

     

     

    Do you wish to make additional changes to the current virtual networks settings?

     

    (yes/no)

    yes

    y

     

    Which virtual network do you wish to configure? (0-99)

    8

     

    The network vmnet8 has been reserved for a NAT network.  You may change  it, but it is highly recommended that you use it as a NAT network.  Are  you sure you want to modify it? (yes/no)

    no

    y

     

    What type of virtual network do you wish to set vmnet8?

     

    (bridged,hostonly,nat,none)

    nat

    n

     

    Configuring a NAT network for vmnet8.

     

     

    The NAT network is currently configured to use the private subnet

     

    192.168.197.0/255.255.255.0.  Do you want to keep these settings?

    yes

    n

     

    Do you want this program to probe for an unused private subnet? (yes/no/help)

     

    yes

    n

     

    What will be the IP address of your host on the private network?

    172.16.8.1

     

    What will be the netmask of your private network?

    255.255.255.0

     

    The following virtual networks have been defined:

     

     

    . vmnet1 is a host-only network on private subnet 172.16.1.0.

     

    . vmnet8 is a NAT network on private subnet 172.16.8.0.

     

     

    Do you wish to make additional changes to the current virtual networks settings?

     

    (yes/no)

    yes

    n

     

    VM@Work Tokamak 2.0.0: Display settings

     

    The following virtual networks have been defined:

     

     

    . vmnet1 is a host-only network on private subnet 172.16.1.0.

     

    . vmnet8 is a NAT network on private subnet 172.16.8.0.

     

     

    VM@Work Tokamak 2.0.0: Extended network scripting - Dave Parsons

     

    Host-only/NAT networking on vmnet1 using

    172.16.1.1/255.255.255.0 is running

     

    DHCP server on vmnet1 is running

     

    Host-only/NAT networking on vmnet8 using

    172.16.8.1/255.255.255.0 is running

     

    DHCP server on vmnet8 is running

     

    NAT networking on vmnet8 is running

     

     

    There are many other things possible.

     

     

     

    Do NOT remove the vmnet0, vmnet1 and vmnet8 adapters. Doing so will  cause the VMware daemons for networking to fail. It is OK to change the  IP addresses.

     

     

    4.0    Modify Guest VMX File

    If you have added network adapters other than the defaults, which Fusion  currently uses, you will need to edit the VMX file held in the  "vmwarevm" package. To edit the VMX file, you can show the package  contents in Finder, and edit using your favourite text editor.  Alternatively use Eric Tung's VMX Extras editor. It can be found at:

     

    http://communities.vmware.com/thread/92087

     

     

    Once you have the file open you can then start adding parameters. For  example if you have defined vmnet3, add these statements to the VMX  file. Save and close the file, then fire up Fusion and check that the  networking has worked.

     

     

    ethernet1.present = "TRUE"

     

    ethernet1.connectionType = "custom"

     

    ethernet1.vnet = "VMnet3"

     

     

    Picture of VMX editor:

     

     



    5.0    Uninstallation

    To remove and rollback the settings to the original configuration run the following:

    ./tokamak.sh --uninstall

    The original VMware Fusion settings will be restored and the network  configuration reset to settings in place before Tokamak was used.

    6.0    Other Options

    There are several other options that can be used with the main script.

    • reinstall - is the equivalent of uninstall plus install
    • reapply - reapplies the current custom settings
    • reset - useful if you have a configuration you are not happy with.  It wipes out the current configuration database and then runs the modify  function to re-configure the networks
    • display - display current network settings and status of daemons. Some sample output is shown


    VM@Work Tokamak 2.0.0: Display settings
    The following virtual networks have been defined:

    . vmnet1 is a host-only network on private subnet 172.16.1.0.
    . vmnet8 is a NAT network on private subnet 172.16.8.0.

    VM@Work Tokamak 2.0.0: Extended network scripting - Dave Parsons
    Host-only/NAT networking on vmnet1 using 172.16.1.1/255.255.255.0 is running
    DHCP server on vmnet1 is running
    Host-only/NAT networking on vmnet8 using 172.16.8.1/255.255.255.0 is running
    DHCP server on vmnet8 is running
    NAT networking on vmnet8 is running

    7.0    Acknowledgements


    Thanks to Pat Lee, the Fusion Product Manager at VMware, for giving me the permission to re-distribute the modified code.


    Thanks to Paul Rockwell for investigating and merging in the changes from Fusion 2.


    Thanks to ActiveState for the great Komodo IDE product that makes debugging simple.


    Finally thanks to the VMware Fusion team for a great product.


    Contact details:
    VMware Forums: DaveP
    Web site: www.daveparsons.net