Friday, January 18, 2013

Gentoo: ndiswrapper wifi connection and setting DNS servers

Gentoo works well on my old Dell E520 (1.86 GHz C2D CPU, 3GB RAM).
In particular, the fact that the emerge package manager compiles everything before install, doesn't create such a massive time problem as it does on my RPi.

Here, I want to outline how I used ndiswrapper to activate my Linksys AE1200 wifi dongle in Gentoo.
Actually, quite a number of guides are available for this end but it seems some recommend unnecessary changes.
So, here I'll give the minimum required (on my system, at least). Every one of these steps is essential.

1. First you need to install ndiswrapper.
Unfortunately, the current stable version 1.57 doesn't emerge without error (struct kernel_stat has no member named 'cpustat').
However, a solution is described in this Ubuntu thread (see post #10).

This involves
i) downloading ndiswrapper-1.58rc1 from here
ii) untar it with

tar -zxvf ndiswrapper-1.58rc1.tar.gz
iii) cd to ndiswrapper-1.58rc1
iv) make
v) sudo make install

2. Download the XP driver for the AE1200 from the Linkysys/Cisco site.

3. Unzip the driver components with
unzip AE1200xp.zip
4. cd to where the components are (probably ~/Downloads/xp/) and issue the command
ndiswrapper -i bcmwlhigh5.inf
5. You need wpa_supplicant but it seems to be already available in the kernel so it doesn't need to be emerged.
You do, however, need to create the file /etc/wpa_supplicant/wpa_supplicant.conf
with the following content (a lot of useful info is available on wifi setup in this forum thread)

ctrl_interface=/var/run/wpa_supplicant
         ctrl_interface_group=wheel      ##You are in the 'wheel' group, aren't you?

        ap_scan-1

       network={     ssid="your network ssid"     ##You must use the quotes

       scan_ssid=1     

       proto=WPA2     

      key_mgmt=WPA-PSK     

     psk="you network password"   ##Again, the quotes must be used

     }

 6. Now, you ask your wireless connection to start at boot by
# cd /etc/init.d          
          # ln -s net.lo net.wlano              ## assuming your wifi interface is wlan0
          # rc-update add net.wlan0 default

7. Now reboot and your wifi should connect.


Now, it's time to get your system to use the DNS servers you want.
There are, in general, a number of ways to do this.

1. Prepend your preferred DNS servers to the file /etc/dhcp3/dhcleint.conf
I've used this in both Ubuntu and Fedora but it's not available in Gentoo.

2. Manually edit /etc/resolv.conf and make it immutable to prevent it being overwritten at boot.
I used this in Gentoo on my Raspberry Pi and it works perfectly.

3. As well as /etc/resolv.conf, Gentoo also offers two further files which can be used to assign servers to /etc/resolv.conf.
These are /etc/resolv.conf.head and /etc/resolv.conf.tail.
You can put as many servers (in the form of lines of the type "nameserver 8.8.4.4") in either file.
Those in the ....head file end up as the highest priority servers, while those placed in the ...tail file are at the other extreme.
I use this in Gentoo on my Desktop and it, too, works without problems.

4. Change your routers DNS servers.





No comments:

Post a Comment