Where is the documentation on how to configure a plain Linux box (probably running Ubuntu), with two NIC's so that eth0 is the input from the Internet and eth1 is the output to a wireless router?

While the traffic is passing through, I'd like to analyze it.

link|improve this question

feedback

6 Answers

up vote 4 down vote accepted

Use an existing firewall distribution such as smoothwall or ipcop. That will save you a ton of trouble and headache later. If you really want to get into the nitty-gritty of advance router configuration, check out LARTC.

link|improve this answer
1  
I have a smoothwall setup on a very old machine exactly like this. Smoothwall is a 10-minute Linux install – cop1152 Sep 5 '09 at 12:35
feedback

this is nothing special, all you need is a good firewall script or framework that will NAT your traffic.

Take a look at this link to get started: http://ubuntuforums.org/showthread.php?t=713874

Searching google will return countless hits as this topic has been thoroughly investigated.

link|improve this answer
feedback

I use shorewall running on ubuntu. Very easy to set up and maintain, but it still has all the options you will likely need: http://www.shorewall.net/two-interface.htm

link|improve this answer
+1 for shorewall – dmityugov Sep 5 '09 at 12:44
feedback

Here's a script I use on some debian systems:

#!/bin/sh
## This script starts an NAT internet gateway

## Settings
# Internal Interface
INTERNAL=eth1
# External Interface
EXTERNAL=eth0

## Ensure the modules are loaded
# Load the NAT module
modprobe iptable_nat
# Load the transparent FTP modules
modprobe ip_nat_ftp
modprobe ip_conntrack_ftp
# Load the transparent IRC modules
modprobe ip_nat_irc
modprobe ip_conntrack_irc

modprobe ipt_MASQUERADE
modprobe ipt_REDIRECT
modprobe ipt_REJECT
modprobe iptable_filter
modprobe ip_conntrack
modprobe ip_tables


## Flush the routing tables
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain

## Set up the NAT table
iptables -t nat -A POSTROUTING -o $EXTERNAL -j MASQUERADE
iptables --append FORWARD --in-interface $INTERNAL -j ACCEPT

# Ensure that IP forwarding is on
echo 1 > /proc/sys/net/ipv4/ip_forward
link|improve this answer
feedback

You might also look at m0n0wall. A guy in my local LUG uses it extensively.

link|improve this answer
"the first UNIX system that has its boot-time configuration done with PHP" (m0n0wall homepage) - perversion! And Scott asked for a Linux gateway, m0n0wall is BSD. – 0x89 Sep 5 '09 at 14:42
good point - didn't realize it was BSD only – warren Sep 6 '09 at 2:37
feedback

To analyze the traffic, you can use tcpdump

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.