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
iptablesare not persistent after reboot. To make them persistent, you can save the rules usingiptables-saveand restore them withiptables-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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be0eff1d05793878211660a0b9c6c1e3b34a7aafb41602029f6bc36daced5ce9
|
|
| MD5 |
f08a3d0cd4356525bb53e5a2c1f741ad
|
|
| BLAKE2b-256 |
4bac9f08801c8c44fb43d9c1acf5e3dffe65d830906d73368cacf4ace643f051
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78309544b4b55d0d9dd0c75114ab44702c6dc429128ef49184fa9bf450511493
|
|
| MD5 |
04b5bce80fc70c62f26b570a5fb08d74
|
|
| BLAKE2b-256 |
08c87ab71720cb0ff42e73890a8059822806d2698a5c347775c6512be33fec7b
|