Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Sundaram Ramasamy" <sun@percipia.com>
To: hare ram <hareram@sol.net.in>, netfilter@lists.netfilter.org
Subject: Re: Accessing machine with public ip address.
Date: Mon, 23 Dec 2002 10:06:56 -0500	[thread overview]
Message-ID: <00ee01c2aa94$ef846c30$8c01a8c0@sundaram> (raw)
In-Reply-To: 01c001c2aa8e$486bd6a0$13fcc5cb@Housecall

Here is my iptables rules

#!/bin/bash
set -xv

EXT="eth0"
INT="eth1"
INT2="eth2"
LO="lo"

ANY="Any/0"

GW_IP="192.168.1.1"
GW_EXT_IP="64.140.18.38"
SUB_NET="192.168.1.0/24"

PRIVP="0:1023"
UNPRI="1024:65535"

echo 1 > /proc/sys/net/ipv4/tcp_syncookies

for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
        echo 1 > $f
done

echo 1 > /proc/sys/net/ipv4/ip_forward

$IPT -P INPUT DROP
$IPT -P OUTPUT ACCEPT
$IPT -P FORWARD DROP

$IPT -X
$IPT -F
$IPT -t nat -F
$IPT -t nat -X

#Fisrt inside Interface
$IPT -A INPUT   -i $INT -j ACCEPT
$IPT -A INPUT   -i $INT -j ACCEPT
$IPT -A OUTPUT  -o $INT -j ACCEPT
$IPT -A FORWARD -i $INT -j ACCEPT
$IPT -A FORWARD -o $INT -j ACCEPT

#Second inside Interface
$IPT -A INPUT   -i $INT2 -j ACCEPT
$IPT -A OUTPUT  -o $INT2 -j ACCEPT
$IPT -A FORWARD -i $INT2 -j ACCEPT
$IPT -A FORWARD -o $INT2 -j ACCEPT

$IPT -A INPUT  -i $LO -j ACCEPT
$IPT -A OUTPUT -o $LO -j ACCEPT

$IPT -t nat -A POSTROUTING -o $EXT -j MASQUERADE

$IPT -A FORWARD -i $EXT -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A FORWARD -i $EXT -m state --state NEW -j ACCEPT


# Second Server web server ( port :  http )
EXT_IP1=216.205.140.8
INT_IP1=192.168.1.130

#ip addr add $EXT_IP1 dev $EXT
addip $EXT_IP1  $EXT

$IPT -t nat -A PREROUTING  -i $EXT -d $EXT_IP1  -p tcp --dport 80 -j
DNAT --to $
INT_IP1
$IPT -A FORWARD -p tcp  --dport 80 -d $INT_IP1 -j ACCEPT
$IPT -t nat -A POSTROUTING -o $EXT -s $INT_IP1  -j SNAT --to  $EXT_IP1



I have forwarded 216.205.140.8 to 192.168.1.130. I am accessing web page
from 192.168.1.140 machine.


Thanks
-SR





----- Original Message -----
From: "hare ram" <hareram@sol.net.in>
To: "Sundaram Ramasamy" <sun@percipia.com>; <netfilter@lists.netfilter.org>
Sent: Monday, December 23, 2002 9:19 AM
Subject: Re: Accessing machine with public ip address.


> Hi
>
> what is your Present Iptable rules
>
> where are you accessing ?
> what is your PC address ???
>
> what you want to achive
>
> hare
> ----- Original Message -----
> From: "Sundaram Ramasamy" <sun@percipia.com>
> To: <netfilter@lists.netfilter.org>
> Sent: Monday, December 23, 2002 7:28 PM
> Subject: Accessing machine with public ip address.
>
>
> > hi,
> >
> >
> >
> > I have NATed public 216.205.140.8 IP Address into local 192.168.1.130
> > Network address, from my LAN I was not able to access my machine using
> > public IP Address.
> >
> >
> >
> > How will I set my firewall rules? Please help me on this.
> >
> >
> >
> >
> >
> > Thanks
> >
> > SR
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>



  reply	other threads:[~2002-12-23 15:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-23 12:21 Iptables 'hang' David Fokkema
2002-12-23 13:58 ` Accessing machine with public ip address Sundaram Ramasamy
2002-12-23 14:19   ` hare ram
2002-12-23 15:06     ` Sundaram Ramasamy [this message]
2002-12-25  2:32       ` Joel Newkirk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='00ee01c2aa94$ef846c30$8c01a8c0@sundaram' \
    --to=sun@percipia.com \
    --cc=hareram@sol.net.in \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox