Re: iptables problem
- From: Douglas Mayne <doug@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 20 Apr 2007 09:43:20 -0600
On Fri, 20 Apr 2007 08:05:07 +0200, Yvan wrote:
Nedavno Douglas Mayne napisa:I looked at your orginal firewall again. The line which specifies the
The order of IPTables statements is important. The early statement to
drop forwarding looks out of place:
/sbin/iptables -P FORWARD DROP
If I were you, I'd rewrite the script so that you understand what each
line does.
But that script does what I want in FC1. I just copied it to Debian.
I'll check links you posted, thanks.
masquerade also limits the source to a single address. This could be
correct if you were using a squid proxy. Was the former FC1 box running a
squid proxy? If you are not using a proxy, then I think this is the line
which needs to be corrected:
/sbin/iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.0.6/32 -j \
MASQUERADE
This line says to do nat masquerading for packets going out on the ppp0
interface if the source is from the single address (192.168.0.6). Note: I
also corrected some potential typos on the line above.
I hate to tell people what firewall rules to use, because there can be
subtle differences in network topology and requirements. The script below
is adapted from the links I posted earlier. This may be appropriate for
your situation, and then again, maybe not. Always double check that all
commands are appropriate for your system!
#!/bin/bash
# begin source code: rc.firewall
#
# The contents of this file adapted from Rusty Russell's examples:
#
# http://www.netfilter.org/documentation/HOWTO/packet-filtering-HOWTO.html
#
# Use of this software is subject to this license:
# http://www.gnu.org/copyleft/gpl.txt
#
# Assumed router topology:
# This is a simple router where an untrusted network is via ppp0 to
# a totally trusted local LAN. Local "trust" is because packets from
# other unnamed interfaces are accepted by default.
#
# Insert connection-tracking modules (not needed if built into kernel).
#
# These modules allow active mode ftp transfers (ftp initiated on LAN to
# an external ftp site is allowed (related traffic)).
#
insmod ip_conntrack
insmod ip_conntrack_ftp
# Masquerade out ppp0
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
# Create chain which blocks new connections, except if coming from inside.
iptables -N block
iptables -A block -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A block -i ppp0 -m state --state NEW,INVALID -j DROP
iptables -A block -m state --state NEW -i ! ppp0 -j ACCEPT
iptables -A block -j DROP
# Jump to that chain from INPUT and FORWARD chains.
iptables -A INPUT -j block
iptables -A FORWARD -j block
# Turn on IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
# end source code: rc.firewall
--
Douglas Mayne
.
- Follow-Ups:
- Re: iptables problem
- From: Yvan
- Re: iptables problem
- References:
- iptables problem
- From: Yvan
- Re: iptables problem
- From: Douglas Mayne
- Re: iptables problem
- From: Yvan
- iptables problem
- Prev by Date: Re: Searching a command showing RAM contents
- Next by Date: Re: Searching a command showing RAM contents
- Previous by thread: Re: iptables problem
- Next by thread: Re: iptables problem
- Index(es):
Relevant Pages
|
Loading