# Slow network --> Fast network (TIP)

## zxy

I had lots of problems with my internet. I had it set up long ago, but there were always problems. 

I could download with normal speeds, but uploading was a problem. I couldn't send an email larger than 100k. If somebody looked on my site, that was hosted on my computer it took forever to see the images.

I have a VDSL connection, but the tip  should work for any other type of connection, too. 

Here is the link, where I have found the solution; http://www.loycn.com/en/emna/faq.htm

If the link ever goes down, here is the main part:

1. Seeing the right MTU for your connection.

To see your current MTU settings run 

```
ifconfig
```

 and look for MTU for your device.

-------------------------------------------------------------   (between this two lines is the copy of the important part of the article)

2. How can I determine the best MTU value for my connection?

An easy way to determine your best MTU value, which should make your tinkering a lot less complicated: Start by opening a terminal, then enter this following command:

```
ping -f -l [trial MTU number] www.[your_isp].com
```

Start with 548 and go up or down depending on the message (if it tells you that the packets are being fragmented, you need to go down - you want the highest setting that doesn't cause packet fragmentation). To derive your MTU from the ping data, add 28 to the highest number that worked (packet size+28 ).

If you are using ICS (internet connection sharing) and the outbound connection uses PPP over ethernet (PPPoE), then start with 1454. If it fails with an error message indicating that it must be fragmented, decrease the MTU size and try again. Repeat this until the ping command succeeds.

For example: 

```
Ping -f -l 548 www.aol.com
```

If this does not cause packet fragmentation, use 576 for MTU because 548+28=576

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

3. Setting the right MTU for your connection.

To set the new MTU do 

```
ifconfig ethX mtu NNN
```

where:

ethX is your net device, for example eth0

NNN is your new MTU

For me (VDSL) the right MTU was 837, so

```
ifconfig eth0 mtu 837
```

 did it for me.

4. Make the MTU setting permanent .

Put

```
 mtu_ethX="NNN"
```

in your /etc/conf.d/net.

Sending mail works now, server too, ...   :Very Happy: 

I hope this will help somebody.

Zxy

----------

## swooshOnLn

I will try this when I get home.

I do have a question though, is this one of those settings that *should* be set up right by default? By default my eth0 connection is as fast as it should be, and I haven't changed any MTU settings.

----------

## zxy

With setting up the right MTU, you just minimize packet fragmentation, thus making internet connection more responsive. 

I think it is good and safe to try. 

Maybe you have MTU set up with optimum number already.

With ifconfig, you set the MTU until the computer is restarted. Then  the dafault (1500 ?) is used again when you reboot.

----------

## swooshOnLn

so how would you make the option stick? (if i do find an optimized number)

----------

## zxy

Put

```
 mtu_eth0="NNN"
```

in your /etc/conf.d/net as stated in /etc/conf.d/net.example

 *Quote:*   

> # Some users may need to alter the MTU - here's how
> 
> #mtu_eth0="1500"

 

--- EDIT ---

swooshOnLn, thanks for reminding me. I have just added this info to the first post. (section 4.)

----------

## albright

I don't get it - you're using a DOS command,

-l in linux  just sets the number of packets to preload.

What does that have to do with MTU? I am genuinely

ignorant of how this works - please explain.

----------

## zxy

From man ping :

 *Quote:*   

>  -f     Flood ping. For every ECHO_REQUEST sent a period ``.'' is  printed,  while  for
> 
>               ever ECHO_REPLY received a backspace is printed.  This provides a rapid display
> 
>               of how many packets are being dropped.  If  interval  is  not  given,  it  sets
> ...

 

As I get it, 

```
ping -f -l 1000 www.[your_isp].com
```

would try to send 1000 packets without interrupting. Ping then shows a message if it can't be done in one go.

We are just looking for a maximum number of packets, that can be transmitted without interruption. 

If there are too many packets, ping says:

```
WARNING: probably, rcvbuf is not enough to hold preload.
```

If you see this warning, you have to lower the number. 

About DOS. The link that I found writes for windows machines originally, but it still worked for me in Linux, and this options look logical, too.

----------

## wyv3rn

Those commands are for DOS ping.  You are looking for:

ping -Mdo -s <size> <target>

----------

## zxy

The results of testing are the same with any of the usages of ping. If you check the man pages it doesn't say anything about DOS.

All ok, but aren't we missing the main point. Did anybody of you get more responsive network with this tip, as I did?

----------

## swooshOnLn

I still havent tried yet. I was waiting to see if the dos thing got settled. I will try when I get home again. haha.

----------

## mrness

A smaller MTU is generally better on slow connections, such as dialup, or on connections where packets gets often lost. 

The recommended MTU for routers is 1500 because some networks maintained by diletants filter the ICMP "fragmentation needed".

However, in some cases this is impossible (e.g. PPPoE). In this cases you should use iptables to alter MSS field of the TCP SYN packets (aka clamp MSS).

----------

## nielchiano

 *mrness wrote:*   

> A smaller MTU is generally better on slow connections, such as dialup, or on connections where packets gets often lost.

 

BUT it increases overhead, thus reducing the net throughput

Also, TCP will detect the maximal MTU availible on the whole connection and use that. Unless offcourse

 *mrness wrote:*   

> some networks maintained by diletants filter the ICMP "fragmentation needed".

 

----------

## zxy

I hava a VDSL connection. AFAIK it uses smaller packets. So no wonder my network started to run normaly when I lowered the MTU from 1500 to 837.. After a week it still works without a stall.

@mrness

VDSL is not a slow dialup, its 1024/256 and higher. I don't know what do you consider as slow?

----------

## mrness

 *zxy wrote:*   

> I hava a VDSL connection. AFAIK it uses smaller packets. So no wonder my network started to run normaly when I lowered the MTU from 1500 to 837.. After a week it still works without a stall.

 

I don't know what method are you using (PPPoE,PPPoA or RFC2684), but there are the best MTU for every method:

  - PPPoE : 1492

  - PPPoA or RFC2684 : 1500

 *zxy wrote:*   

> 
> 
> VDSL is not a slow dialup, its 1024/256 and higher. I don't know what do you consider as slow?

 

*DSL is not dialup. You don't need to dial a number to connect, isn't it?

----------

## zxy

No it is not a dialup.

----------

## moocha

 *nielchiano wrote:*   

> Also, TCP will detect the maximal MTU availible on the whole connection and use that. Unless offcourse
> 
>  *mrness wrote:*   some networks maintained by diletants filter the ICMP "fragmentation needed". 

 Unfortunately, it's more likely than not that during normal usage your packets will get routed through such networks. Basically, path MTU discovery on the Internet seen as a whole is broken, unless you're a lucky person. Or, if you're using IPSec (or most VPN systems, for that matter), a very, very lucky person.

----------

## zxy

Did anybody even try this tip?

Just interested.  :Cool: 

----------

## swooshOnLn

I dunno, I think it messed up my internet, but then again, i didnt really know what i was doing. Its fixed now. Lesson, if it aint broke, dont fix it  :Wink: 

I was confused at most by the original post being contradicted a few times, so I wasnt sure what to do where.

----------

## moocha

 *zxy wrote:*   

> Did anybody even try this howto?
> 
> Just interested. 

 I wouldn't try it as it's presented here if I weren't familiar with how IP networks work - and if you are familiar with that, you don't need this thread since you're probably doing something similar already. As it is now it doesn't qualify as a HOWTO since it contains too many factual and syntactical errors.

Your intentions were admirable, but the problem is much more complex hence there can't be a general solution (for example, depending on the network density in your area, you'd require different MTU values for different destination networks) - your proposal only helps ifthe PMTU breakage happens near you and not further along to the remote end. Meddling with a complex system when you know no generic solution exists is never a good idea. I'd advise to leave it alone.

