# forwarding UPNP rules? (iptables/linuxigd/upnpd)

## eddieparker

Hello:

I've got a bit of an odd situation here, and I'm hoping someone else can help me out.

My network is comprised of an ADSL Router/Modem combo (sadly inseparable), which I then connect my Gentoo box directly to.

The Gentoo box acts as a gateway for my local network (10.0.0.0/24), which in turn sits on the ADSL Router/Modem's local network (192.168.1.0/24).

I have linuxigd set up and it's working great for creating iptables on my Gentoo box.  The problem is that I'd like to then forward the same UPNP command off to the router, to port forward to the Gentoo box.

Is this at all possible?

Background as to why I do this crazy network setup:

My ISP is Telus up here in Canada, and the router they've given me is basically junk.  It flakes out after too many connections occur, and the Internet goes down until I reboot the router manually.  Setting up this situation allows me to rate control connections from iptables and thereby limit the Internet outages to a much smaller frequency.

Anyhow, any advice would be appreciated.

----------

## Hu

What exactly do you need to send to the Telus device?  Do you just need to resend a UPnP request, which it will understand and honor?  Does it require some separate configuration, such that you need to translate the UPnP packet into some other form of request (e.g. HTTP request to a Web GUI) for the Telus device to understand?

----------

## eddieparker

Hello Hu:

Ideally I'd like to send to the Telus device a UPNP request to forward to my gateway.

Basically what I have is this:

[Telus Router/Modem] 192.168.1.254

[My Gateway Server] 

  - 192.168.1.2 [external]

  - 10.0.0.10 [internal]

[My Clients]

  - 10.0.0.xxx

When my client sends a UPNP request, my gateway server receives it, opens up a port forwarding rule for it (anything across 192.168.1.2-10.0.0.10 and onward to a set 10.0.0.xxx address will get forwarded).  The only problem is that my Telus Router/Modem is still blocking the request, as it hasn't received the UPNP request.  Ideally I'd like to have the Telus router also forward a port to the 192.168.1.2.

So, an example:

Say my client, 10.0.0.101, wants to open port 9119.  Currently it would talk to 10.0.0.10 through UPNP and port 9119 would be forwarded through 192.168.1.2 and straight across to 10.0.0.101.  Unfortunately, the Telus router currently still blocks port 9119.  What I'd like to do is to have my gateway server at 10.0.0.10 issue a request to 192.168.1.254 to forward port 9119 to 192.168.1.2.

Sorry if that's too verbose, I'm just hoping to clear up any potential clarity issues.

----------

## Hu

That makes sense, and it is what I thought you wanted to do.  I do not know of a way to do that with just a configuration change, but if your UPnP daemon the Gentoo machine is already capable of running iptables to add a rule, it seems like it should not be hard to have it also run some other program that would send an additional UPnP request to the Telus device.  Do you have a preferred command line program that generates a UPnP request based on their arguments?  I see a few Portage packages that claim to be UPnP clients.

----------

## eddieparker

I don't know of any that generate a UPNP request based on arguments.  I also don't know how I can intercept linuxigd's UPNP reception so as to generate said arguments either.

Have you any experience with either?

----------

## Hu

No.

----------

