# Set a wireless network on a laptop

## Dreepser

Hi everyone,

This is my first post on Gentoo forums so I guess I had to say "hello" to all of your ^^ That's now done.

I am not an expert in using Linux but I have already tested some distributions. I'd heard about Gentoo and finally I got it installed on my DELL Laptop thanks to your Handbook which are ... excellent !

So I have a working Gentoo distribution but it's very poor for now : no wi-fi, no WM in fact, it has nothing more than what is installed during the installation process. The first thing I want to set up is the network : as I come from a Archlinux (and the network was working) I though I could set it up under Gentoo the same way, but I have difficulty doing it : that's what I ask for your help.

My network is WEP-encrypted, and under Archlinux I used wireless-tools, that's why I emerged it under Gentoo. With "lspci" command I noticed my wi-fi card and when I was under Archlinux it seemed that "ath9k" driver was the best choice for me (my wireless card is Atheros based, and model AR928X).

Under Archlinux it was very simple, the first time I had to download ath9k and "modprobe" it. Then every time I wanted to connect to my wireless network I had to do so :

```

ifconfig wlan0 up //the wi-fi del became turned on

iwlist wlan0 scan // to check that my network was reachable

iwconfig wlan0 essid "TECOM...." key 00a7-a4.... // I got connected to the network

dhcpcd wlan0 // and then I got my local ip adress

```

And I was connected to the network.

Under Gentoo I first checked whether ath9k was already "modprobed" so I types "lsmod" with root privileges and I was surprised to see that I had nothing : no modules at all. Could you tell if if it's a problem, if it's normal or if I did something wrong during the installation process ?

I tried to "emerge ath9k" but it didn't find anything (I guess it's normal) and as Gentoo is a bit special I don't really now what to do.

I made the installation using and Ethernet cable and I can connect to the Internet with this connection, through eth0 but I'd like to set Wireless. I don't know if there is another way to get connected, but I know that ath9k driver works with my laptop (I think there is something working with ath9k like mac80211 which is not "modprobed" in my Gentoo).

So I hope you will be able to help me on this one, I thank you in advance and congrats for Gentoo handbooks and for Gentoo generally speaking !

----------

## NeddySeagoon

Dreepser,

Welcome to Gentoo.

Having nothing in lsmod shows you have no kernel modules loaded. Thats neither good nor bad. It depened how you made your kernel.

If you selected everything as <*> and nothing as <M>, you have no modules to load. Monolithic kernels like that are commonly used on internet facing servers. Its also possible you missed the 

```
make modules_install 
```

kernel build step but if its needed you get lots of errors on booting, so you tend to notice.

On my kernel, in make menuconfig, pressing / and entering ath9k shows

```
  │ Symbol: ATH9K [=n]                                                                                                       │  

  │ Prompt: Atheros 802.11n wireless cards support                                                                           │  

  │   Defined at drivers/net/wireless/ath9k/Kconfig:1                                                                        │  

  │   Depends on: NETDEVICES && !S390 && PCI && MAC80211 && WLAN_80211 && (RFKILL || RFKILL=n)                               │  

  │   Location:                                                                                                              │  

  │     -> Device Drivers                                                                                                    │  

  │       -> Network device support (NETDEVICES [=y])                                                                        │  

  │         -> Wireless LAN                                                                                                  │  

  │           -> Wireless LAN (IEEE 802.11) (WLAN_80211 [=y])
```

So you may need to rebuild your kernel to get the driver, either as built in or as a module.

Then you can follow the handbook to set up wireless tools wireless networking

----------

## Dreepser

NeddySeagoon,

Thanks for your answer. As you said, I selected everything as <*>. I didn't forget to do so "make modules_install" and I don't have lots of errors on booting, so I guess there is no problems with that.

But when I had to select all things for my kernel, I don't know if I selected what you showed (and I guess I didn't). That means I have to rebuild my kernel ? That's okay, does it mean I have to re-install completely Gentoo or can I rebuild it from the installation ? I guess I can, but as I said I'm not very good at using Linux, I'm installed it in order to learn ^^

So may I ask you if there is a handbook or a howto that explains how to rebuild the kernel ?

Thanks again a lot.

Regards, 

Dreepser

----------

## szczerb

Rebuilding a kernel is a thing you do on every kernel upgrade an every time you want to change something in it - absolutely no need for a reinstal.

Read this:

http://www.gentoo.org/doc/en/kernel-upgrade.xml

It describes and upgrade but I'm sure you will be able to filter out the stuff that you don't have to do.

