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

2

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?

javadba

Posted 2013-06-28T21:37:00.743

Reputation: 2 201

Answers

4

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

xpt

Posted 2013-06-28T21:37:00.743

Reputation: 5 548

Now you mention it, I recall having usd dnmasq in the past. I'll try that again. – javadba – 2013-07-01T18:59:55.107

good luck. feel free to pop back here for questions or comment on the blog. – xpt – 2013-07-02T16:19:21.517