14

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.

1
  • 1
    It should be noted that many sysadmins disable UPnP on their routers because of a long history of security vulnerabilities in both implementation and design.
    – hackerb9
    Commented Aug 5, 2020 at 19:56

3 Answers 3

14

Use upnpc from MiniUPnP.

For gateways supporting the NAT-PMP protocol, natpmpc is available from the same site.

11

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
1
  • 1
    And 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 this sudo ufw allow from 192.168.1.1 to any proto udp
    – Madacol
    Commented Nov 5, 2022 at 18:28
4

I found upnp-router-control that make it possible to do it with a beautiful GUI interface.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .