# Slow network speed issue



## squareone (Nov 20, 2008)

Hi!

First of all, it's so nice with a BSD forum. I'm a really green BSD user, this makes things so much better =)

Now, I have very recently installed FreeBSD on a server ( Amd XP 2800+, 1GB memory, two network cards ). The server acts as a router to my computer.

The problem is that I get really slow network speeds.
My internet connection is 100/100 and ping times was lightning fast while using Ubuntu server.

Now I get *140ms to http://www.google.com* from the command line.
When a friend tries to download a file from the Lighttpd server he gets only about *80kB/s*. ( His internet connection isn't the problem ).

I've managed to get almost 3MB/s downspeed from sunet.se using
fetch from the terminal but that should have been around 7MB/s atleast.

When I start to download a torrent at my computer behind the server I get disconnected from the server(router) as soon as the torrent gets some speed. ( 500 kB/s + )

It's a fresh server install and I compiled the kernel with IPFW (using these commands http://www.freebsd.org/doc/en/books/handbook/firewalls-ipfw.html ) to be able to use natd for routing.

I would appreciate if anyone could give me some advice on how to solve this. 

Thanks


----------



## DutchDaemon (Nov 20, 2008)

Are your network cards configured correctly? Speed settings, duplex settings?


----------



## Levenson (Jan 11, 2009)

I have something like that too. The local network (router ADSL modem, FreeBSD and two Windows) work slowly. For example a copy 5 GB (HDTVRip) for more then our!! It should be a 10 minutes max!.  I have allready change the modem( I thought that LAN ports are broken ). All cards work correctly



> ifconfig sk0
> sk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> options=b<RXCSUM,TXCSUM,VLAN_MTU>
> ether 00:1c:f0:98:36:f4
> ...



All computers automatically use 100Base FD. I'am using  a new cables.) and i don't now why is it.


----------



## DutchDaemon (Jan 11, 2009)

sk is a gigabit card. Is there a 100 Mbit switch or hub in there somewhere forcing that card to switch to the lower speed? Connected to a gigabit switch or crossconnected to another gigabit nic, sk will happily autoselect gigabit.


----------



## Levenson (Jan 12, 2009)

DutchDaemon said:
			
		

> sk is a gigabit card. Is there a 100 Mbit switch or hub in there somewhere forcing that card to switch to the lower speed? Connected to a gigabit switch or crossconnected to another gigabit nic, sk will happily autoselect gigabit.



My router can do 10/100 Mbit. As you can see the card chose 100baseTX automatically. A few days before a have try to connected sk to gigabit Nic (Notebook with WindowsXP). The speed was between 10-20 mbps. I think it's low for gigabit with direct connecting of computer-computer.


----------



## kamikaze (Jan 12, 2009)

Gigabit file transfers are often limited by the hard disk speed.


----------



## DutchDaemon (Jan 12, 2009)

Even with directly cross-connected gigabit interfaces, I've hardly ever seen speeds over 350-400 mbit (40-50 MB/sec). I think IDE/SATA disks on both ends and/or the ftp protocol are the limiting factors.


----------



## Levenson (Jan 12, 2009)

I've just played with smb.conf and append this line
 socket options = TCP_NODELAY IPTOS_LOWDELAY
So when someone downloading files from me, the speed is normal ~5 7 MB/sec, but when i try to download something the speed is 500 KB/sec ))


----------



## cbes (Jan 15, 2009)

Check if you have any/many errors or collisions by checking the state of each of your networks interfaces using netstat, for example:
netstat -i sk0
There should be no errors.....


----------



## Levenson (Apr 25, 2009)

I'd like to up this post)

Well as i already say, i have problem with my home network speed.

I have 4 computer (FreeBSD,XP,XP and XP) 
When i copying  files from XP to XP it works good (5GB file copying near 8-10 minutes  ). Copying files From FreeBSD under XP works good too. But when i try to get files from XP sharing under FreeBSD it works horrible (5GB file copying approximately 1 HOUR and 20 MINUTES!! ).

look at this info 


```
[B][levenson@Lev ~]$[/B] ifconfig sk0
        sk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=b<RXCSUM,TXCSUM,VLAN_MTU>
        ether 00:1c:f0:98:36:f4
        inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet 100baseTX <full-duplex>
        status: active
```

and on this screen.





