Tweaking mtu with Linux?

General discussion related to Cable Modems, DSL, Wireless, Fiber, Mobile Networks, Wireless ISPs, Satellite, or any other type of high-speed Internet connection, general issues and questions here. Review and discuss ISPs as well (AT&T / SBC, BellSouth, Bright House, CableOne, Charter, Comcast, Covad, Cox, Cablevision / Optimum Online, TMobile, Verizon FIOS, Shaw, Telus, Starlink, etc.)
Post Reply
ChrisW
Member
Posts: 46
Joined: Mon Apr 14, 2003 4:24 am
Location: Stockton, California

Tweaking mtu with Linux?

Post by ChrisW »

Hi, I just installed mandrake 9.1 Linux. Is there anyway i can still tweak my settings like i did with windows? Right now my MTU is at 1452 and mss is 1412 i believe.
Stu
Regular Member
Posts: 341
Joined: Tue Aug 10, 1999 12:00 am

Post by Stu »

ChrisW
Member
Posts: 46
Joined: Mon Apr 14, 2003 4:24 am
Location: Stockton, California

o0o

Post by ChrisW »

Man that looks difficult for a linux virgin.
Some how my MTU is 1492 and mss is 1452. I just got my linux machine to access internet through my win2kpro computer. Somehow doing that changed mtu and mss to normal settings.

Now i just need to get that Rwin up. Actually maybe i wont cause all sudden even tho my RWIN is @ 5082 my download speed on pcpitstop.com went frfrom 1150-1177 too 1226kbps. Weird?
User avatar
j79zlr
Regular Member
Posts: 242
Joined: Wed Apr 30, 2003 3:31 am

Post by j79zlr »

I replied to your post at DSL nuts, the analyzer reports that low RWIN because the RWIN increases to a point during transfer. The analyzer doesn't send enough data for the RWIN to react.
cyberskye
Senior Member
Posts: 4717
Joined: Wed Jan 10, 2001 12:00 am
Location: DC

Post by cyberskye »

Unix machines are typically better performers in the tcp area. Not as much need to tweak in any case.

Nice article Stu!

Skye
anything is possible - nothing is free

:wth:
Blisster wrote:It *would* be brokeback bay if I in fact went and hung out with Skye and co (did I mention he is teh hotness?)
:wth:
Stu
Regular Member
Posts: 341
Joined: Tue Aug 10, 1999 12:00 am

Re: o0o

Post by Stu »

Originally posted by ChrisW
Man that looks difficult for a linux virgin.
Some how my MTU is 1492 and mss is 1452. I just got my linux machine to access internet through my win2kpro computer. Somehow doing that changed mtu and mss to normal settings.

Now i just need to get that Rwin up. Actually maybe i wont cause all sudden even tho my RWIN is @ 5082 my download speed on pcpitstop.com went frfrom 1150-1177 too 1226kbps. Weird?
More difficult than hacking the Windows registry? All you really need to do is copy those lines of settings (at the bottom of my page) into /etc/sysctl.conf and run `sysctl -p`, then adjust the 524288 to a lower value if and only if you notice your connection is actually slower than before (try 262144, then 131072 if that doesn't do the trick).

As for the RWIN thing, you must not have read my page. If you did, you'd know that the RWIN is dynamic up to a maximum RWIN--this is due to the auto-tuning feature in the 2.4 kernel. So, as j79zlr said, the RWIN shows up that way because of this.

In addition, the MTU and MSS are derived/discovered from the other values set, the machine you are communicating with, and the routers' settings in between you and the destination. You can set the MTU on the network interface directly (using `ifconfig eth0 mtu 1500`), but then two things happen. First, Linux does TCP/IP very efficiently, so by "over ruling" the "kernel's judgement" you may add more processing to be done to each packet in kernel space--thereby making your throughput slower due to increased packaging time. Second, if one of the routers in between you and the destination has a MTU lower than the one you "hard coded" into your interface, then you've forced fragmentation to occur (the router, or routers, that is/are set at a lower MTU chops your packet into pieces and forwards those pieces), again this slows your transmission down. Linux uses Path Maximum Transfer Unit (PMTU) discovery by default. What this does is "scope out" the MTUs throughout the path taken between you and the machine you are communicating with and then assigns an MTU to the connection that will be as large as possible such that fragmentation does not occur.

So, the only unit of measure you need be concerned with in tweaking Linux is the maximum send and receive windows (which are the same value). The other settings just enable features that allow the kernel to make more informed decisions regarding the deriving and discovery of the other values it uses.
Stu
Regular Member
Posts: 341
Joined: Tue Aug 10, 1999 12:00 am

Post by Stu »

Originally posted by cyberskye
Nice article Stu!


Thanks! :) I wrote that several months ago. After posting leaner versions of it here and e-mailing it to my brother, my friends, my brother's friends, and my co-workers, I was getting sick of explaining it from the ground up over and over again...

