# no wlan0

## Sythyss

Ok, I know you've been here before, but I'm kinda new and not sure how to fix this. I'm trying to install ndiswrapper correctly, and ndiswrapper -l gives my driver, as well as device present. depmod -a yields no errors, and modprobe ndiswrapper seems to work. But dmesg only gives me "ndiswrapper version 1.50 loaded (smp=no, preempt=no"...nothing else, and when I go to iwconfig, there's no wlan0. (btw, smp used to be set to yes, but I read that it could 'cause problems, so I disabled it.)

any ideas?

----------

## elbartoqwertyuiop

I have a similar problem.  Ndiswrapper tells me that the device is present: 

```
tux ~ # ndiswrapper -l

bcmwl5 : driver installed

        device (14E4:4318) present (alternate driver: ssb)

```

Modprobe didn't give me any issues, but rc gives me this:

```
tux ~ # rc

 * Starting wlan0

 *   Loading networking modules for wlan0

 *     modules: apipa arping ccwgroup macchanger macnet rename iwconfig essidnet iptunnel ifconfig system dhcpcd ip6to4

 *       iwconfig provides wireless

 *       ifconfig provides interface

 *       dhcpcd provides dhcp

 *   Configuration not set for wlan0 - assuming DHCP

 *   Bringing up wlan0

 *     dhcp

 *       network interface wlan0 does not exist

 *       Please verify hardware or kernel module (driver)                                                                                                                   [ !! ]

```

I have a bcm4318 if it helps.  Any ideas?

----------

## pappy_mcfae

If you are using any kernel greater than 2.6.22.19 or 2.6.22-gentoo-r10, you are going to have spotty to bad luck getting ndiswrapper to function. While the newest gentoo-sources kernel (2.6.25-r1) does give much better ndiswrapper support, it doesn't hold a candle to 2.6.22.x for reliability. Get things working in 2.6.22 to make sure all is well, then move up to the .25 to see if it works properly for your situation.

Blessed be!

Pappy

----------

## Sythyss

how to I tell gentoo to emerge 2.6.25....when I emerge gentoo-sources it's still only 2.6.24

----------

## Sythyss

nvm I got it.... I see .25 is still in development, so I'll just go down to .22 and see if that works for now

----------

## Sythyss

hm...no, still not working in .22. My friend also seems to be having the same problem on his ubuntu installation =/

----------

## Sythyss

um I have no /etc/init.d/networking....is that a problem?

came from an ubuntu forum post...don't know if it's applicable for gentoo

----------

## Sythyss

any help? if I can't get the internet working soon I'll have to move back to windows for the time being...can't function w/o the internet, and that's the last thing in the world I want to do =P

----------

## pappy_mcfae

Firstly, before the kernel gets condemned out of hand, let me see your .config. 

Secondly, if you want to emerge the newest gentoo-sources kernel (2.5.25.-r2), add this line to your /etc/portage/package.keywords file:

```
=sys-kernel/gentoo-sources-2.6.25-r2 ~x86
```

...assuming you are using x86 32 bit Gentoo.

Thirdly, also please post your /etc/conf.d/net file, the results of lspci, iwconfig, and ifconfig -a.

Blessed be!

Pappy

----------

## Sythyss

my /etc/conf.d/net file is:

 *Quote:*   

> # 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
> ...

 

my lspci is:

 *Quote:*   

> 00:00.0 Host bridge: Intel Corporation 82865G/PE/P DRAM Controller/Host-Hub Interface (rev 02)
> 
> 00:02.0 VGA compatible controller: Intel Corporation 82865G Integrated Graphics Controller (rev 02)
> 
> 00:1d.0 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #1 (rev 02)
> ...

 

my iwconfig:

 *Quote:*   

> lo        no wireless extensions.
> 
> eth0      no wireless extensions.
> 
> sit0      no wireless extensions.

 

my ifconfig -a:

 *Quote:*   

> eth0      Link encap:Ethernet  HWaddr 00:13:20:19:4B:D5  
> 
>           inet addr:192.168.1.104  Bcast:192.168.1.255  Mask:255.255.255.0
> 
>           inet6 addr: fe80::213:20ff:fe19:4bd5/64 Scope:Link
> ...

 

and my .config:

 *Quote:*   

> #
> 
> # Automatically generated make config: don't edit
> 
> # Linux kernel version: 2.6.25-gentoo-r2
> ...

 

----------

## pappy_mcfae

Ok, while I cogitate over that stuff, do you modprobe ndiswrapper or have it start automatically at boot time? I assume you're using a non-secure access point. Is this correct? 

I'll check things out real quick and be back to tell you if I see something odd.

Blessed be!

Pappy

----------

## pappy_mcfae

I don't see an indication of any wireless devices at all in your lspci list. Is it a USB device or something else? I need to know.

Blessed be!

Pappy

----------

## pappy_mcfae

Go here to get the config I set up for you. I eliminated a lot of unnecessary things, and added some tweaks that I use on my two laptops. Once we find out what your wireless device is, then we can get it to work. 

Blessed be!

Pappy

----------

## Sythyss

thanks a bunch. yeah, my wireless is a USB device, and is connecting to a non-secure access point. The relevent part from lsusb would be "Bus 001 Device 002: ID 07d1:3b11 D-Link System"

And yeah I'm using modprobe ndiswrapper...not auto starting at boot yet

oh and just to double check I'm recompiling this thing right...=P

I replace my current .config file in /usr/src/linux with yours...execute make && make modules install...then make install, and that's all I need to do?

----------

## pappy_mcfae

First of all, move your .config to a safe place, just in case I made any errors. While there is no .config in the source, enter make mrproper. This will eliminate any stray object code. Then put my .config into the source directory. Type in make && make modules_install. That will compile my kernel version without any left-overs from yours. 

And I admit I am not that good with USB devices, but to the best of my knowledge, the .config I set up for you should be able to support it.

Blessed be!

Pappy

----------

## Sythyss

hm...still not working. I guess it's just a bad driver, although it is the most recent....

although now I have a new "dummy0" in iwconfig =P...still no wireless tho

----------

## pappy_mcfae

Firstly, to make sure you're using the latest and greatest version of ndiswrapper, add the following line to your /etc/portage/package.keywords:

```
=net-wireless/ndiswrapper-1.52 ~x86
```

Then try entering the following:

```
USE="usb" emerge -av ndiswrapper
```

That should give you the desired results. Beyond that, I am at a loss. my wireless adapters are either built in or pun off a PCMCIA card. Both options generally work better than USB devices. I do know that they will work. I've just never personally set one up.

Blessed be!

Pappy

----------

## Sythyss

haha! that did it...it was the USE flag. Thanks a bunch, mate.

----------

## Sythyss

ok....very close, actually =P

from iwconfig I can now get:

wlan0     IEEE 802.11g  ESSID:"Bolton_Home"  

          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:16:B6:4F:1C:27   

          Bit Rate=54 Mb/s   Sensitivity=-200 dBm  

          RTS thr=2346 B   Fragment thr=2346 B   

          Encryption key:off

          Power Management:off

          Link Quality:42/100  Signal level:-69 dBm  Noise level:-96 dBm

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

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

but it's still not connecting to the internet unless the ethernet is plugged in. Is my browser still "trying" to connect through the ethernet since it's set as default somewhere?

EDIT: oh, and how would I get the wireless to autostart at boot? that'd be helpful

EDIT2: Same thing happens when I try to use NetworkManager. It sees the wireless network, but when I click on it, it starts trying to connect, but then stops and just goes back to not being connected.

----------

## pappy_mcfae

Ok...you're actually in better shape than you think. The fact that iwconfig shows a semi-functional net device means we're almost there. To get it to autostart, enter the following:

```
ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0
```

Sorry about that. I forgot to mention that part. 

Once you get it going, save your /etc/conf.d/net file to a different directory. Then add these lines to that file

```
config_wlan0="dhcp"

routes_wlan0="default via <your_AP_IP_address>
```

<your_AP_IP_address> will be the same as your routes_eth0 setting.

Blessed be!

Pappy

----------

## Sythyss

I don't have a routes setting for my eth0. Would it be something that should look similar to 00:16:B6:4F:1C:27?

----------

## pappy_mcfae

 *Sythyss wrote:*   

> I don't have a routes setting for my eth0. Would it be something that should look similar to 00:16:B6:4F:1C:27?

 

No, that's the mac address. Look at the file /etc/resolv.conf. In it, you should see nameserver followed by a number separated by dots. My /etc/resolv.conf says:

```
# Generated by dhcpcd for interface wlan0

nameserver 192.168.0.1
```

That number, 192.168.0.1 is the gateway address from my wireless adapter, and therefore becomes the default route to my DSL.You use that number as the default route. For instance, here is how I call it with my network setup:

```
routes_eth0="default via 192.168.0.1"
```

What IP address do you get when you type ifconfig with the wired network adapter plugged in and the net functional?

Blessed be!

Pappy

EDIT: I forgot to tell you to add usb to your USE flags. You can do it globally in /etc/make.conf, or on a package by package basis using /etc/portage/package.use thusly:

```
net-wireless/ndiswrapper usb
```

----------

## Sythyss

this is my resolv.conf....wlan0 isn't listed.

 *Quote:*   

> # Generated by dhcpcd for interface eth0
> 
> nameserver 207.69.188.186
> 
> nameserver 207.69.188.185

 

my internal IP is 192.168.1.104

----------

## pappy_mcfae

Please post the result of 'route'

bbp

----------

## Sythyss

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.1.0     *               255.255.255.0   U     0      0        0 eth0

link-local      *               255.255.0.0     U     0      0        0 eth0

loopback        *               255.0.0.0       U     0      0        0 lo

default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

----------

## pappy_mcfae

 *Sythyss wrote:*   

> Kernel IP routing table
> 
> Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
> 
> 192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
> ...

 

Good, that means your default gateway is 192.168.1.1. Just to see what happens, add this to your /etc/conf.d/net file:

```
config_wlan0=( "192.168.1.115" )

routes_wlan0=( "default via 192.168.1.1" )
```

Reboot and run ifconfig to see if wlan0 gets that static address assigned.

Blessed be!

Pappy

----------

## pappy_mcfae

Also, please post the entirety of dmesg after your next boot.

bb!p

----------

## Sythyss

yup, it successfully gave it the ip. and here's the dmesg.

 *Quote:*   

> Linux version 2.6.25-gentoo-r2 (root@syth-desktop) (gcc version 4.1.2 (Gentoo 4.1.2 p1.0.2)) #6 SMP PREEMPT Tue May 6 09:34:52 PDT 2008
> 
> BIOS-provided physical RAM map:
> 
>  BIOS-e820: 0000000000000000 - 00000000000a0000 (usable)
> ...

 

----------

## pappy_mcfae

Well, cool. It sounds like your up and running. 

Enjoy.

Blessed be!

Pappy

----------

## Sythyss

but if I pull out my ethernet cord all my internet dies still =/

EDIT: I'll try having eth0 not startup on boot...just the wireless. maybe that'll work...for whatever reason =P

----------

## Sythyss

yep...all is well. apparently my wireless doesn't work if my ethernet is plugged in. Thanks a bunch for the help.

----------

## pappy_mcfae

My laptop is set up with a custom automatic networking setup that detects whether or not the wired adapter is plugged in, installs a different /etc/conf.d/net file depending on whether or not it is, and then renames either the wired or wireless interface to eth0. It works flawlessly as long as I don't update to baselayout-2/openrc, but that's another subject.

You might have to move to some weird networking setup to get things to run. If so, I have a few tricks up my sleeves.

Blessed be!

Pappy

----------

## Sythyss

0.o....sounds pretty cool.

gimme!   :Very Happy: 

----------

## pappy_mcfae

Tomorrow...I'm heading off to bed. 

Blessed be!

Pappy

----------

## Sythyss

np mate. ciao o/

----------

## pappy_mcfae

Ok, I'll start with the caveats and warnings. The biggest caveat is this will not work with baselayout-2/openrc. They've scuttled interface renaming in the net scripts with baselayout-2. There is no warranty this will work. There are probably a million other ways to do what I did. This is just what I came up with. This setup is designed to work at boot time. If you want to change network modes, you will have to reboot. It is not an on-the-fly setup, although I bet I could make it so if I really wanted to...and I don't.

The only program emerged over and above the stock Gentoo setup was ethtool. It is required to detect the presence of carrier on the wired adapter at boot time. I did also add iproute2 support at a later date; however, it is not required to make this setup work.

How It Works:

The idea behind this setup is I wanted to be able to move my laptop from my "desk" to anyplace else in my apartment, and maintain network access and a static IP address whether the machine is tethered to a net cable, or whether it's sucking in the internet from the wireless. I looked at some other options to do the same, and I decided I could do it better myself.

At boot time, I have a Gentoo-style initialization script that detects whether or not there is carrier present at the wired adapter. If so, the script removes /etc/conf.d/net, and replaces it with a script for the wired adapter kept in a separate directory and renamed to /etc/conf.d/net, and removes the interface name of the other interface (/etc/init.d/net.wlan0). If no carrier is detected, the script removes /etc/conf.d/net, and replaces it with a script for the wireless adapter kept in a separate directory and renamed to /etc/conf.d/net, and removes the interface name of the other interface (/etc/init.d/net.wth0). Removing the opposite interface name prevents that interface from initializing and causing possible naming problems.

This is that initial script, named /etc/init.d/select-net:

```
#! /sbin/runscript

# Copyright 2008 Pappy McFae

# original file name: /etc/init.d/net-select

# renamed: /etc/init.d/select-net

# Distributed under the terms of the GNU General Public License v2

#

# Automatic network configuration script

# Actively selects preferred network interface at boot time

# By looking to see if the wired network adapter cable is connected

#

# Where do I need to be?

depend() {

   before fuse

}

start() {

ebegin "Begin automatic network configuration"

if ethtool wth0 | grep -q 'Link detected: no'; then

   ebegin "Configuring for wireless adapter"

   rm -f /etc/init.d/net.wth0

   rm -f /etc/conf.d/net

   cp /etc/net-select/net.wl /etc/conf.d/net

 

else ebegin "Configuring for wired adapter"

   rm -f /etc/init.d/net.wlan0

   rm -f /etc/conf.d/net

   cp /etc/net-select/net.wire /etc/conf.d/net

fi

eend

}
```

In order to prevent naming collisions, I renamed the wired adapter to wth0 under /etc/udev/rules.d/70-persistent-net.rules thusly:

```
# This file was automatically generated by the /lib/udev/write_net_rules

# program, probably run by the persistent-net-generator.rules rules file.

#

# You can modify it, as long as you keep each rule on a single line.

# PCI device 0x10ec:0x8139 (8139too)

# SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:16:d4:bd:2b:64", NAME="eth0"

# PCI device 0x14e4:0x4311 (ndiswrapper)

SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:1a:73:20:85:cb", ATTR{type}=="1", NAME="wlan0"

# PCI device 0x10ec:0x8139 (8139too)

SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:16:d4:bd:2b:64", NAME="wth0"

```

So, as you can see, the wired driver begins life as wth0, and the wireless begins life as wlan0.

Of course, the individual files need to exist as well. This is the /etc/net-select/net.wire script:

```
# Copyright 2008 Pappy McFae

# Original filename: /etc/net-select/net.wire

# Distributed under the terms of the GNU General Public License v2

# Installed when wired adpater is found.

# Modify to suit your needs.

rename_wth0="eth0"

config_eth0=( "192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255" )

routes_eth0=( "default via 192.168.0.1" )

```

and this is the /etc/net-select/net.wl script:

```
# Copyright 2008 Pappy McFae

# Original filename: /etc/net-select/net.wl

# Distributed under the terms of the GNU General Public License v2

# Installed when wired adpater is disconnected.

# Modify to suit your needs.

modules=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dndiswrapper"

rename_wlan0="eth0"

config_eth0=( "192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255" )

routes_eth0=( "default via 192.168.0.1" )

gateway=( "eth0/192.168.0.1" )

```

The last step is to reset all the variables and replace all the deleted files. That is accomplished by way of adding the following lines to /etc/conf.d/local.start:

```
# reset the automatic network detection file system for the next reboot

if [ ! -e /etc/init.d/net.wth0 ]; then

   ln -s /etc/init.d/net.lo /etc/init.d/net.wth0

elif [ ! -e /etc/init.d/net.wlan0 ]; then

   ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0

fi
```

That's it in a nutshell. It works great. You're more than welcome to modify it to suit your needs.

Blessed be!

Pappy

----------

