LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-06-2009, 04:22 PM   #1
TruckStuff
Member
 
Registered: Apr 2002
Posts: 498

Rep: Reputation: 30
iptables + NAT == sucky uploads


I have a linux box acting as a router/gateway between the internet, a public network and a private LAN. We are using iptables to SNAT our LAN. The setup for this is quite simple:
Code:
IPTABLES=`which iptables`
LAN=eth0
WAN=eth1
PUB=eth2
LAN_BLOCK=192.168.16.0/24
NAT_SOURCE=1.2.3.4

$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $LAN -o $WAN -m state --state NEW -j ACCEPT
$IPTABLES -A FORWARD -i $LAN -o $PUB -m state --state NEW -j ACCEPT
$IPTABLES -A FORWARD -i $PUB -o $LAN -m state --state NEW -j ACCEPT
$IPTABLES -t nat -A POSTROUTING -o $WAN -s $LAN_BLOCK -j SNAT --to-source $NAT_SOURCE
With these rules, I get great download performance, regardless of protocol (sftp, ftp, http, etc).

Uploads, however, are a different story. I believe that the source of this issue is the NATing because if I upload to the same server from a box that isn't being NATed (e.g. in the public block), upload speeds are an order of magnitude greater when not being NATed, regardless of protocol. For example, if I upload a file from one of our public servers to a remote location, it will upload at about 500Kb/s. The same upload to the same location with within the LAN won't see more than 35Kb/s.

I'm not doing any kind of fancy traffic control or anything like that. I would expect to see some slowdown because of the NAT (for example, downloads are 600Kb/s vs 500Kb/s through the NAT), but this kind of slowdown seems a bit ridiculous.

Any suggestions on things to check? I'm running a custom 2.6.30.3 kernel.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables: can't initialize iptables table `NAT' linuxgentoo Linux - Kernel 3 01-17-2010 10:15 AM
first impressions of slackware-10 sucky ! please help ! qwijibow Slackware 16 06-29-2004 01:13 AM
IPTABLES : build NAT using IPTABLES joseph Linux - Networking 4 04-23-2004 05:08 AM
Redhat 9, Emacs, Backspace, Sucky iketa Linux - Software 0 07-17-2003 12:24 PM
Slow uploads over NAT network Aurix Linux - Networking 4 05-16-2002 04:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration