Skip to main content

A Python library to modify and alter the routing table in according to configuration passed

Project description

drawing

┻━┻ ︵ヽ(`Д´)ノ︵ ┻━┻


Dynamic Routing-table updater (DRU)

Example of reference.json

{
    "tableName": "direct",
    "adapter": [
        "enp1s0f0",
        "enp1s0f1"
    ]
}

tableName will be the table name the program will use to direct routes and rules against
adapter will be the interfaces you will split out from the main routing table

When you or the service starts up DRU, it will prepare the required data.
After the data has been loaded, it will be ready to start. All this occurs within the init call.

When DRU gets the start call, it will do the following:

  • Remove old DRU tables (based on the Table name passed)
  • Find all occupied table ids
  • Filter out occupied
  • Define table id and name for all network adapters added
  • Write the newly filtered and appended routing table

After DRU has started, and processed the routing table, it will start up DRUHook.
This is a sub component of DRU, which is intended to watch the network interfaces assigned to DRU and perform routing changes on them.

If you want to test DRU out, you can do the following

from DynamicRoutingUpdater import DynamicRoutingUpdater
service = DynamicRoutingUpdater()
service.dryrun()

NOTE! This WILL do modifications to your routing table!
This will also change and modify your current routes, and WILL NOT BE RESTORED!

Usually a reboot is enough to get it recreated, as the code does not include persistance

How to install

Dependencies

net-tools

To install and start DRU

  • Clone the project
  • Modify reference.json
  • ./install.sh

Make sure that you run the script with sudo or as root, as the script needs access.

Or you can do the following:

curl -sSL -o install.sh https://raw.githubusercontent.com/bskjon/DynamicRoutingUpdater/master/install.sh && sudo bash install.sh

This will request you to define table name and select interface thrould selection.


A copy of your routing table will exist as:
/etc/iproute2/rt_tables.bak

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydynamicroutingupdater-0.0.8.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

pyDynamicRoutingUpdater-0.0.8-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file pydynamicroutingupdater-0.0.8.tar.gz.

File metadata

File hashes

Hashes for pydynamicroutingupdater-0.0.8.tar.gz
Algorithm Hash digest
SHA256 fc227a3a21763ce47374b3756cbac644ea0637f74970a938f223311796e3a23e
MD5 131077c230a7a5be55f30bcaf122b11a
BLAKE2b-256 070ca036e0b49743fd060611e0029c938f986f7b0f3256ae3ff53b832ba24bb2

See more details on using hashes here.

File details

Details for the file pyDynamicRoutingUpdater-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for pyDynamicRoutingUpdater-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cb8bd46f8701180e198acce5049a6079e30e5caa5f6e69820e7e94eea4349c7f
MD5 0425e33230f17770fffbc7da094efad5
BLAKE2b-256 b571460fd938d3ab580c9efcae4396cdb74c99f6fbbc8fe01fa0c8ad64dbf9ca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page