Ticket #593 (closed task: fixed)
How to install " MiniUPnP client binary or the MiniUPnP client module for Python." in Ubuntu
| Reported by: | Anonymous | Owned by: | quinox |
|---|---|---|---|
| Priority: | normal | Milestone: | Release 1.2.16 |
| Component: | nicotine | Version: | 1.2.14 |
| Keywords: | 1.2.14 | Cc: |
Description
I have installed the following packages in Ubuntu/Karmic? "miniupnpd_1.4.20091106-1_i386.deb" and "libminiupnpc4_1.4-0ubuntu4_i386.deb". However, it is still not possible to activete "Use UPnP to fix portmapping" in Nicotine+ 1.2.14. Could somebody give some instructions what more is required to get "Use UPnP to fix portmapping" activated and where to get the relevant deb packages if the above packages are not correct. I do not know where else to ask the above question so I put it here.
Attachments
Change History
comment:2 in reply to: ↑ 1 Changed 3 years ago by anonymous
Replying to anonymous:
That should have done the trick - I don't know what went wrong. I'll test it myself in a few days, see what goes wrong
OK, I check here for your findings after some days If the problem is Karmic specific the fix could also wait until Lucid is released in the end of this month. Another, problem I noticed after I upgraded to Nicotine+ 1.2.14 is that I get no results when I search among buddies. I get search results only in "Global" searches.
comment:3 Changed 3 years ago by quinox
I got it working by installing the package miniupnpc, which pulled in libminiupnpc - I think you only installed the core of miniupnp, not the part that talks to the core.
It doesn't come with python bindings so it uses the CLI tool - slightly less robust.
comment:4 Changed 3 years ago by anonymous
Where did you find the "miniupnpc" package? I tried the i386 .deb packages that are here "http: code.google.com/p/bashare/downloads/list" but they do not seem to work.
comment:5 Changed 3 years ago by quinox
I added bashare to my repository:
https://launchpad.net/~bashareteam/+archive/bashare
In Synaptic you can somewhere (in the settings?) list all your repositories, add those two to it, hit the refresh button and then they show up when you search for miniupnp inside synaptic/apt
comment:6 Changed 3 years ago by anonymous
Thanks, now I could get "Use UPnP to fix portmapping" activated, however Nicotine+ gives the following error message when I stat it. Could it have something to do with the fact that I have updated Ubuntu to Licid, while the activation of your above mentioned repository referred to Karmic?
20:53:37 UPnPc binary failed, could not parse output: upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard Go to miniupnp.free.fr/ or miniupnp.tuxfamily.org/ for more information. List of UPNP devices found on the network :
desc: http : IP address /DeviceDescription?.xml st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : http : IP address /UD/act?3 Local LAN ip address : IP address
20:53:37 Failed to automate port forwarding, sorry."
comment:7 Changed 3 years ago by quinox
N+ has to ways to interact with MiniUpnp?:
- Through the python bindings
- By using the command line tool and parsing the output
The first option is generally better because N+ knows precisely what's happening
The packages you've installed don't have these bindings, so N+ falls back on the command line tool to fix the port mapping. In order to figure out what is happening it has to interpret the text this tool is returning.
There are two possibly sources for your error:
- MiniUPNP failed to forward the port
- MiniUPNP successfully forwarded the port, but N+ doesn't understand the output of the tool.
It looks like (1) is the problem, but this needs to be verified:
Open a terminal/console and type in upnpc -r 9999 9999. The numbers aren't too important, the first one is the port on your router, the second one the port on your PC (or maybe the mapping text, I'm not entirely sure anymore.). It should say something like "Looking for UPnP devices", "Found 1 gateway, connecting" and ultimately it should say "external X.X.X.X:9999 is redirected to internal Y.Y.Y.Y:9999".
If that's the case please post the output here so I can fix N+ to understand the output. If the output doesn't show anything about a successful portmapping it's possible MiniUPnP failed to talk to your router properly. In that case you should take it up with the author of MiniUPnP
Here is a list of the routers that are and aren't supported by MiniUPnP.
comment:8 Changed 3 years ago by quinox
Oh, and if it fails you might want to check your router settings - it used to be the case that UPnP has to be specifically enabled before you can use it.
comment:9 Changed 3 years ago by anonymous
This is the output I get when writing upnpc -r 9999 9999 in the terminal. I use a ZyXEL P-660HW-61D router. It is not on the supported routers list, but ZyXEL Prestige 660H-61 is on the list and think it should be basically the same router. UPnP is enabled in the router.
"upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard Go to htt p: mi niupnp.free.fr/ or htt p://miniupnp.tuxfamily.org/ for more information. List of UPNP devices found on the network :
desc: ht tp: / /192.1 68.200.1:80/DeviceDescription.xml st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : htt p: / /19 2.168.200.1:80/UD/act?3 Local LAN ip address : 1 9 2.168.200.13 invalid protocol"
What do you think the problem is?
comment:10 Changed 3 years ago by anonymous
Thanks for your efforts. I have the sneaky suspicion I made a big mistake with the UPnP code (I don't have a router myself and had to do everything blindly), passing incorrect arguments to the MiniUPnP tool.
What happens when you try upnpc -r 9999 tcp?
comment:11 Changed 3 years ago by anonymous
Thanks for your efforts too. It is good that somebody is doing work to improve N+.
This is the output I get when when writing "upnpc -r 9999 tcp" in the terminal. (I changed the external IP address slightly)
upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard Go to ht tp://miniupnp.free.fr/ or h ttp://miniupnp.tuxfamily.org/ for more information. List of UPNP devices found on the network :
desc: htt p://192.168.200.1:80/DeviceDescription.xml st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : http :192.168.200.1:80/UD/act?3 Local LAN ip address : 1 92.168.200.13 ExternalIPAddress = 84.26.88.176 InternalIP:Port = 192.168.200.13:9999 external 94.22.82.176:9999 TCP is redirected to internal 192.168.200.13:9999
comment:12 Changed 3 years ago by anonymous
That means I did make a mistake while coding.
I think I fixed it with r1414. You can try it out by using the SVN code, or by replacing your version of 'pynicotine/upnp.py' with source:/trunk/nicotine+/pynicotine/upnp.py (download link at the bottom). It should be compatible with all N+ versions that had the file upnp.py
comment:13 Changed 3 years ago by anonymous
How can I replace my version of 'pynicotine/upnp.py'? Where is it located? I cannot find it in the ".nicotine" folder
comment:14 Changed 3 years ago by anonymous
I managed to change my version of 'pynicotine/upnp.py' but it does not work still. This is the output I get now when writing upnpc -r 9999 9999 in the terminal.
upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard Go to http :miniupnp.free.fr/ or http :miniupnp.tuxfamily.org/ for more information. List of UPNP devices found on the network :
desc: http: 192.168.200.1:80/DeviceDescription.xml st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : htt p://192.168.200.1:80/UD/act?3 Local LAN ip address : 192.168.200.13 invalid protocol"
..and this is the output I get when when writing "upnpc -r 9999 tcp" in the terminal.
upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard Go to http :miniupnp.free.fr/ or htt p://miniupnp.tuxfamily.org/ for more information. List of UPNP devices found on the network :
desc: htt p://192.168.200.1:80/DeviceDescription.xml st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : http :192.168.200.1:80/UD/act?3 Local LAN ip address : 192.168.200.13 ExternalIPAddress = 86.24.88.173
comment:15 Changed 3 years ago by anonymous
Further N+ reports as follows:
22:27:17 UPnPc binary failed, could not parse output: upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard Go to htt p://miniupnp.free.fr/ or htt p://miniupnp.tuxfamily.org/ for more information. List of UPNP devices found on the network :
desc: htt p://192.168.200.1:80/DeviceDescription.xml st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : htt p://192.168.200.1:80/UD/act?3 Local LAN ip address : 192.168.200.13 ExternalIPAddress = 86.24.88.173 AddPortMapping?(%s, %s, 192.168.200.13) failed with code 402 (Invalid Args) GetSpecificPortMappingEntry?() failed with code 402 (Invalid Args)
22:27:17 Failed to automate port forwarding, sorry.
comment:16 Changed 3 years ago by anonymous
when writing upnpc -r 9999 9999 in the terminal
That will never work, I made a mistake in the original code. It should be upnpc -r 9999 tcp
I have no idea what those other errors means, as I said I don't have a router myself. Is it possible it refuses to add a portmapping when it has already mapped the port? Does upnpc -r 8888 tcp work the first time? The second time?
comment:17 Changed 3 years ago by anonymous
Below is the output I get now when writing upnpc -r 8888 tcp in the terminal. I get the same output even if I try several times.
"upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard Go to http :miniupnp.free.fr/ or http :miniupnp.tuxfamily.org/ for more information. List of UPNP devices found on the network :
desc: http :192.168.200.1:80/DeviceDescription.xml st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : http :192.168.200.1:80/UD/act?3 Local LAN ip address : 192.168.200.11 ExternalIPAddress = 86.24.88.173 InternalIP:Port = 192.168.200.11:8888 external 86.24.88.173:8888 TCP is redirected to internal 192.168.200.11:8888"
To me the above output indicates that the portmapping is working. The question is then why N+ give the failure message I referred to in the "22:27:17" message above.
comment:18 Changed 3 years ago by anonymous
That was another (new) bug, I forgot to substitute the port number in the MiniUPnPc command. I tried to be careful but forgot something as simple as this, sigh.
I fixed it with r1415, that should really be the last problem with the miniupnpc binary. source:/trunk/nicotine+/pynicotine/upnp.py same as last time, replace the file to use the change, works with any n+ version that came with upnp.py.
comment:19 Changed 3 years ago by anonymous
There seems to be some problems still. Reference to a new error code. N+ reposts as follows:
"20:50:00 UPnPc binary failed, could not parse output: upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard Go to http: miniupnp.free.fr/ or http: miniupnp.tuxfamily.org/ for more information. List of UPNP devices found on the network :
desc: http: 192.168.200.1:80/DeviceDescription.xml st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : http: 192.168.200.1:80/UD/act?3 Local LAN ip address : 192.168.200.11 ExternalIPAddress = 986.24.88.173 AddPortMapping?(2234, 2234, 192.168.200.11) failed with code 718 (ConflictInMappingEntry?) GetSpecificPortMappingEntry?() failed with code 714 (NoSuchEntryInArray?)
20:50:00 Failed to automate port forwarding, sorry."
...and this is the output I get now when writing upnpc -r 8888 tcp in the terminal:
"upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard Go to http: miniupnp.free.fr/ or http: miniupnp.tuxfamily.org/ for more information. List of UPNP devices found on the network :
desc: http: 192.168.200.1:80/DeviceDescription.xml st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found valid IGD : http: 192.168.200.1:80/UD/act?3 Local LAN ip address : 192.168.200.11 ExternalIPAddress = 86.24.88.173 InternalIP:Port = 192.168.200.11:8888 external 86.24.88.173:8888 TCP is redirected to internal 192.168.200.11:8888"
comment:20 Changed 3 years ago by quinox
And if you try to use a different port within N+?
comment:21 Changed 3 years ago by anonymous
No change when I changed the port in N+ from 2234 to 2235. Maybe it is my router Zyxel P-660HW-D1 that is the problem after all, even if it is very similar to the Zyxel Prestige 660H-61 that is on the approved list.
comment:22 Changed 3 years ago by anonymous
If the CLI tool works N+ should work as well. My only suggestion left is to play around with it, try different ports like 7654 or 9630 etc. If you've verified that the CLI can map a certain port try using that inside N+ etc.
I'll see if I can find a UPnP router somewhere this week to try it out myself.
comment:23 Changed 3 years ago by OffHand
Quinox - If you want to borrow an old router of mine with upnp let me know. My gf studies where you live, so that should be easy enough. I can ship it as well, but rather not.
comment:24 Changed 3 years ago by anonymous
Thanks for the offer, I think I can manage; I can get access to 3 different routers, and otherwise I'll try it out some of the unprotected WiFi? networks in my quarters :)
comment:25 Changed 3 years ago by quinox
I tested r1415 with a UPnP enabled router. Note that the router was behind another router, the laout was: Internet <--> Router 1, provides network 192.168.X.X <--> Router 2, provides network 10.0.X.X <--> EEEPc Laptop with Ubuntu. So all the mentioned IP addresses look peculiar but they are in fact correct.
First, the CLI:
quinox@ebento:~/nicotine+$ upnpc -r 9910 tcp upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ for more information. List of UPNP devices found on the network : desc: http://10.0.0.1:80/Public_UPNP_gatedesc.xml st: urn:schemas-upnp-org:device:InternetGatewayDevice:1 Found valid IGD : http://10.0.0.1:80/Public_UPNP_C3 Local LAN ip address : 10.0.0.3 ExternalIPAddress = 192.168.0.99 InternalIP:Port = 10.0.0.3:9910 external 192.168.0.99:9910 TCP is redirected to internal 10.0.0.3:9910 quinox@ebento:~/nicotine+$
Which works as expected. Then I used N+ with "Use UPnP to fix portmapping", and this is the log:
10:43:38 Nicotine supports "psyco", an inline optimizer for python code, you can get it at http://sourceforge.net/projects/psyco/ 10:43:38 Nicotine supports a country code blocker but that requires a (GPL'ed) library called GeoIP. You can find it here: C library: http://www.maxmind.com/app/c Python bindings: http://www.maxmind.com/app/python (the python bindings require the C library) 10:43:38 Failed to import the Mutagen library, falling back to old library. To improve meta data please install Mutagen. 10:43:38 Loading plugin handler 10:43:38 Figuring out UPnP... 10:43:40 Managed to forward port 2234, your external IP is 192.168.0.99. 10:43:43 10:43:44 2589 privileged users 10:43:44 You have no privileges left. They are not needed for Nicotine+ to function properly. You can acquire privileges by donating at http://www.slsknet.org/userlogin.php?username=something
Which works too.
So I think our current code base now works thanks to your ticket, but I'm not sure why it still does't work for you.
I have plenty of theoretical knowledge about routers but no practical. I am wondering if you perhaps added a port-mapping for 2234/2235 already in your router? N+ works on any port you like, so if UPnPc works for port 8888 you can use this with N+. Anyway, since UPnPc works for you N+ portmapping should too.
comment:26 Changed 3 years ago by anonymous
I tested with port 8888, but that did not work. However, after trying some more ports I finally got it to work with port 8892.
"16:26:25 Managed to forward port: ('86.24.88.173', 8892)"
It works only when the original upnp.py is replace with the new upnp.py (taken from your above mentioned address source:/trunk/nicotine+/pynicotine/upnp.py). I run N+ 1.2.14 installed from the Ubuntu repository, but alternatively also N+ 1.2.15 in Tar.GZ form taken from the N+ mainpage (as explained in the comments on ticket #604). I had not updated the upnp.py file in the 1.2.15 version, so it did not work until that was done.
It seems everything is OK now. Thanks for the good work
comment:27 Changed 3 years ago by quinox
- Status changed from new to closed
- Resolution set to fixed
Excellent, thanks. The correct UPnP will be part of the next version N+, 1.2.16 (it doesn't have a scheduled release date yet)
comment:28 Changed 2 years ago by anonymous
viagra
comment:29 Changed 4 months ago by anonymous
I still have the same error with N+ 1.2.16 on Ubuntu 12.04. Even with python binding installed.
comment:30 Changed 4 months ago by anonymous
Forget it, it was a mistake

That should have done the trick - I don't know what went wrong. I'll test it myself in a few days, see what goes wrong