# Help needed to get connected to the internet automatically

## DrSlony

Hey!

I have two Wi-Fi cards:

```
           *-network DISABLED

                description: Wireless interface

                product: WiFi Link 6000 Series

                vendor: Intel Corporation

                physical id: 0

                bus info: pci@0000:03:00.0

                logical name: wlan1

                version: 35

                serial: 50:51:52:53:54:55

                width: 64 bits

                clock: 33MHz

                capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless

                configuration: broadcast=yes driver=iwlagn driverversion=2.6.36-gentoo-r5 firmware=9.221.4.1 build 25532 latency=0 link=yes multicast=yes wireless=IEEE 802.11abgn

                 *-usb:0

                      description: Wireless interface

                      product: RTL8187_Wireless

                      vendor: Manufacturer_Realtek_RTL8187_

                      physical id: 1

                      bus info: usb@2:1.1

                      logical name: wlan0

                      version: 1.00

                      serial: 60:61:62:63:64:65

                      capabilities: usb-2.00 ethernet physical wireless

                      configuration: broadcast=yes driver=rtl8187 driverversion=2.6.36-gentoo-r5 firmware=N/A ip=192.168.0.42 link=yes maxpower=500mA multicast=yes speed=480Mbit/s wireless=IEEE 802.11bg
```

wlan1 is inside my laptop but it's too weak so I don't use it. wlan0 is external and much stronger, that's the one I use.

My NIC:

```
          *-network

                description: Ethernet interface

                product: RTL8111/8168B PCI Express Gigabit Ethernet controller

                vendor: Realtek Semiconductor Co., Ltd.

                physical id: 0

                bus info: pci@0000:07:00.0

                logical name: eth0

                version: 03

                serial: 00:90:f5:99:d4:e4

                size: 10Mbit/s

                capacity: 1Gbit/s

                width: 64 bits

                clock: 33MHz

                capabilities: pm msi pciexpress msix vpd bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation

                configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s
```

I use wpa_supplicant to connect, because I use WPA2 (and as I understand it, nothing else supports WPA2). My router doesn't broadcast the SSID so as not to attract attention.

```
overkill ~ # cat /etc/wpa_supplicant/wpa_supplicant.conf 

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

update_config=1

network={

        ssid="waffles"

        psk="applemousse"

        proto=RSN

        key_mgmt=WPA-PSK

        pairwise=CCMP

        auth_alg=OPEN

}
```

I tried various /etc/conf.d/net settings but they didn't make much of a difference:

```
overkill ~ # cat /etc/conf.d/net

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

modules_eth0=( "ifconfig" )

#config_eth0=( "dhcp" )

modules_wlan0=( "wpa_supplicant" )

modules_wlan1=( "wpa_supplicant" )

#wpa_supplicant_wlan1="-Dwext -iwlan1 -c /etc/wpa_supplicant/wpa_supplicant.conf"

wpa_supplicant_wlan0="-Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf"
```

1- My first problem is that the booting process halts for about half a minute at "waiting for carrier":

```
* Starting eth0

*   Configuration not set up for eth0 - assuming dhcp

*     Bringing up eth0

*       dhcp

*         Running dhcpcd ...

dhcpcd[3964]: open_control: Connection refused

dhcpcd[3964]: version 5.2.10 starting

dhcpcd[3964]: eth0: waiting for carrier

dhcpcd[3964]: timed out

dhcpcd[3964]: allowing 8 seconds for IPv4LL timeout

dhcpcd[3964]: timed out
```

I don't know why it does that, it didn't pause in the past, before I had to format my laptop two months ago, and I did everything probably the same or very similar. I read all the documentation and tried many things, but couldn't get this to work nicely.

2- I would like my internet connection to be set up automatically after booting, and I turn to you for the proper way of doing it. As stated earlier, I use wpa_supplicant.

3- Another laptop in the house, closer to the access point but not by much, running Windows XP and using the built-in wireless device, typically reaches speeds of 48-50Mb/s on speedtest.net. I usually reach 7-12. Although I am a bit further away, my "link quality" is typically over 60. I don't know what that laptop's link quality is (XP) but I'm sure it's not as good as mine despite being closer, because its card is much weaker. Are my low speeds related to my eth0, or some other interface? How do I fix it?  

4- Would bundling both wireless devices together increase speeds? If so, how do I do it?

Extra info:

