---
name: "ipportfw"
section: "8"
platform: "linux"
package: "ipportfw"
version: "1.11-6"
release: "Debian 2.1 (Slink)"
platforms: ["linux"]
url: "https://new.carta.tech/ipportfw"
---

# ipportfw(8)

IP Port Forwarding with Adress rewriting.

## NAME

ipportfw - IP Port Forwarding with Adress rewriting.

## SYNOPSIS

**ipportfw** *-A -\[t\|u\] l.l.l.l/lport -R a.a.a.a/rport*\
 **ipportfw** *-D -\[t\|u\] l.l.l.l/lport*\
 **ipportfw** *-C*\
 **ipportfw** *-L*\

## DESCRIPTION

The easiest way to imagine Port Forwarding is a combination of routing by port combined with packet rewriting. A convention router examines the packet header and dispatches the packet on one of its other interfaces, depending on the packet's destination address. Port Forwarding examines the packet header and forwards it on to another host (after a little header rewriting) depending on the destination port.

In more detail: Port forwarding forwards all packets intended for one forwarding port on the gateway from the external networks to routed on a specified port on one of the internal machines (after a little rewriting of headers). This is (in some ways) a reverse of masquerading and uses many of the maquerading functions - particularly the packet header rewriting code.

## OPTIONS

The program uses single dashes for the options only. The first option is determining the format of the rest of the parameters. Possible first options are:

- **-A**

  Add a new entry to the IP Forwarding rules.

- **-D**

  Delete an entry from the IP Forwarding rules.

- **-C**

  Clear the complete table of ports.

- **-L**

  List the table of ports to be forwarded.

## PARAMETERS

- **-t**

  Redirect a TCP Port

- **-u**

  Redirect a UDP Port

- **l.l.l.l/lport**

  An IP address and a port. This is the Address/Port to be redirected and must be visible from the Internet.

- **a.a.a.a/lport**

  Another IP address and a Port. This is the Address of the private network and the port on the private network where packages should be redirected to.

## EXAMPLE

```
                          INTERNET
                              | (194.160.1.1)
                         linux box 1
                              | (10.0.0.1)
                +--------------------------+ internal ethernet
                | (10.0.0.2)               | (10.0.0.3)
           linux box 2                linux box 3
```

On the gateway, we setup the rule that all connections to port 80/tcp should be redirected to port 80 on 10.0.0.2 (an internal machine). The incoming web connection would be labelled:

Source: 163.158.1.2/7890  Dest: 194.160.1.1/80

This would be forwarded on to the internal host as:

Source: 163.158.1.2/7890  Dest: 10.0.0.2/80

Replies would be labelled:

Source: 10.0.0.2/80       Dest: 163.158.1.2/7890

and would be rewritten by the gateway to:

Source 194.160.1.1        Dest: 163.158.1.2/7890

## SEE ALSO

http://www.monmouth.demon.co.uk/ipsubs/portforwarding.html

## AUTHOR

This manual page was written by Christoph Lameter \<christoph@lameter.com\>, for the Debian GNU/Linux system (but may be used by others).
