# [SOLVED] network VERY slow to establish

## xtx

i use a wired connection.

despite the wicd log stating that a dhcp connection was successful in under a second, i am having my own network and the internet during boot.

unless i tell processes to sleep for 30 seconds then ntp-client fails to establish connection and my nfsmount simply hangs for about 90 seconds before doing anything.

telling ntp-client to sleep for 30 seconds solves both problems, it connects fine and nfsmount is speedy, however this is unacceptable. when trying to debug a program or overclock my machine i may be rebooting every minute. 

is there any solution to this?

*****************************

i followed this guide: http://en.gentoo-wiki.com/wiki/NFS/Client to mount some drives. 

when i add nfsmount to defaults and reboot the drives take at least 1:30 to mount if not longer. 

when nfsmounts is not added to defaults and kde boots up the drives mount immediately upon clicking on them.

i would much prefer to have them mount at boot because of small things like if amarok opens up right away before my music drive is mounted then I have to mount the drive and rescan 20,000 songs, re download the album art, and all of the statistics (# of times played, etc) are all reset. 

if it matters at all i am directly plugged into the internet and wicd is started at boot.

******************************Last edited by xtx on Sat Feb 11, 2012 5:28 pm; edited 2 times in total

----------

## Hu

That guide appears to be inaccurate.  It fails to specify _netdev in the mount options.  Please post the output of cat -n /etc/fstab.

----------

## xtx

```
$ cat -n /etc/fstab 

     1  # /etc/fstab: static file system information.

     2  #

     3  # noatime turns off atimes for increased performance (atimes normally aren't 

     4  # needed); notail increases performance of ReiserFS (at the expense of storage 

     5  # efficiency).  It's safe to drop the noatime options if you want and to 

     6  # switch between notail / tail freely.

     7  #

     8  # The root filesystem should have a pass number of either 0 or 1.

     9  # All other filesystems should have a pass number of 0 or greater than 1.

    10  #

    11  # See the manpage fstab(5) for more information.

    12  #

    13

    14  # <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

    15

    16  # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

    17  /dev/sda1                               /boot                   ext2    defaults,noatime        1 2

    18  /dev/sda3                               /                       ext4    noatime                 0 1

    19  /dev/sda2                               none                    swap    sw                      0 0

    20  /dev/cdrom                              /mnt/cdrom              auto    noauto,user             0 0

    21  192.168.0.13:/mnt/External/Videos       /home/***/Videos        nfs     defaults,user           0 0

    22  192.168.0.13:/mnt/External/Music        /home/***/Music         nfs     defaults,user           0 0

```

the guide is inaccurate? the drives mount, immediately so when i manually click on them in dolphin, but when i add it to 'default' runtime i have to wait close to two minutes... but it still eventually works.

----------

## Hu

Yes, the guide is wrong.  If you use noauto, then the filesystem is not mounted at boot when mount -a runs.  If you omit noauto, then the filesystem is mounted at boot.  If you do not mark the filesystem as _netdev via options, then you rely on the invocation of mount to blacklist network filesystems.  OpenRC seems to make some effort to do the right thing here, but its efforts are apparently insufficient.  When the mounting process stalls, what is the exact invocation of mount that it uses on your system?

----------

## xtx

ok so i think i've figured out the problem. despite wicd being started at boot i don't think the network is established in time. ntp-client is started at default also to set my system clock and it just completely fails despite working when i run it once kde loads. i edited /etc/init.d/ntp-client to sleep for 30 seconds and that fixes both problems- ntp-client works and nfsmount works quickly. 

is this the only solution? why does it take the network so long to connect?

----------

## Hu

Some networks, especially wireless ones, are very slow to establish link or to acquire an address.  Check the timestamps on your DHCP client log messages to see the exact nature of the problem.

----------

## xtx

it is a wired network.

```
2012/02/03 14:57:32 :: wicd initializing...

2012/02/03 14:57:32 :: ---------------------------

2012/02/03 14:57:32 :: wicd is version 1.7.1~b3 unknown

2012/02/03 14:57:32 :: setting backend to external

2012/02/03 14:57:32 :: trying to load backend external

2012/02/03 14:57:32 :: successfully loaded backend external

2012/02/03 14:57:32 :: trying to load backend external

2012/02/03 14:57:32 :: successfully loaded backend external

2012/02/03 14:57:32 :: Couldn't detect a wireless interface.

2012/02/03 14:57:32 :: setting wireless interface None

2012/02/03 14:57:32 :: automatically detected wired interface eth0

2012/02/03 14:57:32 :: setting wired interface eth0

2012/02/03 14:57:32 :: setting wpa driver wext

2012/02/03 14:57:32 :: setting use global dns to False

2012/02/03 14:57:32 :: setting global dns

2012/02/03 14:57:32 :: global dns servers are None None None

2012/02/03 14:57:32 :: domain is None

2012/02/03 14:57:32 :: search domain is None

2012/02/03 14:57:32 :: setting automatically reconnect when connection drops True

2012/02/03 14:57:33 :: Setting dhcp client to 0

2012/02/03 14:57:33 :: Wireless configuration file found...

2012/02/03 14:57:33 :: Wired configuration file found...

2012/02/03 14:57:33 :: chmoding configuration files 0600...

2012/02/03 14:57:33 :: chowning configuration files root:root...

2012/02/03 14:57:33 :: Using wireless interface...

2012/02/03 14:57:33 :: Using wired interface...eth0

2012/02/03 14:57:38 :: Autoconnecting...

2012/02/03 14:57:40 :: Attempting to autoconnect with wired interface...

2012/02/03 14:57:40 :: Putting interface down

2012/02/03 14:57:40 :: Releasing DHCP leases...

2012/02/03 14:57:40 :: Setting false IP...

2012/02/03 14:57:40 :: Flushing the routing table...

2012/02/03 14:57:40 :: Putting interface up...

2012/02/03 14:57:42 :: Running DHCP with hostname Gentoo

2012/02/03 14:57:42 :: dhcpcd[2202]: version 5.2.12 starting

2012/02/03 14:57:42 :: 

2012/02/03 14:57:43 :: dhcpcd[2202]: eth0: broadcasting for a lease

2012/02/03 14:57:43 :: 

2012/02/03 14:57:55 :: dhcpcd[2202]: eth0: offered 192.168.0.5 from 192.168.0.1 `Qwest'

2012/02/03 14:57:55 :: 

2012/02/03 14:57:55 :: dhcpcd[2202]: eth0: acknowledged 192.168.0.5 from 192.168.0.1 `Qwest'

2012/02/03 14:57:55 :: 

2012/02/03 14:57:55 :: dhcpcd[2202]: eth0: checking for 192.168.0.5

2012/02/03 14:57:55 :: 

2012/02/03 14:58:00 :: dhcpcd[2202]: eth0: leased 192.168.0.5 for 86400 seconds

2012/02/03 14:58:00 :: 

2012/02/03 14:58:00 :: dhcpcd[2202]: forked to background, child pid 2231

2012/02/03 14:58:00 :: 

2012/02/03 14:58:00 :: 

2012/02/03 14:58:00 :: DHCP connection successful

2012/02/03 14:58:00 :: Connecting thread exiting.

2012/02/03 14:58:02 :: Sending connection attempt result success

```

there does not seem to be a problem from what i can see, wicd seems to connect within a second. yet unless i tell ntp-client to sleep for 30 seconds it will not find the server.

----------

## xtx

in case this helps anybody, same problem using networkmanager instead of wicd. i'm trying pretty hard to figure this out and not getting much help

----------

## Ant P.

Do you need wicd/networkmanager for some other reason? Why not just use dhcpcd directly?

----------

## xtx

^just tried it. no difference. dhcpcd starts successfully but ntp-client and nfsmount fail afterward.

----------

## xtx

using dhcpcd without wicd or network-manager actually allows me to reduce the sleep time of ntp-client and have it work.

it worked successfully only sleeping for 10 seconds but failed when i tried for 5 seconds. 

this is obviously better than before but i would still love to hear somebody explain to me why this is happening and get some ideas for a solution that don't involve 'sleep' at all.

----------

## Gusar

Try a dhcp client other than dhcpcd.

Then, I've read something recently, dhcpcd doing some stuff which takes a lot of time. It has an option allowing you to disable it. Sorry if I'm being vague, I haven't used dhcpcd in a long time. Busybox udhcpc is my client of choice. Edit: I think noarp is the option, you put it in /etc/dhcpcd.conf. Also, disabling ipv6 helps.

----------

## xtx

worked almost perfectly! ntp-client starts successfully with as little as a 1 second sleep. still fails without 'sleep' though. that may be as good as i can get it. i'll mark it as solved.

note if anybody has the same problem: i added -ipv6 to global use flags, emerge update --newuse --deep world, and added the noarp option to /etc/dhcpcd.conf

i would remove ipv6 from the kernel too but i'm currently using a fallback kernel (3.1.6) due to problems getting past the kdm splash screen on newer kernels, so i don't have a .config for this kernel.

----------