```
overkill ~ # rc-update -s

            bootmisc | boot                          

             checkfs | boot                          

           checkroot | boot                          

               clock | boot                          

         consolefont | boot                          

          consolekit |      default                  

            hostname | boot                          

             keymaps | boot                          

               local |      default nonetwork        

          localmount | boot                          

             modules | boot                          

            net.eth0 |      default                  

              net.lo | boot                          

           rmnologin | boot                          

           syslog-ng |      default                  

      udev-postmount |      default                  

             urandom | boot                          

          vixie-cron |      default                  

                 xdm |      default

Kernel:

Device Drivers  ---> 

[*] Network device support  --->

  [*]   Ethernet (10 or 100Mbit)  --->

    -*-   Generic Media Independent Interface device support

  [*]   Ethernet (1000 Mbit)  --->

    <*>   Intel(R) PRO/1000 Gigabit Ethernet support

    <*>   Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support

    <*>   Realtek 8169 gigabit ethernet support

    <*>   New SysKonnect GigaEthernet support

    <*>   SysKonnect Yukon2 support

    <*>   JMicron(R) PCI-Express Gigabit Ethernet support

  [*]   Ethernet (10000 Mbit)  --->

    <*>   Intel(R) 10GbE PCI Express adapters support

    <*>   Intel(R) 82599 Virtual Function Ethernet support

    <*>   Intel(R) PRO/10GbE support

overkill ~ # ifconfig 

eth0      Link encap:Ethernet  HWaddr 00:01:02:03:04:05 

          UP BROADCAST MULTICAST  MTU:1500  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:1000 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

          Interrupt:46 Base address:0x8000 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:11878 errors:0 dropped:0 overruns:0 frame:0

          TX packets:11878 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:6614071 (6.3 MiB)  TX bytes:6614071 (6.3 MiB)

sit0      Link encap:IPv6-in-IPv4  

          inet6 addr: ::127.0.0.1/96 Scope:Unknown

          UP RUNNING NOARP  MTU:1480  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)

wlan0     Link encap:Ethernet  HWaddr 10:11:12:13:14:15

          inet addr:192.168.0.42  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::2c0:caff:fe39:adde/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1689884 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1385979 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:1842609432 (1.7 GiB)  TX bytes:330420673 (315.1 MiB)

overkill ~ # iwconfig 

lo        no wireless extensions.

eth0      no wireless extensions.

sit0      no wireless extensions.

wlan1     IEEE 802.11abgn  ESSID:off/any  

          Mode:Managed  Access Point: Not-Associated   Tx-Power=off   

          Retry  long limit:7   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:off

          

wlan0     IEEE 802.11bg  ESSID:"waffles"  

          Mode:Managed  Frequency:2.462 GHz  Access Point: 20:21:22:23:24:25

          Bit Rate=36 Mb/s   Tx-Power=20 dBm   

          Retry  long limit:7   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:off

          Link Quality=68/70  Signal level=-42 dBm  

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

sys-kernel/gentoo-sources-2.6.36-r5

net-wireless/iwl6000-ucode-9.221.4.1

net-wireless/wpa_supplicant-0.7.3-r2

sys-apps/iproute2-2.6.35-r2
```

All help much appreciated!

----------

## cach0rr0

I can only answer #1

eth0 is your wired interface. I don't recall the precise reason why, but even if you don't add it to the default runlevel, it will try to start up at boot anyway

since of course you don't have a cable plugged in, it'll time out waiting on a dhcp response 

to fix that? easier than you'd think. rm /etc/init.d/net.eth0

if for some reason you need it again in the future (which, really, if you're using dhcp, no need for it as you can always dhcpcd eth0 and be done with it), easy enough to ln -s /etc/init.d/net.l0 /etc/init.d/net.eth0

that may sound like the "incorrect" way to fix this, but well, it isn't. 

regarding the setup issues, no idea, ive always used wicd, never tried doing it within /etc/conf.d/net. I mean, from what I can tell, yours looks fine (though, do you have init scripts for those wireless interfaces created? If you do have them created already, add them to the default runlevel. If not, do the [b]cd /etc/init.d && ln -s net.lo net.wlan0)

might try with a more basic wpa_supplicant.conf though, I've always used this with my WPA2 network

```

network={ 

ssid="crackme" 

scan_ssid=1 

key_mgmt=WPA-PSK 

psk="awesomepassword" 

}
```

as far as the signal issues go, to be quote honest I keep finding some drivers fare better than others. I have one machine with an Atheros N card (ath9k), which is supposed to be well-supported under Linux, but alas it struggles to do any better than ~6Mbit, whereas my iwlagn card in the other laptop typically gets to at least ~10Mbit, even though its signal is supposedly weaker. The desktop on a wired connection, for comparison's sake, gets roughly 35Mbit down. Can't really give a reason other than "wireless tends to be epic suck depending on your driver quality"

----------

## DrSlony

Thank you! And apologies for the late reply :]

I added /etc/init.d/net.wlan0 (a symlink to net.lo) to rc-update default, but I still cannot get my net to connect at boot time. However, once booted, I can run this and I connect without problems:

  wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

  dhcpcd -n

  iwconfig wlan0 essid norbert

----------

## cach0rr0

 *DrSlony wrote:*   

> 
> 
>   wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
> 
>   dhcpcd -n
> ...

 

the third command should not be needed

wpa_supplicant will handle associating with the wireless access point (which is what 'iwconfig wlan0 essid' does)

I still have no idea about the init script unfortunately (like I said, I've never used it myself; my machines that use wireless are always connecting to different AP's, so this is not practical for me)

----------

## Etal

If that works, check if you have /etc/init.d/dhcpcd and /etc/init.d/wpa_supplicant (I'm not sure if they are there in stable).

If so, you can get rid of the net.* junk and instead just add dhcpcd and wpa_supplicant to the default runlevel.

----------

## DrSlony

-rwxr-xr-x 1 root root 500 Apr 10 14:52 /etc/init.d/dhcpcd

No /etc/init.d/wpa*

Using net-wireless/wpa_supplicant-0.7.3-r2

Should I create /etc/init.d/wpa_supplicant? If so, how?

Once I do that, what should I do?

rc-update del net.wlan0 default

rc-update add dhcpcd default

rc-update add wpa_supplicant default

?

----------

