Re: myrules comment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Original Message -----
From: Jason Opperisano <opie@xxxxxxxxxxx>
Date: Thursday, February 3, 2005 7:48 pm
Subject: Re: myrules comment

> On Wed, 2005-02-02 at 23:58, varun_saa@xxxxxxxx wrote:
> > Hello,
> >      My server is Mandrake 10.1
> > eth0 is WAN with static IP connected to 512k DSL
> > eth1 is LAN.
> > 
> > Basically I want clients to able to :
> > 
> > 1. send and recieve mails
> 
> internal users sending mail:
> 
>  iptables -A FORWARD -i eth1 -o eth0 -p tcp --syn \
>    --sport 1024: --dport 25 -j ACCEPT
> 
> internal users receiving mail via pop3:
> 
>  iptables -A FORWARD -i eth1 -o eth0 -p tcp --syn \
>    --sport 1024: --dport 110 -j ACCEPT
> 
> > 2. browse the net through squid
> 
> internal users connecting to squid:
> 
>  iptables -A INPUT -i eth1 -p tcp --syn \
>    --sport 1024: --dport 3128 -j ACCEPT
> 
> squid proxy fetching content from the internet:
> 
>  iptables -A OUTPUT -p udp \
>    --sport 1024: --dport 53 -j ACCEPT
> 
>  iptables -A OUTPUT -o eth0 -p tcp --syn \
>    -m owner --uid-owner squid \
>    --sport 1024: --dport 80 -j ACCEPT
> 
> > 3. Use MSN or Yahoo
> 
> msn:
> 
>  iptables -A FORWARD -i eth1 -o eth0 -p tcp --syn \
>    --sport 1024: --dport 1863 -j ACCEPT
> 
> yahoo:
> 
>  iptables -A FORWARD -i eth1 -o eth0 -p tcp --syn \
>    --sport 1024: --dport 5050 -j ACCEPT
> 
> > My iptables config is as follows :
> > 
> > # Generated by iptables-save v1.2.9 on Thu Oct 21 05:32:36 2004
> > *nat
> > :OUTPUT ACCEPT [0:0]
> > :PREROUTING ACCEPT [0:0]
> > :POSTROUTING ACCEPT [0:0]
> > -A POSTROUTING -o eth0 -j MASQUERADE
> > COMMIT
> > # Completed on Thu Oct 21 05:32:36 2004
> > # Generated by iptables-save v1.2.9 on Thu Oct 21 05:32:36 2004
> > *mangle
> > :PREROUTING ACCEPT [32056:3889577]
> > :INPUT ACCEPT [32010:3885659]
> > :FORWARD ACCEPT [0:0]
> > :OUTPUT ACCEPT [31637:4617585]
> > :POSTROUTING ACCEPT [31639:4618071]
> > COMMIT
> > # Completed on Thu Oct 21 05:32:36 2004
> > # Generated by iptables-save v1.2.9 on Thu Oct 21 05:32:36 2004
> > *filter
> > :FORWARD DROP [0:0]
> > :INPUT DROP [0:0]
> > :OUTPUT ACCEPT [0:0]
> > -A INPUT -j ACCEPT
> 
> every INPUT rule after this is ignored, as you have just accepted all
> packets,
> 
> > -A INPUT -s 127.0.0.1 -j ACCEPT
> > -A INPUT -p tcp -m tcp -i eth1 --dport 3128 -j ACCEPT
> > -A INPUT -p udp -m udp -i eth1 --dport 3128 --sport 80 -j ACCEPT
> > -A INPUT -s 62.0.0.0/255.0.0.0 -i eth0 -j REJECT
> > -A INPUT -p tcp -m tcp -s 217.81.0.0/255.255.0.0 -i eth0 -j REJECT
> > -A INPUT -i eth0 -j DROP
> > -A INPUT -p tcp -m tcp -i eth1 --sport 80 -j DROP
> > -A INPUT -m state -i eth1 --state ESTABLISHED,RELATED -j ACCEPT
> > -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
> 
> excellent.
> 
> > -A FORWARD -i eth1 -o eth0 -p tcp --syn --sport 1024 --dport 25 -
> j ACCEPT
> > -A FORWARD -i eth1 -o eth0 -p tcp --syn --sport 1024 --dport 110 -
> j ACCEPT 
> 
> those rules will only match packets that have a source port of exactly
> 1024--which won't be many packets.  i think you mean "1024:"
>   
> -j
> 
>Yes that was a typo error.
Thanks a lot for your inputs.
I trying to understand.

Varun



[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux