NSLU2-Linux
view · edit · print · history

My DSL internet provider uses a Maximum Transmission Unit (MTU) size of 1492 bytes. Unfortunately the default MTU size of the Slugs ethernet device ixp0 is the standard 1500 bytes so that every IP packet needs to be split into 2 packets.

Matching the MTU size to the maximum size accepted by your DSL internet provider helps to speed up the Internet connection because you do not need to fragment packets which incurs overhead.

This helped me also to avoid wget downloading incomplete files via FTP for example.

Furthermore I included name resolution with a hosts file prior to attempting to use a DNS server.

Step 1 - Create your own hosts file

Make sure you have your own hosts file in /opt/etc/hosts .

It should at least have the following contents:

 
# TCP/IP hosts file for domain HIGHDENS
# last changed by A. Kann
# 01.07.2005  

127.0.0.1       localhost
192.168.0.2     nslu2
#192.168.0.1    gw

You may enter all hostnames and IPs on your local network into this file for static name resolution

Step 2 - Determine the required MTU

Look out for a host on the internert who replies to ping requests (not all hosts answer to pings). I choosed www.kann.org. ping this host with packet sizes from 1400 up to 1480 bytes and do not allow fragmentation (consult the manual on how to specify these options). Find out the lowest value which let's the ping go through and add 28 bytes. This is the MTU size for your your connection.

A more detailed article about finding out the MTU size can be found here:

http://support.microsoft.com/default.aspx?scid=kb;en-us;q314825(approve sites)

Step 3 - Customizing rc.network

Create file rc.network in your unslung folder.

Unslung folders may be one of

 * /mnt/sda2/unslung/rc.network
 * /mnt/sdb2/unslung/rc.network
 * /unslung/rc.network

(depending on your Unslung version)

This is the content for rc.network :

 
#!/bin/sh
# Diversion script: customize MTU size
#
/opt/bin/logger "Changing MTU size - Step 1: ixp0 down"
/sbin/ifconfig ixp0 down
/opt/bin/logger "Changing MTU size - Step 2: ixp0 mtu 1492"
/sbin/ifconfig ixp0 mtu 1492   # change MTU size here 
                               # MTU size must match the requirement of your ISP
#
###### Executing content of linksys /etc/rc.d/rc.network ######
/sbin/ifup; #check_status
/bin/echo "call rc.network!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
#
###### Activating name resolution with hosts file ######
if [ ! -e /etc/nsswitch.conf ]; then
    echo "hosts: files dns" >/etc/nsswitch.conf
fi
if [ ! -e /etc/hosts.org ]; then
    cp /etc/hosts /etc/hosts.org
    ln -sf /opt/etc/hosts /etc/hosts
fi
#
###### Do not execute the linksys script ######
return 0
# EOF - include this line

During boot time of your Slug /etc/rc.d/rc.network should check, if a customized rc.network exists in one of the unslung folders. The customized rc.network will be executed first. Depending on the return value of the customized rc.network the original one will be continued.

Unfortunately I found out that /etc/rc.d/rc.network is not executed during boot time of your slug and thus the customized one does not get executed, too.

Step 4 - Activating rc.network during boot time

Therefore you need to run /etc/rc.d/rc.network from another rc.-file. I choosed one of my other customized ones inside the Unslung folder:

 rc.rstimezone

It should at least look as the following:

 
#!/bin/ash
##### start rc.network first 
/etc/rc.d/rc.network
#
# Execute the linksys script
return 1
# EOF - include this line

Step 5 - Activate and verify

Now execute /etc/rc.d/rc.network manually or reboot the Slug.

Verify with ifconfig ixp0 if MTU has been changed from 1500 to your new size.

That's all!

view · edit · print · history · Last edited by Alex.
Based on work by Alex and tman.
Originally by Alex.
Page last modified on August 26, 2005, at 12:37 AM