Iptables HowTo for Ubuntu

Functionally, Iptables is a firewall, installed by default on all official Ubuntu distributions (Ubuntu, Kubuntu, Xubuntu). Iptables also refers to a generic table structure for the definition of rulesets.

Each rule within an IP table consists of a number of classifiers (iptables matches) and one connected action (iptables target). Netfilter is a set of hooks inside the Linux kernel that allows kernel modules to register callback functions with the network stack..

Copying from Netfilter.Org " What can I do with netfilter/iptables?

* build internet firewalls based on stateless and stateful packet filtering

* use NAT and masquerading for sharing internet access if you don't have enough public IP addresses

* use NAT to implement transparent proxies

* aid the tc and iproute2 systems used to build sophisticated QoS and policy routers

* do further packet manipulation (mangling) like altering the TOS/DSCP/ECN bits of the IP header "

There is a lot of information available about iptables, but for simple tasks then take a look at this How To.

https://help.ubuntu.com/community/IptablesHowTo