I notice that my bittorrent client is capable of automatically setting up port forwards with my router, and I want to know if I can do the same in a shell script. The reason is, that since my router is stupid and won't let me keep static IP addresses (it seems they forced a DHCP refresh every week to make me want to pay for a more expensive model which doesn't), I need to get my computer to change the port forward to follow my computer's changing internal network IP address. I have a couple of port forward manually entered into my router settings for web interfaces to bittorrent etc, but of course these have a good chance of being invalidated at each DHCP refresh cycle.
We're talking UPnP here.
First, why not just set a static IP address in your computer? The router doesn't need to know or care about that and it will stop your IP changing.
Otherwise, take a look at the MiniUPNP project: http://miniupnp.tuxfamily.org/