Skip to contentSkip to conversation

Help with ICMP Ruls

DISCUSSION Real Cucumber 3 participants 4 messages Jul 15, 2004

lore
Share & tools
lore
#0 lore raw

I do have a state rule already for allowing any
established,related connections.

So should I add another one such as:

iptables -A FORWARD -p icmp -m state --state RELATED -j ACCEPT

The current ruleset is attached (I've only excluded the variables and logging sections of it).

__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

Quoted 10 lines · Real Cucumber
Quoted 4 lines

I would allow the firewall to send ICMP messages through its OUTPUT chain, and if it can generate any connections from itself, then you should allow them in through the INPUT chain as well, however you say you do not allow outgoing connections (not even DNS??), so this may not be needed.

The fedora box doesn't do dns or anything. It's sole purpose is a packet forwarding router that doesnt' allow any input or output, just forwards.

That is why I'm not sure if I need ICMP supported on it or not, and not sure where do add the ICMP support (input, output, forward).

I would allow the machine to forward ICMP messages which are RELATED to the existing SSH sessions, so that means the rule should go in the FORWARD chain.

If you want more specific advice, please post the current ruleset.

Regards,

Antony.

Signature · 10 lines
In Heaven, the police are British, the chefs are Italian, the beer is Belgian, 
the mechanics are German, the lovers are French, the entertainment is 
American, and everything is organised by the Swiss.

In Hell, the police are German, the chefs are British, the beer is American, 
the mechanics are French, the lovers are Swiss, the entertainment is Belgian, 
and everything is organised by the Italians.

                                                     Please reply to the list;
                                                           please don't CC me.

# This will set all default policies to DROP
iptables -P FORWARD DROP
iptables -P INPUT DROP
iptables -P OUTPUT DROP

# Enable Loopback Interface
iptables -A INPUT -i $LOOPBACK_INTERFACE -j ACCEPT iptables -A OUTPUT -o $LOOPBACK_INTERFACE -j ACCEPT

# Protect against Source-Address Spoofing (Ingress/Egress) iptables -A FORWARD -i $WAN_INTERFACE -s $WAN_ADDRESSES -j DROP iptables -A FORWARD -i $WAN_INTERFACE -s $LAN_ADDRESSES -j DROP iptables -A FORWARD -o $WAN_INTERFACE -s $WAN_ADDRESSES -j DROP

# Allow previously initiated and accepted connections

# to bypass firewall tests (state matching)
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

# Remove INVALID state packets to stablize state connections iptables -A INPUT -m state --state INVALID -j DROP iptables -A OUTPUT -m state --state INVALID -j DROP iptables -A FORWARD -m state --state INVALID -j DROP

# This will allow SSH in/out from TIC ADMIN IP to LAN interface iptables -A INPUT -p tcp --dport $WAN_SSH_PORT -i $LAN_INTERFACE -j ACCEPT iptables -A OUTPUT -p tcp --sport $WAN_SSH_PORT -o $LAN_INTERFACE -j ACCEPT

# This will allow SSH forwarding from/to INT_SERVER Server iptables -A FORWARD -s $INT_SERVER_IP -j ACCEPT iptables -A FORWARD -d $INT_SERVER_IP -j ACCEPT

# This will forward inbound WAN SSH to LAN INT_SERVER with port remapping
iptables -t nat -A PREROUTING -p tcp --dport $WAN_SSH_PORT -i $WAN_INTERFACE -j DNAT --to $INT_SERVER_IP:$INT_SERVER_SSH_PORT

#1 lore raw
Quoted 8 lines · Real Cucumber

I do have a state rule already for allowing any
established,related connections.

So should I add another one such as:

iptables -A FORWARD -p icmp -m state --state RELATED -j ACCEPT

Quoted 8 lines

The current ruleset is attached (I've only excluded the variables and logging sections of it).

# Allow previously initiated and accepted connections

# to bypass firewall tests (state matching)
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

If you have this three generic rules, you don't need separate rule just for ICMP. The generic rule will match all IP protocols (tcp, udp, and icmp).

Signature · 3 lines
Aleksandar Milivojevic <[email protected]>    Pollard Banknote Limited
Systems Administrator                           1499 Buffalo Place
Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7
#2 lore raw
In reply to Real Cucumber
Quoted 2 lines · Real Cucumber

I do have a state rule already for allowing any
established,related connections.

In that case you are already allowing ICMP :)

Quoted 4 lines

So should I add another one such as:

iptables -A FORWARD -p icmp -m state --state RELATED -j ACCEPT

No. ICMP messages which are RELATED to the existing SSH connections will get
matched by the final rule in this section of your rules:

# Allow previously initiated and accepted connections

# to bypass firewall tests (state matching)
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

Just out of interest, why do you have the first two of these rules, if you have no INPUT or OUTPUT traffic?

Regards,

Antony.

Signature · 6 lines
Microsoft may sell more software than any other company, but McDonald's sell 
more burgers than any other company, and I think the other similarities are 
obvious...

                                                     Please reply to the list;
                                                           please don't CC me.
#3 lore raw

I allow myself restricted by IP to connect in for SSH on the LAN interface on the fedora box.

However, no Input/Output is alowed on the WAN
interface though.

Sorry I guess I lied/misled by saying "NO" input/output - as I was just referring to the WAN.

Quoted 29 lines · --- Antony Stone
Quoted 2 lines · Real Cucumber

I do have a state rule already for allowing any
established,related connections.

In that case you are already allowing ICMP :)

Quoted 3 lines

So should I add another one such as:

iptables -A FORWARD -p icmp -m state --state

RELATED

Quoted 1 line

-j ACCEPT

No. ICMP messages which are RELATED to the
existing SSH connections will get
matched by the final rule in this section of your
rules:

# Allow previously initiated and accepted
connections

# to bypass firewall tests (state matching)
iptables -A INPUT -m state --state
ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state
ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state
ESTABLISHED,RELATED -j ACCEPT
Quoted 22 lines

Just out of interest, why do you have the first two of these rules, if you
have no INPUT or OUTPUT traffic?

Regards,

Antony.

Signature · 10 lines
Microsoft may sell more software than any other
company, but McDonald's sell 
more burgers than any other company, and I think the
other similarities are 
obvious...

                                                    
Please reply to the list;
                                                    
      please don't CC me.

__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail