How to remove UPnP entries from iptables?
Because of a feature/bug UPnP ports never gets closed on the wl500g. When they are opened the entries are stored in nvram so they will even survive a reboot. So if you have opened and used UPnP at one point there might be open ports in your firewall. An easy way to remove them is to reset to factory default. If that is not an option you can clear them from nvram.
Here is how you do that:
First check for unwanted forwarding rules in iptables:
Code:
iptables -L FORWARD
If there are open ports that you can't account for they are likely caused by UPnP. Now check nvram for those entries:
Code:
nvram show | grep "forward_port"
If you find entries there you can remove them one by one like this:
Code:
nvram unset forward_portX
where X is for the rule number (ex. forward_port0)
I have also written this script to help to remove a number of rules:
Code:
#!/bin/sh
tlr=$1
while [ $tlr -le $2 ]
do
nvram unset forward_port$tlr
tlr=`expr $tlr + 1`
done
It takes to and from rule number as parameters. You can run f.eks like this:
which will clear rules from 0 to 10.
If someone would like to write a script that will clear all forward_port rules on boot, that would be a nice extension. Unless of course Asus or Oleg change this behaviour in comming FW releases.
S.
Edit: Don't forget to before you reboot!
How do you stop upnp from dying?
There's no forum for bugs so once again I'm just making this problem known here (in case people don't already know). I didn't find it specifically when searching but maybe I'm just no good at searching... Now that I'm into compiling and such I'm going to compile upnp in debug mode and try to isolate the issue.
For me, upnp will die after x amount of time. That's all I know for now. Azureus lets me know, and I set up crond to restart it when it's gone and log in such a case, and it's true that it is dying. I'll try to figure it out and post results here.