Skip to content

luckylinux/rfc3442-dhcp-option-121

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rfc3442-dhcp-option-121

Classless DHCP Route Option 121 Calculator

Introduction

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.

Purpose

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.

Technical Explanation

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.

Usage

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

Setup in your Router

OPNSense

image

PFSense

(Feel free to submit a PR)

Ubiquiti

(Feel free to submit a PR)

Mikrotik

(Feel free to submit a PR)

References and Existing Tools

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 !

About

Classless DHCP Route Option 121 Calculator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages