Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

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:

share|improve this answer
My computer is a laptop... Is there way that I can give it a static IP for only my home network? I've tried to do a similar thing in the past in windows, and found that the static IP settings were considered global and could not be made network dependent. – Sam Svenbjorgchristiensensen Mar 24 '11 at 23:47
Windows still hasn't got its wireless settings sorted properly has it? In other operating systems the IP settings are bound to the wireless profile not the interface card :/ There are ways around it with batch files to switch networking settings for you:… but it's not wonderful. – Majenko Mar 25 '11 at 8:08
Ah I see. I just poked around with the settings and managed to get a static IP for just that network on Ubuntu. Since Windows wouldn't do it I just assumed it was a hardware limitation. Thanks. – Sam Svenbjorgchristiensensen Mar 26 '11 at 1:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.