Internet sharing

Asked by aneesh

iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080

Can anyone give me the detailed description about above command . Please help me

                                                                                                                        thanks in advance

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu iptables Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

-t nat =

nat:
                  This table is consulted when a packet that creates a new connection is encountered. It consists of three built-ins: PREROUTING (for
                  altering packets as soon as they come in), OUTPUT (for altering locally-generated packets before routing), and POSTROUTING (for alter‐
                  ing packets as they are about to go out).

-i eth0 =
              Name of an interface via which a packet was received (only for packets entering the INPUT, FORWARD and PREROUTING chains). When the "!"
              argument is used before the interface name, the sense is inverted. If the interface name ends in a "+", then any interface which begins
              with this name will match. If this option is omitted, any interface name will match.

-p tcp =
              Protocol tcp

-dport 80 =
              Destination Port 80 (ISO standard http port)

-j =
              This specifies the target of the rule; i.e., what to do if the packet matches it. The target can be a user-defined chain (other than the
              one this rule is in), one of the special builtin targets which decide the fate of the packet immediately, or an extension (see EXTENSIONS
              below). If this option is omitted in a rule (and -g is not used), then matching the rule will have no effect on the packet's fate, but the
              counters on the rule will be incremented.

REDIRECT --to-port 8080 =
              The action to take, I can't find REDIRECT in the man page or web, so not sure there.

You can find ALL this and more if you run:

man iptables

This will also help:
https://help.ubuntu.com/community/Internet/ConnectionSharing

Can you help with this problem?

Provide an answer of your own, or ask aneesh for more information if necessary.

To post a message you must log in.