A Howto for setting up UPnP on OpenWrt:
Install the packages miniupnpd and luci-app-upnp via the Luci interface System -> Software.
Via System -> Startup Enable and (Re)Start miniupnpd and firewall
Test that the UPnP daemon is running on OpenWrt from a Linux system (so: NOT from OpenWrt) with the command
upnpc -l
It should show some useful information of the OpenWrt device
Now proceed with port forwarding:
First do a basic redirect, again from the Linux command line (so: NOT from OpenWrt):
upnpc -r 4444 tcp
More advanced with a different external and internal port
First find out your computer's LAN IP address with
ip route get 8.8.8.8 | head -1 | awk '{ print $NF }'
In my case the output is 192.168.1.113. The command is:
upnpc -a 192.168.1.113 2222 5555 tcp
This should redirect the outside port 5555 to port 2222 on 192.168.1.113. The result should be like something like:
external 60.70.80.90:5555 TCP is redirected to internal 192.168.1.113:2222 (duration=0)
OK, that works.
If you try a lower outside port (below 1024), you will get:
AddPortMapping(9900, 1000, 192.168.1.113) failed with code 718 (ConflictInMappingEntry)
GetSpecificPortMappingEntry() failed with code 714 (NoSuchEntryInArray)
To solve that, in Luci go to Services -> UPNP, and under "MiniUPnP ACLs" change "Internal ports" to 1-65535. Press Save & Apply
Lower internal ports should work now. Example:
$ upnpc -a $(ip route get 8.8.8.8 | head -1 | awk '{ print $NF }') 80 5678 tcp
external 60.70.80.90:5678 TCP is redirected to internal 192.168.1.113:80 (duration=0)
So now the external port 5678 is redirected to internal 192.168.1.113:80
Programs like torrent programs can now do the port forwarding for you.
HTH
(Last edited by superkoning on 6 Jan 2015, 20:18)