I have used iostat -h 5 (left terminal on the screen)
and netstat -rw 5 (right term on the screen)

PS. And i don't use DEVICE_POLLING option.


----------



## Levenson (Apr 26, 2009)

After some testing, i found that when i mount some shares the speed is going down to 2MB/sec, but with smbclient tool the speed is grate (10MB/sec)


```
[B][levenson@Lev ~]$[/B] smbclient //192.168.1.3/TCinema_5
Domain=[TWIPE] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
smb: \> get Angel.A.2005.720p.BluRay.DTS.x264.Rus.Fra.mkv /home/_torrents/A.mkv
```

Look at the bold text.

```
[B][levenson@Lev ~]$[/B] iostat 1
      tty             [B]ad0[/B]              ad1              ad5             cpu
 tin tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
 165   93 23.94  11  0.27   2.18   0  0.00   2.18   0  0.00   3  0  1  0 95
 622  340 64.00 149  [B]9.30[/B]   0.00   0  0.00   0.00   0  0.00   8  0 12 10 70
 517  137 63.79 152  [B]9.45[/B]   0.00   0  0.00   0.00   0  0.00   6  0 12  9 73
 589  137 64.00 147  [B]9.20[/B]   0.00   0  0.00   0.00   0  0.00  17  0 10  9 65
 424  137 64.00 147  [B]9.20[/B]   0.00   0  0.00   0.00   0  0.00  17  0 10  7 66
 416  137 62.41 148  [B]9.02[/B]   0.00   0  0.00   0.00   0  0.00  10  0 11  7 73
 626  137 63.68 148  [B]9.19[/B]   0.00   0  0.00   0.00   0  0.00   8  0 12 10 70
 494  137 64.00 143  [B]8.94[/B]   0.00   0  0.00   0.00   0  0.00   7  0  8  6 79
 681  137 64.00 157  [B]9.78[/B]   0.00   0  0.00   0.00   0  0.00   7  0 12 10 71
```

and here 

```
[B][levenson@Lev ~]$[/B] netstat 1
            input        (Total)           output
   packets  errs      bytes    packets  errs      bytes colls
      7767     0   10084894       5621     0     392430     0
      7777     0   10217724       5616     0     379382     0
      7834     0   10293876       5655     0     382021     0
      7325     0    9504106       5288     0     369921     0
      7984     0   10489726       5773     0     389986     0
      7762     0   10199268       5612     0     379131     0
      7941     0   10312276       5769     0     402351     0
      7871     0   10342494       5677     0     383532     0
      7872     0   10343808       5701     0     385050     0
      8032     0   10431790       5829     0     406394     0
      7452     0    9793242       5395     0     364514     0
      7836     0   10295254       5669     0     382945     0
      7805     0   10127953       5639     0     393890     0
      7435     0    9769590       5376     0     363063     0
         0     0          0          0     0          0     0
```

I use this command for mounting: 


```
sudo mount_smbfs -E ru_RU.UTF-8:cp866 //Administrator@twipe/TCinema_5 /media/twipe/TCinema_5/
```

Any ideas?


----------



## octix (May 19, 2009)

I'm having the same issue. 

Basically I have 2 PCs. Each of them has 2 NICs, with an external and internal (LAN) ip.

They are connected through UTP cable (No switch), but speed is very low. ~300K-2MB Sometimes it will start with 10MB but goes down pretty fast... to 100K even.

I'm out of options, don't know where to look...

Can be the bad cable? What else I could try/debug?

1st

```
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8<VLAN_MTU>
        ether 11:11:11:11:11:11
        inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
```

2nd

```
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8<VLAN_MTU>
        ether 11:11:11:11:11:11
        inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
```

PS: Thank you in advance.


----------



## octix (May 19, 2009)

small update.

just restarted server and speed is more stable... and it's about 10MB..

i suspect to be related to memory somehow...

right now is (from top)

Mem: 168M Active, 70M Inact, 289M Wired, 416K Cache, 214M Buf, 7346M Free

but Free used to be 200-400MB, although Inact is about 6000MB so don't know if this could be the cause...


----------



## klabacita (May 30, 2009)

I have seen that u are speaking about speed, latter u say something about smbclient which is  command of samba package.

  Well just to confirm and see if u have been testing samba and get slow speeds between your clients.

  Try to add syslog=0 and log level =0 and tested.

  Greetings!!!


----------

