Is there any client that can request mapping and unmapping ports via UPnP port mapping behind a NAT gateway? I had problem with PortMap. I want this mostly for testing purposes.
3 Answers
Complementing @user1686 answer. This is how you can do it on Ubuntu, Mint and all Debian based distros:
# Install upnpc command line
sudo apt install -y miniupnpc
# Get network ip address (typically started with 192)
export IP=$(hostname -I | tr " " "\n" | grep 192)
# External port 2222 forwarded to internal port 22
upnpc -e "upnpc test" -a $IP 22 2222 TCP
# Delete
upnpc -d 2222 TCP
-
1And if you use a firewall, you have to enable UDP packets coming from the router. In my case, I use
ufw
, so the command would be something like thissudo ufw allow from 192.168.1.1 to any proto udp
– MadacolCommented Nov 5, 2022 at 18:28
I found upnp-router-control that make it possible to do it with a beautiful GUI interface.