Re: Restrict LAN users to send mail to Internet but allow to send mail to other LAN user.

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

 



On Wed, Oct 27, 2004 at 07:58:28AM -0700, ads nat wrote:
> Hi,
> I will elaborate my problem.
> 
> I am looking for solution for following problem.
> 
> I have A Linux interent gateway server having 3 NIC
> cards 
> 1) eth0 connected to internet.
> 2) eth1 connected to private LAN (192.168.0.1.)
> 3) eth2 connected to DMZ server.(10.0.0.1)
> 
> DMZ server is with one LAN card (eth0 : 10.0.0.2)
> 
> On DMZ, DNS, Web and sendmail are installed.
> Iptables prerouting rules are set on Gateway server so
> that users from LAN 192.168.0.0 can acess web as well
> as mail server.
> 
> Now I want to allow LAN users to send emails to each
> other on LAN but want to allow some LAN users to send
> email to Internet(Outside world).
> Is there any way using Linux iptables firewall to
> acieve this requirement.
> 
> thanks for support.

  # allow all LAN users to connect to DMZ mail server
  iptables -A FORWARD -i eth1 -o eth2 -p tcp --syn --dport 25 \
    -s 192.168.0.0/24 -d 10.0.0.2 -j ACCEPT

  # allow special machine to send mail directly to internet
  iptables -A FORWARD -i eth1 -o eth0 -p tcp --syn --dport 25 \
    -s $special_machine_IP -j ACCEPT

assuming you're running a "deny all, allow specific" type rulebase,
you're done.  if you're running an "allow all" rulebase, you'll need to
add:

  iptables -A FORWARD -i eth1 -p tcp --syn --dport 25 -j REJECT

-j

-- 
Jason Opperisano <opie@xxxxxxxxxxx>


[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