IP Forwarding with IP tables

Rodolfo Alcazar rodolfo.alcazar at padep.org.bo
Thu Oct 13 18:04:01 UTC 2005


On Thu, 2005-10-13 at 17:55 +0100, Gary Stainburn wrote:
> Hi folks.
> probably a FAQ but I'm struggling.
> I have an internet connection linked to eth1 and a LAN connected to eth0
> I want to set up simple 1-to-1 NATing thus:
> 
> x.y.z.141   == 10.1.1.141
> x.y.z.142   == 10.1.1.142
> x.y.z.143   == 10.1.1.143

first of all, setup the interfaces. if your external interface is eth1,
as you said, using your numbers:

ifconfig eth1:1 x.y.z.141 netmask 255.255.255.248
ifconfig eth1:2 x.y.z.142 netmask 255.255.255.248
ifconfig eth1:3 x.y.z.143 netmask 255.255.255.248

now, the incoming tables:

-A PREROUTING -d x.y.z.141 -j DNAT --to-destination 10.1.1.141
-A PREROUTING -d x.y.z.142 -j DNAT --to-destination 10.1.1.142
-A PREROUTING -d x.y.z.143 -j DNAT --to-destination 10.1.1.143

same for outgoing,

-A POSTROUTING -s 10.1.1.141 -j SNAT --to-source x.y.z.141
-A POSTROUTING -s 10.1.1.142 -j SNAT --to-source x.y.z.142
-A POSTROUTING -s 10.1.1.143 -j SNAT --to-source x.y.z.143

cheers

--
Rodolfo Alcazar - rodolfo.alcazar at padep.org.bo
Netzmanager Padep, GTZ
591-70656800, -22417628, LA PAZ, BOLIVIA
http://otbits.blogspot.com
--
Maugham's Thought:
Only a mediocre person is always at his best.






More information about the fedora-list mailing list