0

I am trying to set up the VMware DCHP server to push a static route (192.168.248.0/24 -> 192.168.248.129) to DHCP clients (VMs) connected to a custom interface called vmnet14. I referred to this document: https://fishilico.github.io/generic-config/etc-server/dhcp/dhcpd.conf.raw.html.

Config file is like this:

allow unknown-clients;
default-lease-time 1800;                # default is 30 minutes
max-lease-time 7200;                    # default is 2 hours

option rfc3442-classless-static-routes code 121 = array of integer 8;

subnet 192.168.248.128 netmask 255.255.255.224 {
    range 192.168.248.138 192.168.248.157;
    option broadcast-address 192.168.248.159;
    option domain-name-servers 192.168.248.129;
    option domain-name localdomain;
    option routers 192.168.248.129;
    option static-routes 192.168.248.0 192.168.248.129;
    option rfc3442-classless-static-routes 24, 192, 168, 248, 192, 168, 248, 225;
    default-lease-time 1800;                # default is 30 minutes
    max-lease-time 7200;                    # default is 2 hours
}
host vmnet14 {
    hardware ethernet XX:XX:XX:XX:XX:XX;
    fixed-address 192.168.248.129;
    option domain-name-servers 0.0.0.0;
    option domain-name "";
    option routers 0.0.0.0;
}

Then vmware-networks-server can no longer start.

Then I tried to debug by running:

sudo /usr/bin/vmnet-dhcpd \
  -cf /etc/vmware/vmnet14/dhcpd/dhcpd.conf \
  -lf /etc/vmware/vmnet14/dhcpd/dhcpd.leases \
  -pf /var/run/vmnet-dhcpd-vmnet14.pid \
  -f -d vmnet14

And I got:

Internet Software Consortium DHCP Server 2.0
Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.
All rights reserved.

Please contribute if you find this software useful.
For info, please visit http://www.isc.org/dhcp-contrib.html

/etc/vmware/vmnet14/dhcpd/dhcpd.conf line 26: no option named rfc3442-classless-static-routes
option rfc3442-classless-static-routes code 
       ^
/etc/vmware/vmnet14/dhcpd/dhcpd.conf line 36: no option named rfc3442-classless-static-routes
    option rfc3442-classless-static-routes 24,
        ^
Configuration file errors encountered -- exiting
exiting.

This post: Static route set from dhcp was close, but the answer only says "I have used it and it worked" but did not provide an example. The link it has also does not have an example like where to add those options.

2 Answers 2

2

The option ... code syntax was only introduced in ISC DHCP v3.0, but as the startup message says, ESXi provides ISC DHCP v2.0 which had no such feature. (And I would argue that it shouldn't have a DHCP server at all.)

In this version, unknown options are named option-XXX and always specified either as a quoted string or as series of bytes:

option option-121 0:c0:a8:f8:81:18:c0:a8:f8:c0:a8:f8:e1;

Here's a tool to generate the value.

Don't forget to include a 0/0 route, as option 121 supersedes the 'routers' option.

Older Windows versions used to expect option 249 instead of 121.

7
  • Thanks. I made a mistake when writing the question. The static route that I want should be "192.168.248.0/24 -> 192.168.248.129", not 225. 192.168.248.129 is the host IP on that VMnet, and the host can do the remaining forwarding. So the option should be option option-121 0:c0:a8:f8:81:18:c0:a8:f8:c0:a8:f8:81;.
    – Bolong
    Commented May 11 at 18:04
  • I also don't need 0:c0:a8:f8:81 this part, since this VMnet is not used for Internet access.
    – Bolong
    Commented May 11 at 18:04
  • I also added the option 249. Works for me now.
    – Bolong
    Commented May 11 at 18:05
  • In that case, you probably shouldn't have option routers either? Commented May 11 at 18:07
  • 1
    Not sure, but since it was defined by RFC 3442 in 2002 (WinXP follows the 2000 draft), and your ISC DHCP from 1999 literally predates its definition, I think it would be safe to assume that any OS of that age also won't support it. (Your easiest alternative is to advertise a netmask of 255.255.255.0 and to have the .129 gateway provide proxy-ARP responses for the hosts that aren't actually local – that was the traditional way before subnetting was invented.) Commented May 11 at 18:46
0

I ended up changing the config to this according to grawity-u1686's answer. Posting a complete version here for reference, and will explain it a bit.

allow unknown-clients;
default-lease-time 1800;                # default is 30 minutes
max-lease-time 7200;                    # default is 2 hours

subnet 192.168.248.128 netmask 255.255.255.224 {
    range 192.168.248.138 192.168.248.157;
    option broadcast-address 192.168.248.159;
    option domain-name-servers 192.168.248.129;
    option domain-name localdomain;
    option option-121 18:c0:a8:f8:c0:a8:f8:81;
    option option-249 18:c0:a8:f8:c0:a8:f8:81;
    default-lease-time 1800;                # default is 30 minutes
    max-lease-time 7200;                    # default is 2 hours
}
host vmnet14 {
    hardware ethernet XX:XX:XX:XX:XX:XX;
    fixed-address 192.168.248.129;
    option domain-name-servers 0.0.0.0;
    option domain-name "";
    option routers 0.0.0.0;
}

Don't forget to include a 0/0 route, as option 121 supersedes the 'routers' option.

I did not add this because I don't need a 0/0 route. Internet access was implemented by another VMnet interface. This one is only used for accessing local network. VM host has other routes that can ensure 192.168.248.0/24 destinations are routed to correctly through 192.168.248.225.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .