networking - Help understanding iptables command - Ask Ubuntu
what every part of command mean?
sudo iptables -t nat -a postrouting -o eth0 -j masquerade
from manual pages of iptables(8)
:
iptables
:
iptables , ip6tables used set up, maintain, , inspect tables of ipv4 , ipv6 packet filter rules in linux kernel. several different tables may defined. each table contains number of built-in chains , may contain user-defined chains.
-t nat
:
iptables , ip6tables used set up, maintain, , inspect tables of ipv4 , ipv6 packet filter rules in linux kernel. several different tables may defined. each table contains number of built-in chains , may contain user-defined chains.
this table consulted when packet creates new connection encountered. consists of 3 built-ins: prerouting (for altering packets come in), output (for altering locally-generated packets before routing), , postrouting (for altering packets go out). ipv6 nat support available since kernel 3.7.
-a postrouting
:
append 1 or more rules end of selected chain. when source and/or destination names resolve more 1 address, rule added each possible address combination.
-o eth0
: (eth0 is:)
name of interface via packet going sent (for packets entering forward, output , postrouting chains). when "!" argument used before interface name, sense inverted. if interface name ends in "+", interface begins name match. if option omitted, interface name match.
-j masquerade
:
this specifies target of rule; i.e., if packet matches it. target can user-defined chain (other 1 rule in), 1 of special builtin targets decide fate of packet immediately, or extension (see extensions below). if option omitted in rule (and -g not used), matching rule have no effect on packet's fate, counters on rule incremented.
next time, try doing bit of general reading first.
Comments
Post a Comment