Advertisement

07.26.2004 at 02:29PM PDT, ID: 21071935
[x]
Attachment Details

IPTABLES: NAT and FORWARD

Asked by telman in Linux Network Security

Tags: , ,

Hi,


I am trying to setup a spam filter gateway. We have iptables firewall running on Linux box. Our firewall is connected to the public internet and ip addresses behind firewall are public too.

So I want to redirect email traffic to the spam filter gateway using iptables.
Currently I am using forward rules to forward rules to forward my traffic from eth0 to eth1

   e.g.
    iptables -P INPUT DROP
    iptables -P FORWARD DROP
    iptables -P OUTPUT ACCEPT
    iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
    iptables -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 80  -j ACCEPT
    iptables -A FORWARD -p tcp -s 0/0 -d 0/0--dport 443 -j ACCEPT

However I assumed I will have to use NAT to redirect emails to the spam gateway.
 
  iptables -P INPUT DROP
  iptables -P FORWARD DROP
  iptables -P OUTPUT ACCEPT
  iptables -t nat -P PREROUTING DROP
  iptables -t nat -P POSTROUTING DROP

  iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
  iptables -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 80  -j ACCEPT
  iptables -A FORWARD -p tcp -s 0/0 -d 0/0--dport 443 -j ACCEPT

  iptables -A PREROUTING -i eth0 -t nat -p tcp -s 0/0 -d <Public_ip_1> --dport 25 -j DNAT --to-destination <Public_ip_2>:25

1. Can I use forward chain rules and NAT the same time?
2. Do I need to load NAT modules in  /etc/sysconfig/iptables-config?
3. Can I redirect public ip to public ip address or I will have to map public to non-public?
4. What will happen if I do not change default policy for NAT?
5. How do list rules for NAT?
6. Do I need to assign ip address to eth0 (external interface) in order use nat?


I enabled NAT today and firewall went down.


Thanks,

TelmanStart Free Trial
[+][-]07.26.2004 at 02:36PM PDT, ID: 11641885

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.27.2004 at 08:47AM PDT, ID: 11647646

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.27.2004 at 10:24AM PDT, ID: 11648702

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.27.2004 at 11:29PM PDT, ID: 11653862

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Linux Network Security
Tags: iptables, nat, forward
Sign Up Now!
Solution Provided By: ahoffmann
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.28.2004 at 09:16AM PDT, ID: 11658194

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32