Re: iptables NAT routing (LAN -> public IP of WAN interface -> LAN again)
- From: Jean-David Beyer <jdbeyer@xxxxxxxxxxx>
- Date: Thu, 08 Dec 2005 23:57:09 -0500
Jody wrote:
> I have Linux kernel 2.6.10 set up with iptables to do network address
> translation routing for computers on a LAN, with port forwarding for a
> couple of servers. I cannot access the public IP from behind the router
> in the same fashion as if I was accessing it at a remote location (i.e.
> like a customer) whereas when there was a home router in the same spot I
> could do so. The home router was not extensible enough, and is not an
> answer. What kind of rules would I need to use for iptables to tell it
> to route packets from LAN computers destined for the IP of the WAN
> interface the same way as if they were from external systems? I need
> internal requests to the public IP to port-forward by the same rules
> that outside requests are.
>
> I can't post the contents of my configuration script at this time. I
> apologize for that.
>
> TIA for any help.
>
> Jody
IPT=/sbin/iptables
if [ ! -x $IPT ]; then
echo "firewall: can't execute \$IPTABLES"
exit 1
fi
###########################################################################
# #
TRILLIANE0="123.456.789.012"
# #
###########################################################################
###########################################################################
# #
# Change these assignments to conform to your network architecture. #
EXTDEV0=ppp0
EXTIP0="$TRILLIANE0"
# #
###########################################################################
###########################################################################
# #
# SOURCE NAT #
# #
###########################################################################
# #
# If anything leaves our LAN going to Internet (EXTIP0, ppp0), make it #
# appear it came from this firewall machine; i.e., give it our routable #
# IP address. #
$IPT -t nat -A POSTROUTING -o $EXTDEV0 -j SNAT --to-source $EXTIP0
# #
###########################################################################
--
.~. Jean-David Beyer Registered Linux User 85642.
/V\ PGP-Key: 9A2FC99A Registered Machine 241939.
/( )\ Shrewsbury, New Jersey http://counter.li.org
^^-^^ 23:50:00 up 12 days, 10:20, 3 users, load average: 4.21, 4.11, 4.11
.
- References:
- Prev by Date: Re: enabling DMA on ATA drive leads to "hdparm -Tt" failure on Fedora Core 3 (fc3)
- Next by Date: Re: enabling DMA on ATA drive leads to "hdparm -Tt" failure on Fedora Core 3 (fc3)
- Previous by thread: iptables NAT routing (LAN -> public IP of WAN interface -> LAN again)
- Next by thread: enabling DMA on ATA drive leads to "hdparm -Tt" failure on Fedora Core 3 (fc3)
- Index(es):
Relevant Pages
|