Skip to contentSkip to conversation

ip forwarding: client has stalling problems

DISCUSSION SainTiss 2 participants 5 messages Jan 20, 2006 – Jan 21, 2006

lore
Share & tools
lore

SainTiss

author
#0 lore raw

Hi,

I just set up IP forwarding on a 2.6.12 debian system (server) and a 2.6.12 ubuntu client. I used this script:

#!/bin/sh
export PATH=$PATH:/sbin

# first empty everything
iptables -F
iptables -t nat -F
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
# this lets all established connections through
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# allow incoming packets if they are a reply to packets from this computer
iptables -A INPUT -p tcp ! --syn -j ACCEPT
# lets some connections to this computer
iptables -A INPUT -m state --state NEW -p tcp -m multiport --dports 
113,22,4662,2735,1731,6891,2566,1919,9876,2234,3707,6881,6346 -j ACCEPT

iptables -A INPUT -m state --state NEW -s 127.0.0.1 -p all -j ACCEPT iptables -A INPUT -m state --state NEW -s 192.168.0.1 -p all -j ACCEPT

iptables -A INPUT -m state --state NEW -i eth0 -j ACCEPT iptables -A INPUT -m state --state NEW -s 192.168.0.2 -p udp -j ACCEPT

iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT

# logs everything not accepted earlier
iptables -A INPUT -j LOG --log-level info --log-prefix "IPT INPUT REJECT: "
# let forwarded ready connections through
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
# let anything from your internal lan machines to net and back
iptables -A FORWARD -m state --state NEW -i eth0 -j ACCEPT
iptables -A FORWARD -m state --state NEW -s 192.168.0.2/24 -j ACCEPT
# logs everything not accepted earlier
iptables -A FORWARD -j LOG --log-level info --log-prefix "IPT FORWARD REJECT:"
# this is the masquerading
# all the masquerading in iptables is done in NAT table
iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.0.2 -j MASQUERADE

-------------

I also echo 1 to /proc/sys/net/ipv4/ip_forward.

I am able to e.g. ping www.google.com on the client, so it is basically working. However, whenever it is supposed to keep a connection for a longer time, then it just stalls. e.g. when I want to scp something off a server, or apt-get update or something similar, it creates the connection all right, but just downloads a minimal amount or even nothing, then just stalls.

Server routing table:
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
86-39-33-1.cust *               255.255.255.255 UH    0      0        0 ppp0
localnet        *               255.255.255.0   U     0      0        0 eth0

default 86-39-33-1.cust 0.0.0.0 UG 0 0 0 ppp0

Client routing table:
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0

Any hints?

Thanks in advance,

Hans

Signature · 16 lines
If we cannot live so as to be happy, let us at least live so as to deserve it
 -- Immanuel Hermann Fichte

People are promoted up to their level of incompetence
 -- Peter's Principle

Ark Linux - Linux for the Masses (http://arklinux.org)

Hans Schippers
Aspirant FWO - Vlaanderen
Formal Techniques in Software Engineering (FoTS)
University of Antwerp
Middelheimlaan 1
2020 Antwerpen - Belgium
Phone: +32 3 265 38 71
Fax: +32 3 265 37 77
#1 lore raw
Quoted 2 lines · SainTiss

I just set up IP forwarding on a 2.6.12 debian system (server) and a 2.6.12 ubuntu client. I used this script:

Either upgrade to a more recent kernel in the 2.6.x series or disable TCP window tracking by

# echo 1 > /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_be_liberal

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary
author
#2 lore raw

Thanks for the tip,

However, after I did this both on server and client, nothing changed... Also, using 2.6.8 on the server doesn't help...

Did I maybe misunderstand (e.g. do I have to restart something after echo'ing?) or maybe something else is the cause?

Also, is it the kernel on the server which is too "old", or the client one, or both?

Thanks,

Hans

Quoted 16 lines · Jozsef Kadlecsik
Quoted 2 lines · SainTiss

I just set up IP forwarding on a 2.6.12 debian system (server) and a 2.6.12 ubuntu client. I used this script:

Either upgrade to a more recent kernel in the 2.6.x series or disable TCP window tracking by

# echo 1 > /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_be_liberal

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary
Signature · 16 lines
If we cannot live so as to be happy, let us at least live so as to deserve it
 -- Immanuel Hermann Fichte

People are promoted up to their level of incompetence
 -- Peter's Principle

Ark Linux - Linux for the Masses (http://arklinux.org)

Hans Schippers
Aspirant FWO - Vlaanderen
Formal Techniques in Software Engineering (FoTS)
University of Antwerp
Middelheimlaan 1
2020 Antwerpen - Belgium
Phone: +32 3 265 38 71
Fax: +32 3 265 37 77
#3 lore raw
Quoted 2 lines · SainTiss

However, after I did this both on server and client, nothing changed... Also, using 2.6.8 on the server doesn't help...

That was a guess based on the available info.

As you are possibly behind an *DSL line, there might be that someone drops ICMP fragmentation needed packets. Read TCPMSS target in the iptables manpage and add the appropriate rule(s) to the firewall.

Another possibility is an ECN hole somewhere between you and the
destinations: try disabling TCP ECN on the client and give a try.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary
author
#4 lore raw

Hi,

Quoted 5 lines · Jozsef Kadlecsik

On Sat, 21 Jan 2006, SainTiss wrote:

As you are possibly behind an *DSL line, there might be that someone drops ICMP fragmentation needed packets. Read TCPMSS target in the iptables manpage and add the appropriate rule(s) to the firewall.

Now that seems to help a lot, provided I put this rule as the FIRST one in the FORWARD chain, if I put it at the end, it doesn't change anything, probably because then -j ACCEPT gets priority:

iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

So thanks a lot!

Hans

Quoted 11 lines

Another possibility is an ECN hole somewhere between you and the
destinations: try disabling TCP ECN on the client and give a try.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary
Signature · 16 lines
If we cannot live so as to be happy, let us at least live so as to deserve it
 -- Immanuel Hermann Fichte

People are promoted up to their level of incompetence
 -- Peter's Principle

Ark Linux - Linux for the Masses (http://arklinux.org)

Hans Schippers
Aspirant FWO - Vlaanderen
Formal Techniques in Software Engineering (FoTS)
University of Antwerp
Middelheimlaan 1
2020 Antwerpen - Belgium
Phone: +32 3 265 38 71
Fax: +32 3 265 37 77