Debian/Ubuntu Tips and Tricks

Debuntu

Debian/Ubuntu Tips and Tricks

Iptables: How-to Share your internet connection

Posted by chantra on 10th December 2006

This entry is part 1 of 4 in the series Iptables: How-to Share your internet connection

iptables is a command line tool which allow system administrators to configure Linux packet filtering ruleset.

Using iptables, you are able to tweak packet filtering, Network Address Translation (NAT) and packet mangling which in the end are going to allow you to secure your server, share your Internet connection and log unwanted traffic.

iptables is not really what we could call an easy to get with tool, but once you know the basis, it won't be that scary :).

This tutorial will provide a sample script you can use to share your Internet access and will give an overview on how to use iptables

Read the rest of this entry »

Tags: , ,
Posted in Administration, HowTo, Networking | 22 Comments »

Iptables: How-to Share your internet connection — page 2

Posted by chantra on 12th December 2006

This entry is part 2 of 4 in the series Iptables: How-to Share your internet connection

3. Iptables Script

OK, now that we know the really basis, let see what the script is going to look like.

In this example, I assume that eth0 is the interface connected to the Internet, eth1 is the one connected to our local network.

Read the rest of this entry »

Tags: , ,
Posted in Administration, HowTo, Networking | No Comments »

Iptables: How-to Share your internet connection — page 3

Posted by chantra on 14th December 2006

This entry is part 3 of 4 in the series Iptables: How-to Share your internet connection

3.3. Defining custom chains

In order to get a easier to maintain iptables script, it is handy to define some custom chains, also called user-defined chains. This way, you can gather common actions into 1 chain, then, using our target switch (-j) we will be able to send packets that match specific rules to that target.
In order to create a user-defined chain, we need to use:

Read the rest of this entry »

Tags: , ,
Posted in Administration, HowTo, Networking | No Comments »

Iptables: How-to Share your internet connection — page 4

Posted by chantra on 15th December 2006

This entry is part 4 of 4 in the series Iptables: How-to Share your internet connection

4. Using iptables'script

4.1. From the command line

One way to apply the rules we define, is simply to run the script from the command line like:

sudo sh /path/to/firewall-script.sh

but this has the bad effect of not being restore on reboot :s, but still, this will be of great help while tweaking up your firewall.

Read the rest of this entry »

Tags: , ,
Posted in Administration, HowTo, Networking | No Comments »