Re: Firewall with Iptables
- From: Stefan Malte Schumacher <s.schumacher@xxxxxxxxxxxxx>
- Date: Sat, 5 Jan 2008 19:53:38 +0100
The marked rule accepts only packets in the NEW state. You need to
accept packets in the ESTABLISHED and RELATED states too, else
connections will hang after the first packet. Usually there is a generic
rule at the beginning of the chain accepting packets in the ESTABLISHED
and RELATED states from any interface. So removing the "-i ppp0" in the
previous rule should do the trick.
Thanks for the advice. I have changed the rule so that it accepts
anything on "! ppp0" regardless of its state and now access to local
services and forwarding works fine without any additional ACCEPT-lines
in the script.
Unfortunately another problem has arisen. I wish for a local service
(mldonkey) to be accessible from the internet, but despite the rules I
set in the marked lines connections from outside are not yet possible.
I have also tried to target the INPUT chain instead of my custom chain
tcprules, but the results are the same.
iptables -t filter -P INPUT DROP
iptables -t filter -P FORWARD DROP
iptables -t filter -P OUTPUT ACCEPT
iptables -t filter -N tcprules
iptables -t filter -A tcprules -i ppp0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t filter -A tcprules -i ppp0 -m state --state NEW,INVALID -j DROP
iptables -t filter -A tcprules -i ! ppp0 -j ACCEPT
iptables -t filter -A tcprules -i ppp0 -p tcp -m multiport --dports 4662,6881,6882,9866 -j ACCEPT
iptables -t filter -A tcprules -i ppp0 -p udp -m multiport --dports 4666,9866,12478 -j ACCEPT
iptables -t filter -A INPUT -j tcprules
iptables -t filter -A FORWARD -j tcprules
iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.99.0/24 -d 0/0 -j MASQUERADE
Yours sincerely
Stefan
.
- Follow-Ups:
- Re: Firewall with Iptables
- From: Andy Furniss
- Re: Firewall with Iptables
- From: Clifford Kite
- Re: Firewall with Iptables
- References:
- Firewall with Iptables
- From: Stefan Malte Schumacher
- Re: Firewall with Iptables
- From: Pascal Hambourg
- Firewall with Iptables
- Prev by Date: Re: Firewall with Iptables
- Next by Date: Re: Linux free port allocation algorithm
- Previous by thread: Re: Firewall with Iptables
- Next by thread: Re: Firewall with Iptables
- Index(es):
Relevant Pages
|