[debian] UPnP port forwarding via command line

Install miniupnpc:

apt-get install miniupnpc

man miniupnpc

NAME
       upnpc - miniupnpc library test client.

SYNOPSIS
       Add port redirection:
       upnpc [options] -a ip port external_port protocol

       Delete port redirection:
       upnpc [options] -d external_port protocol [port2 protocol2] [...]

       Get Connection status:
       upnpc [options] -s

       List redirections:
       upnpc [options] -l

       Add all redirections to the current host:
       upnpc [options] -r port1 protocol1 [port2 protocol2] [...]

DESCRIPTION
       protocol is UDP or TCP

Exemple mapping port 80

# Nat port 80
upnpc -a 192.168.0.2 80 80 TCP

# Remove port 80
upnpc -d 80 TCP