I just hope I don't have to do too much to it when the 2.6 kernel is released in the not to distant future.
ChrisW
Member
Posts: 46
Joined: Mon Apr 14, 2003 4:24 am
Location: Stockton, California

oo

Post by ChrisW »

Any idea how to set the values back to the default? Cause i think that actually made it slower =\ damn linux needs a program like Cablenut for windows...
cyberskye
Senior Member
Posts: 4717
Joined: Wed Jan 10, 2001 12:00 am
Location: DC

Post by cyberskye »

damn linux needs a program like Cablenut for windows


Why would you want to apply windows methodology to a real OS? :) Most folks are attracted to open source becasue it gives them the ability to learn their system, rather than learn applications that hide the mechanics - no offense ot cablenut crew (it's a great app).

Either way, unless you're running a busy public server, you don't really need to tweak unices at all. They perform (networking-wise) much better than microsoft right out of the box. If you want to tweak it, make sure you understand why your changing things (what the parameters mean to your connection) outside of "SG told me to"
anything is possible - nothing is free

:wth:
Blisster wrote:It *would* be brokeback bay if I in fact went and hung out with Skye and co (did I mention he is teh hotness?)
:wth:
Stu
Regular Member
Posts: 341
Joined: Tue Aug 10, 1999 12:00 am

Re: oo

Post by Stu »

Originally posted by ChrisW
Any idea how to set the values back to the default? Cause i think that actually made it slower =\ damn linux needs a program like Cablenut for windows...


Remove the settings from /etc/sysctl.conf and reboot (you can manually reset them, but this is the least complex way to go).

I don't know why I bother! I wrote a page that explains how to do this in Linux, yet you didn't read it (skimming doesn't count!)... THERE IS A PROGRAM LIKE CABLENUT ON LINUX--and I listed that on my page at the bottom, it's called Powertweak (I even put a link to it on there). I have yet to use it myself--all the machines I work on don't have X installed on them (except this machine and two development workstations) and I do most things with vi and the command line--so I can't help you out with using Powertweak.

Also, I agree with cyberskye. You shouldn't be messing with network settings if you have no clue what they do--which is why I linked everything to its corresponding RFC (Linux stays as close to the RFC as possible). Take the time and read them, they are long, but you will gain a better understanding of what you are doing and how to do it by reading them.

I should have mentioned this earlier, and I'll probably add it to my page in the future. But, when testing your connection speed you should be testing your actual throughput (not your settings according to some analyzer). Download a large file from a fast server while running something like iptraf in "Detailed interface statistics" mode. Then if the send/receive window is too big (you can tell this is the case if your throughput is slower than before--another thing I forgot to mention on my page, oops!), adjust the numbers in /etc/sysctl.conf to a lower one (that is a multiple of 1024) and run `sysctl -p` again. You keep doing this until it works, but I have yet to hear of someone on broadband (with a under a 6 Mbps connection speed--or on dial-up) who's window settings where not either 524288, 262144, or 131072.
ChrisW
Member
Posts: 46
Joined: Mon Apr 14, 2003 4:24 am
Location: Stockton, California

o0o

Post by ChrisW »

Yes i did dl the powertweak. Dont remember if i had problems installing it or finding it after i installed it. lol
Post Reply