Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@aelkz
Last active November 5, 2021 20:35
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aelkz/ae15e9b281ea2d8b0454ab86b21e84e9 to your computer and use it in GitHub Desktop.
Save aelkz/ae15e9b281ea2d8b0454ab86b21e84e9 to your computer and use it in GitHub Desktop.
How to setup your VMWare Fusion 11.0.1 images to use static IP addresses on Mac OS X (working w/ Mojave 10.14) for use w/ CentOS 7 and RHEL 7

This tutorial is based on the following:
https://medium.com/upinatoms-com/sharing-a-network-between-your-vmware-fusion-linux-guest-and-your-mac-os-x-host-70d98271f142

How to setup your VMWare Fusion images to use static IP addresses on Mac OS X

Working w/ CentOS 7 and RHEL 7 linux images.

Therefore this configuration don't require any changes inside linux guest VM as it network interfaces will continue using BOOTPROTO=dhcp

1. Check your current configuration for "host-only" networking:

sudo vim /Library/Preferences/VMware\ Fusion/vmnet1/dhcpd.conf

This will open the dhcp.conf w/ the default configuration created upon VMWare Fusion installation.

2. Select your guest that will use the static ip and add a new network adapter

Open the guest settings:

screen shot 2019-02-19 at 4 46 44 pm

Then, add a new "Network Adapter" device:
screen shot 2019-02-19 at 4 48 23 pm
screen shot 2019-02-19 at 4 49 22 pm
You'll end with 2 network adapters:
screen shot 2019-02-19 at 4 50 50 pm

3. Configure your network adapters

For the first network adapter, set as "Share with my Mac".
screen shot 2019-02-19 at 4 55 01 pm
For the second one, set as "Private to my Mac"
screen shot 2019-02-19 at 4 56 49 pm

4. Extract the MAC address from the second Network Adapter

cat /Users/{YOUR-USER}/Virtual\ Machines.localized/{YOUR-VM-IMAGE}.vmwarevm/{YOUR-VM-IMAGE}.vmx | grep "ethernet0.generatedAddress ="

This will output something like this:
ethernet0.generatedAddress = "00:0D:23:5B:A1:F1"

copy this address to the clipboard as will be used in the next steps.

5. Choose a valid IP OUTSIDE the range returned by the following command:

grep range /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf

This will output something like:
range 172.16.201.128 172.16.201.254;

PS. Your guest VM must use a IP address that is outside from this range!

6. Add the following configuration at the end of the file

sudo vim /Library/Preferences/VMware\ Fusion/vmnet1/dhcpd.conf

Add the following at the end of the file:

####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
host rhsso-host-01 {
    hardware ethernet 00:0D:23:5B:A1:F1;
    fixed-address  192.168.243.21; # this is the network provided after installation. Could be different in your host
    option domain-name-servers 8.8.8.8, 8.8.4.4;
}

PS. Note that the guest will be configured to use the google DNS for resolution.
PS2. The host name will be the same as your guest image name without spaces!

7. Set the configuration and restart the services

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --configure
sudo /Applications/VMware\ Fusion.app/Contents/Library/services/services.sh --stop
sudo /Applications/VMware\ Fusion.app/Contents/Library/services/services.sh --start

8. Start the guest VM

screen shot 2019-02-19 at 5 10 39 pm

9. DONE!

Voila! Now you can access WAN from guest VM and also SSH from host to guest.

APPENDIX A - Modify the default VMWare vmnet1 (subnet) address

If you want to change the default subnet .243 for .100 (for example):

1. Change the file:

sudo vim /Library/Preferences/VMware\ Fusion/vmnet1/dhcpd.conf

2. Change every occurrence to your desired subnet:

Example:
Change subnet 192.168.243.0 to subnet 192.168.100.0

PS. Override every occurrence in the file.

3. Change the file:

sudo vim /Library/Preferences/VMware\ Fusion/networking

And replace the following line:
answer VNET_1_HOSTONLY_SUBNET 192.168.243.0
to
answer VNET_1_HOSTONLY_SUBNET 192.168.100.0

4. Reload configurations

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --configure
sudo /Applications/VMware\ Fusion.app/Contents/Library/services/services.sh --stop
sudo /Applications/VMware\ Fusion.app/Contents/Library/services/services.sh --start

5. Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment