Fix slow ftp and http

From OpenFSG

Jump to: navigation, search

DT & FSG(tbc)

Contents

Intro

You have a good internet connection and a good "upload" speed. So it is supposed you can have fast access to your FSG/NDP via FTP/HTTP when you are away. Instead you find that only low speeds like 5Kbyte/sec or so are achievable. What is the cause & how can you fix it?

The problem occurs whenever a device from within the network tries to send out a chunk of data with a higher MTU value than that accepted by the router / modem.

The NDP has a default MTU of 1500, If the router is set to anything other than 1500, it will either try to split the package or reject it, thus increasing overheads & processing time, resulting in a slower throughput.

A MTU of 1500 is the maximum figure allowable for Ethernet v2. Ethernet 802.3 uses a max MTU of 1492 & is a not uncommon figure in router set-up’s. However the specified figure by many isp’s to use as router set-up default can be as low as 1400. Using higher MTU values then those specified by your ISP may cause instability to your ADSL connection. Playing around with this figure can achieve better ADSL speeds but you will have to judge for yourselves what works best on your network stability wise.


Solution

There are 2 options into solving this problem.

1. set your routers MTU to be 1500. Simple, but may cause instability. Read your router manual to find out how to do this.

2. change your NDP MTU value to that of your router. Continue below to find out how to do this.

Login to the NDP using SSH

Using username "root".
root@192.168.1.1's password:
~ # cd /

Type command ifconfig and note that the default MTU is set at 1500 on eth0.

/ # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:01:DB:06:04:DB
          inet addr:192.168.1.110  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:49 errors:0 dropped:0 overruns:0 frame:0
          TX packets:49 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:256
          RX bytes:6553 (6.3 KiB)  TX bytes:7055 (6.8 KiB)
          Interrupt:1 Base address:0xa000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

/ #

Add a boot time startup script

/ # vi /etc/init.d/custom_startup

press insert on your KB & then add line

ifconfig eth0 mtu 1492
~
~
~
~

(where 1492 is your chosen MTU value) and then press shift z z (save and exit the vi editor) then follow the code below to add symbolic links and permissions

/ # ln -s /etc/init.d/custom_startup /etc/rc/S99Acustom_startup
/ # chown root /etc/rc/S99Acustom_startup
/ # chmod ugo+rx /etc/init.d/custom_startup
/ # chmod ugo+rx /etc/rc/S99Acustom_startup

run your new script

/ # sh /etc/rc/S99Acustom_startup

and check

/ # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:01:DB:06:04:DB
          inet addr:192.168.1.110  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1492  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:256
          RX bytes:1374 (1.3 KiB)  TX bytes:1272 (1.2 KiB)
          Interrupt:1 Base address:0xa000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

/ # reboot

Anecdotal

My ADSL connection isn't very stable at 1500, sometimes email wont send, sometimes web pages wont load. MAAF/Plusnet specify MTU1400, however running at 1492 works for me, so I chose option 2 as my fix. previously users of my ftp server were getting 5Kbyte/sec now they're getting 42.23Kbyte/sec

Credit where credits due

Thanks to all that have helped nail this one esp jobsonandrew, I know its annoyed many of us for a long time.

--alfonz 12:59, 17 April 2009 (CEST)

More Info about MTU

What is MTU?

The Maximum Transfer Unit - MTU is a computer networking term that expresses the size in bytes of the largest unit of data that can be sent using an Internet Protocol.

Diferent values of MTU

Examples of different protocols for MTU used on the Internet:

  • Ethernet: 1518 bytes
  • PPPoE: 1492 bytes
  • ATM (AAL5): 8190 bytes
  • FDDI: 4470 bytes
  • PPP: 576 bytes
  • IP

In the case of IP, the maximum value of MTU is 65536 bytes. Yet this is a theoretical maximum value, then, in practice, the IP entity determined the maximum size of IP datagrams through the technology of the network to be sent the datagram. By default, the IP datagram size is 576 bytes. Datagrams can be sent only if it is larger actual knowledge that the recipient of the datagram network can accept this size. In practice, since most machines are connected to Ethernet networks or derivatives, the size of the datagram is sent with frequency is 1500 bytes.

Datagrams can go through various types of networks with different sizes acceptable before reaching their destination. Therefore, for an un-fragmented datagram reaches the destination, must be less than or equal to the minimum MTU of the networks through which to pass.

  • TCP

In the case of TCP, the MSS is called MTU (Maximun Segment Size), and takes its value in terms of maximum size of datagram. Specifically, the maximum segment size is equal to the maximum datagram size minus 40 (which is the minimum number of bytes that hold the IP and TCP headers in the datagram).

Personal tools