VMware Communities
DaveHirsch
Contributor
Contributor
Jump to solution

[Advanced] Is it possible to set the default gateway IP for a NAT vmnet?

I'm trying to replicate a computer lab environment on my Mac, and I need the gateway to be located at an address other than the one that VMWare wants to set up.  I know how to create a static IP for a VM, but I need to adjust the option routers setting in /Library/Preferences/VMWare Fusion/vmnet2/dhcpd.conf.  Is there a setting in /Library/Preferences/VMWare Fusion/networking to allow this?  Is there something I can put before or after the "DO NOT MODIFY" section of dhcpd.conf that will override the settings within that section?

Barring that, is there a way to prevent VMWare from re-writing the dhcpd.conf file after I make a change?  I've tried fooling it in various ways, including re-generating the SHA1 hash in the networking file and resetting the modification time of the dhcpd.conf to the original time, without success.

Here are my current settings:

subnet 10.10.0.0 netmask 255.255.0.0 {

    range 10.10.128.0 10.10.255.254;

    option broadcast-address 10.10.255.255;

    option domain-name-servers 10.10.0.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 10.10.0.2;

    option routers 10.10.0.2;

}

host vmnet2 {

    hardware ethernet 00:50:56:C0:00:02;

    fixed-address 10.10.0.1;

    option domain-name-servers 0.0.0.0;

    option domain-name "";

    option routers 0.0.0.0;

}

And I'm trying to change the gateway from 10.10.0.2 to 10.10.1.250.  Maybe VMWare requires that the first IP be the host and the second be the gateway, and re-writes it if not?

Thanks in advance,

Dave

Reply
0 Kudos
1 Solution

Accepted Solutions
DaveHirsch
Contributor
Contributor
Jump to solution

I've found a way to do this.  Not sure if it's official, or if it will continue to work into the future.  In addition to the nat.conf modification, if you just duplicate the part of the "DO NOT MODIFY" section of dhcpd.conf below it, then the second version of the settings will supersede the first.  Here is my solution:

# 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: 04/11/2015 21:15:15

allow unknown-clients;

default-lease-time 1800;                # default is 30 minutes

max-lease-time 7200;                    # default is 2 hours

subnet 10.10.0.0 netmask 255.255.0.0 {

    range 10.10.128.0 10.10.255.254;

    option broadcast-address 10.10.255.255;

    option domain-name-servers 10.10.0.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 10.10.0.2;

    option routers 10.10.0.2;

}

host vmnet2 {

    hardware ethernet 00:50:56:C0:00:02;

    fixed-address 10.10.0.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" #######

subnet 10.10.0.0 netmask 255.255.0.0 {

    range 10.10.128.0 10.10.255.254;

    option broadcast-address 10.10.255.255;

    option domain-name-servers 10.10.1.200;

    default-lease-time 1800;                # default is 30 minutes

    max-lease-time 7200;                    # default is 2 hours

    option netbios-name-servers 10.10.1.250;

    option routers 10.10.1.250;

}


-Dave

View solution in original post

Reply
0 Kudos
3 Replies
a_p_
Leadership
Leadership
Jump to solution

Welcome to the Community,

please take a look at https://coderwall.com/p/mjbryq/change-vmware-fusion-6-nat-ip-space to see whether changing the nat.conf works.

André

Reply
0 Kudos
DaveHirsch
Contributor
Contributor
Jump to solution

Thanks, Andre, but that does not work.  The nat.conf file gets rewritten, just as the dhcpd.conf file does.  Changes made to the NAT gateway in nat.conf are overwritten when VMWare launches.

-Dave

Reply
0 Kudos
DaveHirsch
Contributor
Contributor
Jump to solution

I've found a way to do this.  Not sure if it's official, or if it will continue to work into the future.  In addition to the nat.conf modification, if you just duplicate the part of the "DO NOT MODIFY" section of dhcpd.conf below it, then the second version of the settings will supersede the first.  Here is my solution:

# 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: 04/11/2015 21:15:15

allow unknown-clients;

default-lease-time 1800;                # default is 30 minutes

max-lease-time 7200;                    # default is 2 hours

subnet 10.10.0.0 netmask 255.255.0.0 {

    range 10.10.128.0 10.10.255.254;

    option broadcast-address 10.10.255.255;

    option domain-name-servers 10.10.0.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 10.10.0.2;

    option routers 10.10.0.2;

}

host vmnet2 {

    hardware ethernet 00:50:56:C0:00:02;

    fixed-address 10.10.0.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" #######

subnet 10.10.0.0 netmask 255.255.0.0 {

    range 10.10.128.0 10.10.255.254;

    option broadcast-address 10.10.255.255;

    option domain-name-servers 10.10.1.200;

    default-lease-time 1800;                # default is 30 minutes

    max-lease-time 7200;                    # default is 2 hours

    option netbios-name-servers 10.10.1.250;

    option routers 10.10.1.250;

}


-Dave

Reply
0 Kudos