Classless DHCP Route Option 121 Calculator
This Python Generator Script is based on this GitHub Gist from [@TheTechromancer] (https://github.com/TheTechromancer).
The Default Gateway is added BEFORE all other entries, according to this other RFC3442 Generator.
The purpose of DHCP Option 121 or Classless DHCP Static Routing is to push the Static Routes definition from the DHCP Server to the DHCP Client.
In this way, all DHCP Clients automatically receive the Static Routes Table from the DHCP Server, thus avoiding the need to manually define (and maintain) Static Routes on each and every single one of your Devices.
A great technical explanation on how the DHCP Option 121 (according to RFC3442) is generated can be found on the OPNSense Forum.
Important Only ONE single entry of DHCP Option 121 must be entered into PFSense/OPNSense/etc DHCP Server.
Therefore make sure you add ALL the required networks/gateways in the array at the start of generator.py
before you generate your entry.
Clone the Repository:
git clone https://github.com/luckylinux/rfc3442-dhcp-option-121.git
cd rfc3442-dhcp-option-121
Copy the example routes.py.example
to routes.py
and using your preferred text editor enter all the required routes.
For instance using nano
:
# Copy example routes.py
cp routes.py.example routes.py
# Modify the file
nano routers.py
Now run the Generator:
# Make the File executable - Normally it should already be executable
chmod +x generator.py
# Run the Generator
./generator.py
(Feel free to submit a PR)
(Feel free to submit a PR)
(Feel free to submit a PR)
Several RFC3442 DHCP Option 121 Calculators / Generators can be found online.
A quick search on Google Points to some of them, which I list below. Note that, except the code from , NONE of this was tested by me !
- Javascript
- PERL
- Python