PortGate

Expose local servers to the internet using UPnP/NAT-PMP without Serveo, Ngrok or tunnels

Python 3.8+
MIT License
PyPI
pip install portgate && portgate 8000
Windows Installation Guide View on GitHub

See PortGate in action - from installation to port forwarding in seconds

Terminal
# Install PortGate
pip install portgate

# Map local port 8000 to a public port
portgate 8000

Port forwarding established!
External address: 95.65.xxx.xxx:1025
Internal address: localhost:8000
Press Ctrl+C to stop forwarding...
^C
Removing port mapping 1025 -> 8000...
Port mapping removed successfully.

Why PortGate?

Everything you need to manage port mappings and expose services

⚡ Instant Setup

No complex configuration or external services. Just install and run. PortGate handles all the UPnP/NAT-PMP complexity for you.

🔒 Local Control

Your data stays on your network. No third-party tunneling services or external dependencies required.

🎯 Simple CLI

Clean, intuitive command-line interface. Open ports with a single command, manage them effortlessly.

📊 Port Management

List, refresh, and remove port mappings. Keep track of all your active forwards with built-in management tools.

⏰ TTL Support

Set custom lease durations for port mappings. Automatic cleanup prevents stale forwards from cluttering your router.

🌐 Universal

Works with any router supporting UPnP/NAT-PMP. No vendor lock-in, just standards-based port forwarding.

Command Reference

All available commands and options

add
Primary

Open a new port mapping with custom options

portgate add -p 8080 -P TCP -t 0
portgate add -p 25565 -P TCP -e 50000
remove

Remove an existing port mapping

portgate remove -p 8080 -P TCP
list

List all active port mappings

portgate list
refresh

Refresh/renew a specific mapping

portgate refresh -p 8080 -P TCP
clear

Remove all mappings by PortGate

portgate clear
info

Show router & WAN IP info

portgate info

Get Started

Expose your local services to the internet in seconds

Installation

pip install portgate

Windows Installation (No Python Required)

Download the standalone Windows executable:

portgate-windows_x64.zip

Extract and run portgate.exe from the command prompt

Quick Mode Example
# Run your local service
python3 -m http.server 8000

# In another terminal, expose it to the internet
portgate 8000

Port forwarding established!
External address: 95.65.xxx.xxx:1025
Internal address: localhost:8000
Press Ctrl+C to stop forwarding...