How to set static ip address on vmware for NAT guest vms from an ubuntu Host dhcp server?

6,060

If you don't have to fiddle with the special stuff for vmware, then I recommend installing your own DHCP server under your Ubuntu host. I believe that is what "see the man pages for your linux distribution" actually means.

Don't be afraid, installing your own DHCP server under your Ubuntu is super easy. You just need to install dnsmasq then use dnsmasq to provide to static ip addresses to NAT'ed guest vm's, and provide their static DNS domain name at the same time too. See

http://sfxpt.wordpress.com/2011/02/06/providing-dhcp-and-dns-services-with-dnsmasq/#Configure_Static_DHCP_IP_Addresses

for details.

Basically, all you need to specify are:

00:16:3e:00:00:01 natvm1 10.60.68.18
00:16:3e:00:00:02 natvm2 10.60.68.19

I.e., their MAC address, static DNS domain name, and static ip addresses, provided that you follow the instructions above.

HTH

Share:
6,060

Related videos on Youtube

WestCoastProjects
Author by

WestCoastProjects

R/python/javascript recently and before that Scala/Spark. Machine learning and data pipelines apps.

Updated on September 18, 2022

Comments

  • WestCoastProjects
    WestCoastProjects almost 2 years

    I need to configure various linux flavor NAT'ed guest vm's to have static ip addresses provided by the Ubuntu host.

    The vmware documentation punts on this topic, deferring to "see the man pages for your linux distribution". But the generic pages for "my linux distro" do not know about the special stuff for vmware e.g. vmnet8.

    Pointers from someone who just knows how to do this would be much appreciated.

    Here is the /etc/vmware/vmnet8/dhcpd/dhcpd.conf:

    allow unknown-clients;
    default-lease-time 1800;                # default is 30 minutes
    max-lease-time 7200;                    # default is 2 hours
    
    subnet 192.168.238.0 netmask 255.255.255.0 {
            range 192.168.238.128 192.168.238.254;
            option broadcast-address 192.168.238.255;
            option domain-name-servers 192.168.238.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 192.168.238.2;
            option routers 192.168.238.2;
    }
    host vmnet8 {
            hardware ethernet 00:50:56:C0:00:08;
            fixed-address 192.168.238.1;
            option domain-name-servers 0.0.0.0;
            option domain-name "";
            option routers 0.0.0.0;
    }
    

    Fromt the dhcpd.conf documentation, we are supposed to add an entry for static hosts similar to the following:

       host mystatichostonee
          {
          hardware ethernet 00:20:6B:C7:9B:E4;
          fixed-address 192.168.238.101;
          }
       host mystatichosttwo
          {
          hardware ethernet 00:23:7a:C7:9c:F2;
          fixed-address 192.168.238.102;
          }
    

    But notice that the vmnet8 entry in the vmware-generated dhcpd.conf already is set to fixed-address. I don't know how to add the specifics for my hosts to that vmnet8 entry: do they become nested?

  • xpt
    xpt almost 11 years
    good luck. feel free to pop back here for questions or comment on the blog.