Skip to contentSkip to conversation

[Fwd: Server machines behind Firewall]

Fwd: Server machines behind Firewall [email protected] 3 participants 6 messages Jan 7, 2005 – Jan 8, 2005

lore
Share & tools
lore
#0 lore raw

Quoted 11 lines · Jason Opperisano
Quoted 3 lines · On Thu, Jan 06, 2005 at 12:14:16AM +0800, [email protected] wrote:

Dear All,

Is there a sample ( nat scripts ) for the title ?

EXT_IF="eth0"
INT_IF="eth1"
SRV1="10.1.1.10"

iptables -t nat -A PREROUTING -i $EXT_IF -p tcp --dport 80 \
� -j DNAT --to-destination $SRV1

I want to know why needn't to define the original IP ( Public IP ) ? eg :

iptables -t nat -A PREROUTING -i $EXT_IF -p tcp -s 202.175.xxx.xxx --dport 80 \
� -j DNAT --to-destination 192.168.xxx.xxx

Sorry, what useful about the following function ( command line ) ?

Quoted 2 lines

iptables -A FORWARD -i $EXT_IF -o $INT_IF -p tcp --syn -d $SRV1 \
� --dport 80 -j ACCEPT

In additional, if I want to setup a NAT ( 192.168.101.0/24 ) with a Server machines ( 192.168.100.1 ) behind Firewall...
So, is there more than one sample ( nat scripts ) for reference ?

Edward.

#1 lore raw
Quoted 7 lines · On Fri, Jan 07, 2005 at 11:07:10PM +0800, [email protected] wrote:
Quoted 6 lines

EXT_IF="eth0"
INT_IF="eth1"
SRV1="10.1.1.10"

iptables -t nat -A PREROUTING -i $EXT_IF -p tcp --dport 80 \
? -j DNAT --to-destination $SRV1

Quoted 6 lines

I want to know why needn't to define the original IP ( Public IP ) ? eg :

iptables -t nat -A PREROUTING -i $EXT_IF -p tcp -s 202.175.xxx.xxx --dport 80 \
? -j DNAT --to-destination 192.168.xxx.xxx

you can; if the original, public IP is different from the firewall's external IP. if you want specify the original DESTINATION of the packet, you would use "-d" not "-s" like so:

  iptables -t nat -A PREROUTING -i $EXT_IF -p tcp -d $PUB_IP \
    --dport 80 -j DNAT --to-destination $SRV1
Quoted 4 lines

Sorry, what useful about the following function ( command line ) ?

Quoted 2 lines

iptables -A FORWARD -i $EXT_IF -o $INT_IF -p tcp --syn -d $SRV1 \
? --dport 80 -j ACCEPT

um--it allows the packet through the FORWARD chain of the filter table. remember--you're trying to build a firewall here.

Quoted 3 lines

In additional, if I want to setup a NAT ( 192.168.101.0/24 ) with a Server machines ( 192.168.100.1 ) behind Firewall...
So, is there more than one sample ( nat scripts ) for reference ?

go read everything linked from the netfilter home page in the docs section:

http://netfilter.org/documentation/index.html

-j

--
"Dear Mr. President, there are too many states nowadays, please
eliminate three. I am not a crackpot."
--The Simpsons

#2 lore raw
Quoted 7 lines · Jason Opperisano
Quoted 4 lines

Sorry, what useful about the following function ( command line ) ?

Quoted 2 lines

iptables -A FORWARD -i $EXT_IF -o $INT_IF -p tcp --syn -d $SRV1 \
? --dport 80 -j ACCEPT

um--it allows the packet through the FORWARD chain of the filter table. remember--you're trying to build a firewall here.

So, must I enable this kind of function for using the Firewall ?

#3 lore raw
Quoted 11 lines · On Fri, Jan 07, 2005 at 11:45:32PM +0800, [email protected] wrote:
Quoted 7 lines · Jason Opperisano
Quoted 4 lines

Sorry, what useful about the following function ( command line ) ?

Quoted 2 lines

iptables -A FORWARD -i $EXT_IF -o $INT_IF -p tcp --syn -d $SRV1 \
? --dport 80 -j ACCEPT

um--it allows the packet through the FORWARD chain of the filter table. remember--you're trying to build a firewall here.

So, must I enable this kind of function for using the Firewall ?

if you want your machine to be an actual firewall, yes. if you're building a NAT router--then no.

-j

--
"I bent my wookie."
--The Simpsons

#4 lore raw
In reply to [email protected]
Quoted 4 lines · On Fri, 7 Jan 2005 [email protected] wrote:
Quoted 2 lines · Jason Opperisano
Quoted 2 lines

Sorry, what useful about the following function ( command line ) ?

Quoted 10 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

iptables -A FORWARD -i $EXT_IF -o $INT_IF -p tcp --syn -d $SRV1 \
? --dport 80 -j ACCEPT

um--it allows the packet through the FORWARD chain of the filter table. remember--you're trying to build a firewall here.

So, must I enable this kind of function for using the Firewall ?

unless the firewall(ed) system is a stand alone <no other ststems on the network> then yes, if you wish to forward or pass traffic to the internet and the other systems. A stand alone box with a firewall can get by with just input and output rules.

Thanks,

Ron DuFresne

Signature · 11 lines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        admin & senior security consultant:  sysinfo.com
                        http://sysinfo.com

...Love is the ultimate outlaw.  It just won't adhere to rules.
The most any of us can do is sign on as it's accomplice.  Instead
of vowing to honor and obey, maybe we should swear to aid and abet.
That would mean that security is out of the question.  The words
"make" and "stay" become inappropriate.  My love for you has no
strings attached.  I love you for free...
                        -Tom Robins <Still Life With Woodpecker>
#5 lore raw
Quoted 12 lines · R. DuFresne
Quoted 10 lines · On Fri, 7 Jan 2005 [email protected] wrote:
Quoted 7 lines · Jason Opperisano
Quoted 4 lines

Sorry, what useful about the following function ( command line ) ?

Quoted 2 lines

iptables -A FORWARD -i $EXT_IF -o $INT_IF -p tcp --syn -d $SRV1 \
? --dport 80 -j ACCEPT

um--it allows the packet through the FORWARD chain of the filter table. remember--you're trying to build a firewall here.

Quoted 7 lines
Quoted 2 lines

So, must I enable this kind of function for using the Firewall ?

unless the firewall(ed) system is a stand alone <no other ststems on the network> then yes, if you wish to forward or pass traffic to the internet and the other systems.  A stand alone box with a firewall can get by with just input and output rules.

Actually, there is only one machine for me to setup a system ( network ) for Internet...
So, I'm planning the following functions with a single machine :
Firewall + Internet Server ( eg : DNS, WWW, Mail , FTP behind Firewall ) + NAT ( for other PCs / Clients connect to Internet ).

PS : There are TWO Network Interface with the single machine ( I think one port connect with leased line / boardband, another one port with HUB to other Clients )

Is there a sample nat scripts for using the multi-functions ?

Edward.