I suggest that you consider not setting the symlink USE flag. This way the symlink won't be set automagicaly to the new version - this is the behaviour that I prefer.

If you are unsure about anything -> ask ;]

----------

## NeddySeagoon

Dreepser,

A kernel update comes out every 6  or 8 weeks.

The process is just like making and installing your kernel for the first time, except you can reuse you old .config file if you are careful.

----------

## d2_racing

@Dreepser, can you post this plz :

```

# lsmod

# lspci -v

# cat /etc/conf.d/net

# ifconfig -a

# iwconfig

```

Also, do you plan to use wpa_supplicant to connect to your Access Point ?

If so, we can help you with that too  :Razz: 

----------

## Dreepser

Hi everyone,

Thanks a lot for all your answers, I'm gonna read the link you gave me to try to rebuild my kernel (hope I'll succeed !).

For d2_racing : 

```

lsmod :

lspci -v :

//produces a very long output (234 lines). Could you tell me what you want to know ?

// In /etc/conf.d/net I just wrote this :

config_eth0=( "dhcp" )

ifconfig -a :

// I just have eth0 and lo active, but it displays sit0 anyway

iwconfig :

// Gives the message "no wireless extensions" for the three lo, eth0 and sit0

```

There is something I'm not having understood : 

 *Quote:*   

> I suggest that you consider not setting the symlink USE flag. This way the symlink won't be set automagicaly to the new version - this is the behaviour that I prefer. 

 

I understand what "symlinke" USE flag does, but not why you suggest no to set it.

For now I'm gonna read and try to understand the howto to rebuild the kernel, again, thanks to all of you !

Regards,

Dreepser

----------

## szczerb

You'll know what I meant about the symlink flag, after reading the kernel upgrade guide.

----------

## Dreepser

I've finished reading, I think I understood.

Here is what I did :

I tried the "emerge -u gentoo-sources" command, but I gave the answer that there were no update, so I typed "emerge gentoo-sources" (without the -u) and it downloaded, and then installed it (which I didn't want). But then I tried anyway :

I did : "cd /usr/src/linux" then "make menuconfig" I selected what I needed with <M> option and finished with "make && make modules_install" => still working on it.

I hope I did it right, and I guess it's not too bad because while I was writing this message I saw something about ath9k on screen ^^

The point were I think there might be a problem is the fact that I typed "emerge gentoo-sources".

The compilation has just ended up, and the last messages are : "INSTALL drivers/net/wireless/ath9k/ath9k.ko" I think it's pretty good news. A question remains : do I have to add a new entry into GRUB ? Because when I "ls /usr/src" I still have the same thing as before, maybe it's because it's not an update ?

----------

## NeddySeagoon

Dreepser,

As there was no update emerge gentoo-sources, fetched the same sources as you already had and overwrote them.

It was just wasted time and bandwidth.  The .config and existing binary files in your kernel tree were not changed.

```
make && make modules_install
```

builds the kernel and its modules, then installs the modules. It does not mount /boot nor copy the bzImage file to /boot, where grub can find it.

Provided you *ONLY* changed settings from < > (off) to <M> (Module) thats fine as the bzImage file has not changed.

Its easy to check. Do 

```
modprobe ath9k
```

if there are no errors, it worked. Look at the output of dmesg too.

The interface sit0 is for tunneling IP6 over IP4. If you don't know what IP6 is, you don't need it and irs safe to ignore.

----------

## Dreepser

Hi !

I'm happy because I did what you've just said and it worked !

When I rebooted, I tried "lsmod" and saw "ath9k" but no mac80211 I worryied a bit, but then I did the same things I used to when I as under Archlinux, meaning :

```

ifconfig wlan0 up

iwlist wlan0 scan

iwconfig essid "..." key "..."

dhcpcd wlan0

```

and it simply worked ! I tried "ping" command and I got responses !

Thanks to all of your it works, thank you again !

Is there a way to switch this post into "SOLVED" or do I have to edit the title manually ?

----------

## NeddySeagoon

Dreepser,

You edit the title of the first post in the thread.

----------

## NeddySeagoon

Dreepser,

You can put the wireless setup stuff into /etc/conf.d/net

----------

## Dreepser

Okay,

I have few things to do first, and as soon as I'm free, I'll try to put that stuff in the /etc/conf.d/net file until I let the post in this state.

Thanks for everything, coming back soon.

----------

## d2_racing

Until we don't see that you have wlan0 when you run this : 

```
# ifconfig -a
```

Then you will need to tweak your kernel.

----------

