Skip to main content

Uncomplicated Port Forwarder (UPF)

Project description

Uncomplicated Port Forwarder (UPF)

Uncomplicated Port Forwarder (UPF) is a simple command-line tool to manage port forwarding rules using iptables. It supports both TCP and UDP protocols, making it easy to set up port forwarding for specific ports or ranges of ports.

Installation

pip install upf

Run the script with sudo for administrative privileges (required to modify iptables).

Usage

Add a Single Port Forwarding Rule

Add a port forwarding rule from a host to a remote IP and port.

TCP (default)

sudo upf add <remote-ip> <host-port>:<remote-port>

Example:

sudo upf add 192.168.0.2 2200:22

UDP

sudo upf add <remote-ip> <host-port>:<remote-port> --udp

Example:

sudo upf add 192.168.0.2 2200:22 --udp

Add a Range of Port Forwarding Rules

Add a range of port forwarding rules for a subnet starting from a specified port.

TCP (default)

sudo upf add-range <gateway>/<subnet> <starting-port>

Example:

sudo upf add-range 192.168.0.1/24 2200

UDP

sudo upf add-range <gateway>/<subnet> <starting-port> --udp

Example:

sudo upf add-range 192.168.0.1/24 2200 --udp

List All Managed Port Forwarding Rules

List all the port forwarding rules that have been added using UPF.

sudo upf list

Delete a Specific Port Forwarding Rule

Delete a specific port forwarding rule by host port.

TCP (default)

sudo upf delete <host-port>

Example:

sudo upf delete 2200

UDP

sudo upf delete <host-port> --udp

Example:

sudo upf delete 2200 --udp

Notes

  • Persistence: By default, changes made using iptables are not persistent after reboot. To make them persistent, you can save the rules using iptables-save and restore them with iptables-restore.

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

upf-0.1.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

upf-0.1.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file upf-0.1.1.tar.gz.

File metadata

  • Download URL: upf-0.1.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.10 Darwin/24.1.0

File hashes

Hashes for upf-0.1.1.tar.gz
Algorithm Hash digest
SHA256 be0eff1d05793878211660a0b9c6c1e3b34a7aafb41602029f6bc36daced5ce9
MD5 f08a3d0cd4356525bb53e5a2c1f741ad
BLAKE2b-256 4bac9f08801c8c44fb43d9c1acf5e3dffe65d830906d73368cacf4ace643f051

See more details on using hashes here.

File details

Details for the file upf-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: upf-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.10 Darwin/24.1.0

File hashes

Hashes for upf-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 78309544b4b55d0d9dd0c75114ab44702c6dc429128ef49184fa9bf450511493
MD5 04b5bce80fc70c62f26b570a5fb08d74
BLAKE2b-256 08c87ab71720cb0ff42e73890a8059822806d2698a5c347775c6512be33fec7b

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