# wlan0 where to configure?

## mijenix

Hi

I have two network interfaces eth0 and a wlan0. I configured the eth0 device in /etc/conf.d/net.

In the time I implemented my wlan card. The baselayout was not able to handle wlan devices for easy configuartion.

So I configured the wlan0 device also in the /etc/conf.d/net. 

And the wlan specific configuration I use wpa_supplication.

Then I made a script for starting the wlan configuration:

 *Quote:*   

> 
> 
> ifconfig eth0 down
> 
> wpa_supplicant -B -iwlan0 -Dndiswrapper -c/etc/wpa_supplicant.conf
> ...

 

That's a little bit annoying manually start the script under root. And another problem with that outflow, 

I always set the default gw manually though I set it on the /etc/conf.d/net for both interfaces.

Then the "new" baselyout comes out.  :Wink: 

So where I can put the configuration in the new baselyout?

--Mathias

----------

## widan

Look at the wireless section of the Gentoo Handbook.

----------

## mijenix

Hi

Thx for ur reply.

Shame on me I never saw this great doc.

I'll try.

--Mathias

----------

## mijenix

Ok, 

now I know where to configure wpa_Supplicant but where I can set the TCP/IP settings for the wlan0 device?

Thx!

--Mathias

----------

## widan

You don't set them for wlan0, you set them per ESSID, look at the last section of the guide (I assume that by "TCP/IP settings" you mean IP address, routes, DNS...)

----------

## mijenix

Hi

So I typed at the end of /etc/conf.d/net these lines:

 *Quote:*   

> 
> 
> modules=("wpa_supplicant")
> 
> wpa_supplicant_wlan0="-Dndiswrapper"
> ...

 

It does not work and now I get the following message on boot:

 *Quote:*   

> 
> 
> * Please make sure that /etc/conf.d/net has $ifconfig_wlan0 set
> 
> (or $iface_wlan0 for old-style configuration)
> ...

 

What's wrong?

Thx for help.

--Mathias

----------

## widan

Maybe your baselayout is too old. Wireless was added quite recently, you need at least baselayout-1.11 or more recent. Look at that post.

----------

## mijenix

Hi

Yes but the 1.11.12-r4 baselyout should be in the stable tree. 

At least depending of the online package database. 

But I'll check that but I'm 99.9% sure it's the 1.11.12-r4 one. 

At that I have the wireless.example file, so it should be the "new" baselyout.

Thx!

--Mathias

----------

## mijenix

Hmm

Any ideas whats wrong?

I have baselayout-1.11.12-r4

--Mathias

----------

## UberLord

Ensure that net.wlan0 is a symbolic link to net.lo

----------

## mijenix

 *UberLord wrote:*   

> Ensure that net.wlan0 is a symbolic link to net.lo

 

There Is a net.wlan0 but it is not a link. Can I delete it and do a link to net.lo?

Thx!

--Mathias

----------

## UberLord

Yes you can

```

cd /etc/init.d

rm net.wlan0

ln -s net.lo net.wlan0

```

If net.lo is less than 100 lines, then you'll need to re-emerge baselayout and ensure that net.lo gets updated with etc-update

----------

## mijenix

 *UberLord wrote:*   

> Yes you can
> 
> ```
> 
> cd /etc/init.d
> ...

 

Thx wlan works, but I need to configured the ip-settings manuell befor the connection to the internet works.

In addition this message appears at bootime:

 *Quote:*   

> 
> 
> * Cannot default to dhcp as there is no dhcp module loaded
> 
> * No configuration for wlan0
> ...

 

But I want a static ip no dhcp! What's wrong?

--Mathias

----------

## UberLord

 *mijenix wrote:*   

> 
> 
>  *Quote:*   
> 
> * Cannot default to dhcp as there is no dhcp module loaded
> ...

 

Easy one - heh

config_wlan0=( "192.168.0.2/24" )

is not defined (both are the same)

replace the IP/netmask with your real one.

The old style config should still work - but it's been so long I forget what it looks like  :Wink: 

----------

## mijenix

Hi

UberLord u are the best! Now IP settings are set and works. 

But I have another problem. 

I need to set the default gw for wlan0. But when I set the routes_wlan0("192.168.0.254")

Then the kernel crash at boottime in wpa_supplicant. But when I mask the line Linux boot up.

Thx!

--Mathias

----------

## mijenix

Hmmm I go crazy. Is it possible to use one default gateway for two interfaces? And why the default gw will set for eth0 and not for wlan0? 

I don't set any routes_eth0 but routes_wlan0 but the defualt gw will set for the eth0 interface.

So what I don't understand? I really don't want to set the settings always manual. I think Linux/Gentoo can that better?!

--Mathias

----------

## widan

 *mijenix wrote:*   

> Hmmm I go crazy. Is it possible to use one default gateway for two interfaces?

 

You can have only one default gateway at one time. But you might want to use different ones (at different times) depending if you're connected to wired network, or wireless, or depending on the wireless network you're using. If you want to use the same for wired and wireless, you can put:

```
routes_eth0=("default via 192.168.0.254")

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

 *mijenix wrote:*   

> And why the default gw will set for eth0 and not for wlan0?
> 
> I don't set any routes_eth0 but routes_wlan0 but the defualt gw will set for the eth0 interface.

 

There is only one default gateway in use. When you set routes_wlan0, you tell the system that when you're connected through wireless (ie wlan0 is up), you want to use that default route. Or maybe I didn't undersand what you meant ?

----------

## mijenix

Hi

Ok maybe it's better to post my config /etc/conf.d/net:

 *Quote:*   

> 
> 
> config_eth0=("192.168.0.21/24 brd 192.168.0.255")
> 
> config_wlan0=("192.168.0.30/24 brd 192.168.0.255")
> ...

 

When I use this config with routes_eth0 commented out then I get the following output for route:

```

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.0.0     *               255.255.255.0   U     0      0        0 wlan0

loopback        Saturn.localhos 255.0.0.0       UG    0      0        0 lo

default         192.168.0.99    0.0.0.0         UG    0      0        0 eth0

```

Why does Linux give the default gw for interface eth0?. It isn't set I commented it out! I every time need to ipconfig eth0 down and route add defualt gw 192.168.0.99 and the it's for the wlan0 device and then the connection works.

And when I use routes_wlan0 and routes_eth0, then I get a kernel panic at boot when Linux is something doing with wpa_supplicant!

So what is the problem? Should I post a bug report or is my config wrong?

Thx for any help!

PS: It's a NetGear WG511 "Made in China" PCMCIA Card with ndiswrapper and the windows drivers.

--Mathias

----------

## mijenix

Hi

No solution? That can't be? 

Or what can I do?

Thx in advice!

--Mathias

----------

## mijenix

Nothing changed, other ideas?

--Mathias

----------

