Sonar DHCP Batcher

I’ve built a new tool for people running dynamic DHCP on their networks. There’s a video at https://sonar.software/casts/provisioning-school/sonar-dhcp-batcher-and-option-82 and it’s available for download at https://github.com/sonarsoftware/dhcp_batcher.

This accomplishes two things - batches DHCP requests together for better scalability, and utilizing Option 82 on supported equipment to allow IP assignment through bridged CPE. Check out the video for more details.

This requires Sonar 1.4.31 to function.

2 Likes

Is SONAR planning an IPv6 implementation of this?

  • Option 37 is the IPv6 equivalent from what I’ve read.

Not opposed to it if someone has a test bed or recommended equipment, I’m not sure I have any gear that supports that right now.

I guess I’m a little ahead of myself.
Mikrotik’s implementation of IPv6 is still a little behind and I cant find any documentation supporting this option on it. Guess we will table this issue for the future.

Thanks Simon!

It’s a cool idea, I hope it takes off.

1 Like

Can the same username & password be used for all dhcp servers? i.e. do we need to have a defined DHCP server in the batcher for each DHCP server in the network or is a single common one OK?

Common one is fine if you don’t care.

Following the setup guide on ubuntu, I get this when testing a submission from mikrotik:

failure: closing connection: <422 Unprocessable Entity> ip address:80 (4)

If I manually create a POST request with JSON it works, though the main page gives a 500 error until the requests are all flushed to Sonar.

I’ll check out the main page. Is it otherwise working?

No, it doesn’t work when attempting to create a lease via GET, either manually or on mikrotik.

Can you share your GET?

I figured it out and made a pull request to fix the readme.

1 Like

The main page being broken when a lease is pending is fixed, it was a microsecond precision issue in PHP 7.0. It’s fixed in 7.1, but I’m just going to remove the microsecond portion of it so PHP 7.0 can be easily supported.

1 Like

Having issues getting this operable. I have followed the instructions to the letter and when I try the test commands from the MT I get a <401 Unauthorised> response from the DHCP batcher. The loggs “larevel” show nothing. I can ping back and forth between the MT and the DHCP batcher, no communications issues. I have validated the username and password created in the DHCP Batcher. Not sure what is the cause here. I have reached out to Sonar Support and the person I spoke with indicated he was not that familiar and to get SONAR my SSH credentials to get in and take a look. I emailed those of in creating a ticket and not a word (Support closed for the day)… If anyone has any input I would greatly appreciate it.

UPDATE - By deleteing and re-creating the DHCP server in the Batcher its now passing the MT CLI test (at least its not saying unauthorized anymore) it pulls a status:finished downloaded and duration values. But I do NOT see anything in my assigments in Sonar when I actually use the MT DHCP Server.

UPATE ROUND 2 - So I finally got the DHCP Batcher to function by adding another DHCP server and new password etc. That works for about 10 to 60 minutes then without changing anything the batcher stops functioning. My MT DHCP server is all of a sudden “unauthorized” if i create yet another entry it works again for a bit then breaks again with unauthorized. What the?

Any ideas please?

We have just set up Batcher with an Mikrotik. The Mikrotik script test works as well as the Batcher to Sonar test but we do not see any IP data in Sonar. I have attached a an inventory item. I can assign an IP to the customer and it shows in the MT lease table. I just cannot figure out how to trace the issue.

Check the logs in the batcher, you can also turn on provisioning logging inside Sonar to get more visibility. Hit up support if you can’t make any progress, they are used to helping troubleshoot it!

Exactly what I did and found the issue, thank you. Now I need to find out why the MT DHCP script is not firing…

Sometimes removing the comments can help, if you left them in there.

Perfect! Thank you.

Can the Mikotik only insert Option 82 when used as a DHCP relay? We can’t see any option 82 information from any devices with Option 82 enabled and using MT as DHCP server.