Linux Netfilter discussions
 help / color / mirror / Atom feed
From: list user <xktnniuymlla@mailinator.com>
To: netfilter@lists.netfilter.org
Subject: Re: Connection through gateway fails in a random basis
Date: Mon, 31 Jul 2006 10:03:54 -0700	[thread overview]
Message-ID: <44CE37FA.4050005@mailinator.com> (raw)
In-Reply-To: <20060730221120.7668ee28.pedro.werneck@terra.com.br>

Pedro Werneck wrote:
> Hi all
> 
> 
> Something that seems simple here, but I cannot find anything wrong
> 
> I have two machines here, A and B. A have eth0 and eth1, and a DSL
> connection (ppp0) with the modem connected to eth0. B have eth0. I have
> A.eth1 connected to B.eth0, and I'm trying to use A as a gateway for B.
> 
> It works, from B I can reach anything I can do from A, with ping,
> tracereroute and resolve names, but I can't use other protocols like
> HTTP, FTP, IRC, and it seems to happen on a random basis. Sometimes it
> works, sometimes it waits for data until timeout... I tried to find a 
> pattern on it but I couldn't. I tried to use LOG and netwatch on ppp0
> and eth1 to debug it, there's no data coming from the remote on these 
> cases.
> 
> Someone suggested I should upgrade the kernel, so I'm using the latest
> version, 2.6.17.7 #4, but still doesn't work...
> 
> 
> Here's the ruleset I'm using on the gateway... pretty simple
> 
> <code>
> #!/bin/bash 
> 
> echo 1 > /proc/sys/net/ipv4/ip_forward 
> 
> IPT="iptables --verbose"
> 
> $IPT -F
> $IPT -t nat -F
> 
> $IPT -P INPUT ACCEPT
> $IPT -P OUTPUT ACCEPT
> $IPT -P FORWARD ACCEPT
> 
> $IPT -A INPUT -j ACCEPT -i lo
> $IPT -A INPUT -j ACCEPT -s 192.168.1.0/24
> $IPT -A INPUT -i ppp0 -m state --state ESTABLISHED,RELATED -j ACCEPT
> $IPT -A INPUT -j ACCEPT -p tcp --dport 3306
> $IPT -A INPUT -j ACCEPT -p tcp --dport 3690
> $IPT -A INPUT -j ACCEPT -p tcp --dport 8000:8010
> $IPT -A INPUT -j ACCEPT -p tcp --dport 8021
> $IPT -A INPUT -j ACCEPT -p tcp --dport 8022
> $IPT -A INPUT -j ACCEPT -p tcp --dport 8080
> 
> $IPT -A FORWARD -j ACCEPT -i ppp0 
> $IPT -A FORWARD -j ACCEPT -s 192.168.1.0/24
> $IPT -A FORWARD -j DROP
> 
> $IPT -t nat -A POSTROUTING -s 192.168.1.0/24 -o ppp0 -j MASQUERADE
> </code>
> 
> And here's the modules I have loaded (lsmod | grep ip), in case
> something is missing and I haven't noticed:
> 
> ipt_LOG                 5440  0 
> ipt_MASQUERADE          2560  1 
> iptable_mangle          2240  0 
> iptable_nat             5636  1 
> ip_nat                 12844  2 ipt_MASQUERADE,iptable_nat
> ip_conntrack           36564  4 ipt_MASQUERADE,xt_state,iptable_nat,ip_nat
> iptable_filter          2240  1 
> ip_tables               9944  3 iptable_mangle,iptable_nat,iptable_filter
> x_tables                9668  6 ipt_LOG,xt_tcpudp,ipt_MASQUERADE,xt_state,iptable_nat,ip_tables
> 
> 
> Since it seems something very weird, I'm asking for your help here.
> Any idea about what's wrong here ?

Hi Pedro,

I can't answer your question but I can point out what looks like a 
serious error in your rules -- the firewall is wide open.  You should 
either change your default policy on the INPUT chain to DROP, or you 
should append a rule "-A INPUT -j DROP".

For my personal preference I always start with no rules and default 
policy of DROP on both INPUT and FORWARD, then begin adding rules to 
allow specific traffic.

Mike Wright

> 
> 
> Thanks...
> 



  reply	other threads:[~2006-07-31 17:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-31  1:11 Connection through gateway fails in a random basis Pedro Werneck
2006-07-31 17:03 ` list user [this message]
2006-07-31 17:53   ` Pedro Werneck
2006-07-31 18:07     ` Pascal Hambourg
2006-07-31 19:22       ` Pedro Werneck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44CE37FA.4050005@mailinator.com \
    --to=xktnniuymlla@mailinator.com \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox