The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,173 other subscribers

APC 7xxx models, DHCP Option 43 and Mikrotik DHCP servers

Posted by jpluimers on 2017/06/07

When switching my DHCP to a Mikrotik CCR1009, both the AP7920 and AP7921 failed to get IP addresses. The APC7921 would look bounce between waiting and offered states like this:

The cause is the need of DHCP Option 43 (Vendor Class Identifier) specified in RFC2132 – based on [WayBack] RFC 2131 – Dynamic Host Configuration Protocol and [WayBackRFC 1533 – DHCP Options and BOOTP Vendor Extensions – which I found first via these links:

“Vendor specific cookie” means “DHCP Option 43” is set.

I then found more details in the ASTE-6Z6K56_R0_EN.pdf documentation:

DHCP. You can use a RFC2131/RFC2132-compliant DHCP server to configure the TCP/IP settings for the Switched Rack PDU.

This section briefly summarizes the Switched Rack PDU communication with a DHCP server. For more detail about how a DHCP server is used to configure the network settings for the Switched Rack PDU, see “DHCP Configuration” in the User’s Guide.

  1. The Switched Rack PDU sends a DHCP request that uses the following to identify itself:
    • Vendor Class Identifier (APC by default)
    • Client Identifier (by default, the Switched Rack PDU’s MAC address value)
    • User Class Identifier (by default, the identification of the Switched Rack PDU’s application firmware)
  2. A properly configured DHCP server responds with a DHCP offer that includes all of the settings that the Switched Rack PDU needs for network communication. The DHCP offer also includes the Vendor Specific Information option (DHCP option 43). By default, the Switched Rack PDU ignores DHCP offers that do not encapsulate the APC cookie in the Vendor Specific Information option using the following hexidecimal format:
         Option 43 = 01 04 31 41 50 43
    

    where
    – The first byte (01) is the code
    – The second byte (04) is the length
    – The remaining bytes (31 41 50 43) are the APC cookie

    See your DHCP server documentation to add code to the Vendor Specific Information option.

    To disable the APC cookie requirement, see “Local access to the control console” on page 10. To change the control console’s DHCP Cookie Is setting, an Advanced option in the TCP/IP menu, see “Remote access to the control console” on page 10.

It starts with a very simple Mikrotik command

Luckily the solution was this very simple Mikrotik command to add a DHCP Option:

/ip dhcp-server option add code=43 name=APC value=0x010431415043

From APC’s web site: Option 43 = 0x01 0x04 0x31 0x41 0x50 0x43

Source: problem with dhcp options on a APC ups – MikroTik RouterOS

What it does is add an Option 43 (with any name: apparently that works) with a hex value of the bytes that APC requires.

But then it still didn’t work, but Google Cache to the rescue via mikrotik 0x010431415043:

/ip dhcp-server
add address-pool=dhcp_pool3 disabled=no interface=ether19 lease-time=3d name=\
dhcp1 relay=192.168.168.1
/ip dhcp-server option
add code=43 name=APC value=0x010431415043
/ip dhcp-server lease
add address=192.168.168.2 dhcp-option=APC mac-address=00:C0:B7:74:54:E5
/ip dhcp-server network
add address=192.168.68.0/24 gateway=192.168.68.254
add address=192.168.168.0/24 dhcp-option=apc gateway=192.168.168.1

Source: MikroTik RouterOS (часть 4) – [386] :: В помощь системному администратору :: Компьютерный форум Ru.Board

What that does (and is not documented in the DHCP LEASE ptions) is force this specific lease to use the APC option that specifies code 43 with the correct value for APC Power Management Units.

Note that besides the actual leases, you can also apply the dhcp-option, for instance on the network level as explained by Mikrotik DHCP Option 43 Tutorial ~ Binary Heartbeat.

Another thing not in the documentation is that you can even assemble multiple DHCP-options into an dhcp-option-set and bind those at the same levels as a dhcp-option: lease or network.

I only want to have DHCP Option 43 for the APC devices and only have two of these devices, so configured them on the actual DHCP leases.

ARP stuffing

Later I found out I could have used ARP stuffing to force a specific known IP-address into it using the combination of setting that address in the ARP table and then pinging with a non-standard packet size of 113. This is specific to APC and explained at [WayBackEver heard of ARP Stuffing? Me neither. | VirtuallyMikeBrown. Many sites show the trick, but fail to explain it. This page shows the trick for Windows, Linux and Mac OS X: APC PDU configuration trick | Patrick Kremer.

After stuffing, you can reach the APC PDU at the stuffed address, then configure it further.

Resetting through serial

Finally, I could have manually configured the IP address or removed the DHCP Cookie Requirement over a serial connection. This is cumbersome and requires a serial to RJ-12 cable. Steps are at Configuring an APC AP7900 – AN!Wiki. If you don’t have the cable, you can easily make it based on the APC RJ12 serial cable pinout diagram @ pinouts.ru

Resetting to factory defaults

If I ever want to reset my AP7920 or AP7920, here is how:

  1. Press 15 seconds on reset button
  2. Let the reset button go for a second
  3. Press the reset button again for 2 seconds
  4. Use your serial terminal to continue the reset proceudre

via: APC Reset [Archief] – webhostingtalk.nl

Some interesting videos

Some of the above information and much more interesting tidbits (including a tear-down) are in these videos:

–jeroen

3 Responses to “APC 7xxx models, DHCP Option 43 and Mikrotik DHCP servers”

  1. Kelvin W said

    Great stuff, thank you.. This helped with the DHCP config on my Palo Alto and it finally picked up an IP!

  2. Muchas gracias, desde Mendoza, Argentina.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: