All of the authors are available on #debian on irc.opensource.net
John Tapsell (JohnFlux) is the official maintainer.
Email me (John Tapsell) for any query, flame, feedback, a date, etc.
Shamelessly stealing from David Ranch's work - <firstname.lastname@example.org>.
This is NOT a replacement for the IP-Masquerading HOWTO - it is to complement it, and the two should be read side by side. I do not include things in here that are covered by the the other HOWTO, nor do I explain what it all means, or what it is all about. See http://ipmasq.cjb.net and the standard Masq-HOWTO for a much better guides.
This document describes how to enable the Linux IP Masquerade feature on a given Linux host. IP Masq is a form of Network Address Translation or NAT that allows internally networked computers that do not have one or more registered Internet IP addresses to have the ability to communicate to the Internet via your Linux boxes single Internet IP address.
This is all under the GNU Free Documentation License
This is intentionally short and to the point.
If you have a network, that you want to attach to the outside:
Assuming external internet card is eth0, and external IP is 18.104.22.168 and the internal network card is eth1, then:
Or for a dial-up connection:
Then to secure it:
Or for a dial-up connection (with eth0 as the internal network card):
And thats it! To view the rules do "iptables -t nat -L"
Compiling the kernel: (Use a 2.4.x kernel or greater)
You need the following support in the kernel:
First, if the iptable and masq modules are not compiled into the kernel and not installed, but do exist as modules, we need to install them. If you insmod ipt_MASQUERADE it will load ip_tables, ip_conntrack and iptable_nat.
Now either your Intranet is large, or you're just trying to get two or three machines to work on the internet - it doesn't make much difference either way.
Okay, I'm assuming that you have no other rules, so do:
If you get an error saying can't find iptables, go find it and install it. If it says no such table 'nat', recompile the kernel with nat support. If it says no such table as 'mangle', don't worry about it, it's not necessary for MASQ'ing. If it says iptables is incompatible with your kernel, go get > 2.4 and compile that with iptables support.
Then if you have a static ip do (e.g. network card not using DHCP):
or for dynamic (e.g. a modem - you have to call a number first):
Then finally to tell the kernel yes, you really do want to start forwarding packets: (This only needs to be done once per reboot - but dosen't hurt to do it lots)
Once you have checked this all works (See under Post-install) only allow masquerading from the internal network - you don't want to allow people on the internet to use it after all :)
First, allow any existing connections, or anything related (e.g. ftp server connecting back to you)
If this gives an error, then you most likely don't have state tracking in the kernel - go recompile. Then allow new connections only from our intranet (local/internal network). Replace the ppp0 with eth0 or whatever your external device is. (The ! means anything but)
And now deny everything else:
If either of the first two rules failed, then this last rule with prevent the masquerading from working at all. To undo this rule do "iptables -P INPUT ACCEPT".
And it should all work now. Don't forget to:
To test it:
Where eth0 is the external Internet card, and 22.214.171.124 is the external ip of that machine.