----------

## zxy

I changed the word howto to tip, as it was originaly writen in the first post.

I'm not a network expert, and I stumbled upon this topic, because I wanted to make my network work. (I couldn't even send a 100k emai, because the transfer died in the midtime).

After founding this and trying it, my network was reborn, and more responsive than ever. I guess that connection to my ISP needed smaller MTU ( I have VDSL - which is known by using smaller packets).

That's why I asked others if they tried the Tip, or was it just my computer.

----------

## moocha

Nod, if you're facing such problems then it's certainly worth a try.

----------

## mrness

 *zxy wrote:*   

> I guess that connection to my ISP needed smaller MTU ( I have VDSL - which is known by using smaller packets).

 

Correction : As I stated above, *DSL is capable of transporting IP packets of 1492-1500 bytes (depending which protocol you use) without fragmentation (not in the IP sense of the word anyway).

Maybe your ISP use a smaller MTU; that would be strange but I suppose it might be possible. 

In such cases, you must use tracepath to find the value of the pmtu.

----------

## zxy

pmtu just shows the number I have set. If I change the mtu with ifconfig then pmtu changes acordingly.

```
 # tracepath www.myprovider.com

 1:  XXX-XXX-XXX-XXX.dynamic.my.provider.com (xxx.xxx.xxx.xxx)      0.148ms pmtu 837

 1:  no reply

 2:  no reply

 3:  no reply

 4:  no reply

 5:  no reply

 6:  no reply

```

----------

## mrness

As I said, your ISP is just an amateur.

----------

## zxy

@mrness You might be right. What can I do? They are at least 60 % cheaper than THE telekom. 

The interresting thing is, that they offer much higher speeds than anybody else around here.

----------

