Skip to contentSkip to conversation

default policies for the NAT chains

DISCUSSION Michael Gale 2 participants 4 messages Dec 3, 2003

lore
Share & tools
lore
#0 lore raw

Hello,

Ok -- I had my firewall working perfectly with a default policy in affect:
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

It was also working great for the 22 virtual IP addresses.

I then though about the NAT chains (PREROUTING,OUTPUT and POSTROUTING) and figured they should have a default policy as well.

I added that to the list and not I can not start a out going connection from the firewall.

So my question is do I need default policies for the NAT chains ? If so it would seem like I need some rules added twice ?

Any suggestions would be appreciated :)

Signature · 3 lines
Michael Gale
Network Administrator
Utilitran Corporation
#1 lore raw

Hello,

Let me explain how my firewall rules work -- it most likely will help in the answer to my question.

When the firewall starts it sets up some basic target and a large amount of user chains.

I have 24 chains -- ok not that many

Here are the following chains (not all):

tablerule-ext : this is a chain rule setup the filters incoming packets regardless of destination, here I weed out any unwanted packets or connections. Any matching packets are logged then drop.

tablerule-extpri : this chain is only for packets destination to the heartbeat address. Here only heartbeat packets are matched and everything else dropped.

tablerule-extVIP : I have one chain for every virtual IP, depending on the destination IP of the packet. will depend on what chain it is forwarded to.

So the main filter table has rules that most forward packets to other chains.

Any example is if a packet wants to come in, go out or be forwarded for 172.16.15.56:
1. It goes to the tablerule-ext and checked to make sure the packet is in good standing (TCP flags, port range, from - to ...) if accept it is returned

2. Then it goes to the tablerule-56 chain where it is either dropped or accept depending on the traffic I want for the .56 address.

This way I can easily administer any IP address with out affecting any other connection. Since almost everything is chain based I have flush and change chain rules for block them very easily.

So do I still need to have a default policy for the NAT table chains ?

Michael.

Quoted 22 lines · On Tue, 2 Dec 2003 18:03:02 -0700 Michael Gale <[email protected]> wrote:

Hello,

Ok -- I had my firewall working perfectly with a default policy in affect:
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

It was also working great for the 22 virtual IP addresses.

I then though about the NAT chains (PREROUTING,OUTPUT and POSTROUTING) and figured they should have a default policy as well.

I added that to the list and not I can not start a out going connection from the firewall.

So my question is do I need default policies for the NAT chains ? If so it would seem like I need some rules added twice ?

Any suggestions would be appreciated :)

Signature · 3 lines
Michael Gale
Network Administrator
Utilitran Corporation
Signature · 3 lines
Michael Gale
Network Administrator
Utilitran Corporation
#2 lore raw
In reply to Michael Gale
Quoted 1 line

So my question is do I need default policies for the NAT chains ?

Michael, it is not necessary for you to specify default policies for the NAT table chains, as dealing with the packets when they get to the FILTER table chains will be sufficient. To illustrate my point, look at figure 3b in the following document ...
http://ebtables.sourceforge.net/br_fw_ia/br_fw_ia.html#section3
The arrow to the extreme left pointing up is where a packet would "enter" your server from the outside. No matter which path it takes till it gets to the "down" arrow at the extreme right, it will pass through either the INPUT, OUTPUT, or FORWARD chains of the FILTER table. Also, any packets destined for your server will hit the INPUT chain first, giving you the opportunity to deal with them. So if you don't specifically have an accept rule defined in the chains of your FILTER table, then packets you haven't intended to ACCEPT/DROP/"whatever" will be dropped before they either exit or pass through your server.

I hope this answers your question,
Brandon Broyles

#3 lore raw

Hello,

Thank you for your response, you did answer my question.

Michael.

Quoted 21 lines · On Tue, 2 Dec 2003 22:21:08 -0500 <[email protected]> wrote:
Quoted 1 line

So my question is do I need default policies for the NAT chains ?

Michael, it is not necessary for you to specify default policies for the NAT table chains, as dealing with the packets when they get to the FILTER table chains will be sufficient. To illustrate my point, look at figure 3b in the following document ...
http://ebtables.sourceforge.net/br_fw_ia/br_fw_ia.html#section3
The arrow to the extreme left pointing up is where a packet would "enter" your server from the outside. No matter which path it takes till it gets to the "down" arrow at the extreme right, it will pass through either the INPUT, OUTPUT, or FORWARD chains of the FILTER table. Also, any packets destined for your server will hit the INPUT chain first, giving you the opportunity to deal with them. So if you don't specifically have an accept rule defined in the chains of your FILTER table, then packets you haven't intended to ACCEPT/DROP/"whatever" will be dropped before they either exit or pass through your server.

I hope this answers your question,
Brandon Broyles

Signature · 3 lines
Michael Gale
Network Administrator
Utilitran Corporation