Re: Writing firewall rules with iptables
- From: John-Paul Stewart <jpstewart@xxxxxxxxxxxxxxxx>
- Date: Tue, 27 Feb 2007 10:29:42 -0500
bzaman.laskar@xxxxxxxxx wrote:
Hi All,
I am writing firewell rules using iptables to allow icmp traffic
from 211.xxx.117.211 to
211.41.125.4 and vice versa . For this I have written rule 2 and
3. But after writing the rule
I cannot ping from either ends. But if I stop the firewall , it
pings . That means the network
is O.K but there is some problem with the rules that I have
written .
Please tell me how to write the rule correctly.
[root@localhost ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 127.0.0.1 0.0.0.0/0
ACCEPT icmp -- 211.xxx.117.211 211.41.125.4
ACCEPT icmp -- 211.41.125.4 211.xxx.117.211
ACCEPT icmp -- 211.xxx.117.0/24 211.xxx.117.211
ACCEPT tcp -- 211.xxx.117.0/28 211.xxx.117.211 tcp dpt:
22
ACCEPT udp -- 211.xxx.117.211 211.41.99.3 udp dpt:
53
ACCEPT udp -- 211.41.99.3 211.xxx.117.211 udp spt:
53
ACCEPT tcp -- 211.xxx.117.211 0.0.0.0/0 tcp dpt:
80
ACCEPT tcp -- 0.0.0.0/0 211.xxx.117.211 tcp spt:
80
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-
with icmp-port-unreachable
Chain FORWARD (policy ACCEPT)
target prot opt source destination
The INPUT rules tell the firewall to accept ICMP packets for 211.xxx.117.211 and 211.41.125.4. Unless the firewall machine is at both of those addresses that's not what you want. By the sounds of it, you want to FORWARD those packets---you want your firewall to pass the packets between the two hosts/networks. Move your rules from the INPUT to the FORWARD chains.
Remember that the iptables ACCEPT chain is used to accept/reject packets destined for the machine running iptables. The FORWARD chain is used to control the passing of packets from one network to another.
BTW, you might want to re-think the default policy of accepting everything on those chains, too! As it is now, your firewall will FORWARD anything.
.
- References:
- Writing firewall rules with iptables
- From: bzaman . laskar
- Writing firewall rules with iptables
- Prev by Date: modinfo searching
- Next by Date: Re: gzip / compression problems
- Previous by thread: Writing firewall rules with iptables
- Next by thread: do u know??/
- Index(es):
Relevant Pages
|