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/iktdev-no/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.11.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydynamicroutingupdater-0.0.11-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydynamicroutingupdater-0.0.11.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pydynamicroutingupdater-0.0.11.tar.gz
Algorithm Hash digest
SHA256 c5f66e8802c129bab239be1c0f04571b8c311c909c5f5ad40b28196a5cb081f0
MD5 0086190afaa265628a90ddab37fbfef1
BLAKE2b-256 82543e6fef7b7d2d4fbaf3314947c454d4fa4e55ef19d24cc1d7b26afdc35ad3

See more details on using hashes here.

File details

Details for the file pydynamicroutingupdater-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for pydynamicroutingupdater-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 00cbd4a6c4a2ec7284fac92e4b275ff018f8f1eedbf2cd4402ccad8715a694c6
MD5 699e5f3672deea1578c847560d06586f
BLAKE2b-256 f413dfea560dea9ac987cee44cd91cfab4efc5fee8a456f1fedb5855ba9ae3d0

See more details on using hashes here.

Supported by

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