Tuesday, January 15, 2008

Getting wpa_supplicant to work in Gentoo

"Installing wpa_supplicant

AtRPMS contains packages for Fedora Core.

  • Get the source
  • Make sure your kernel includes the drivers for your wireless card. Here's a sample .config for madwifi users:
 #
#.config
#
# Uncomment following two lines and fix the paths if you have installed openssl
# in non-default location
#CFLAGS += -I/usr/local/openssl/include
#LIBS += -L/usr/local/openssl/lib
# Driver interface for Host AP driver
#CONFIG_DRIVER_HOSTAP=y
# Driver interface for Agere driver
#CONFIG_DRIVER_HERMES=y
# Change include directories to match with the local setup
#CFLAGS += -I../../hcf -I../../include -I../../include/hcf
#CFLAGS += -I../../include/wireless
# Driver interface for Prism54 driver
# (Note: Prism54 is not yet supported, i.e., this will not work as-is and is
# for developers only)
#CONFIG_DRIVER_PRISM54=y
# Driver interface for ndiswrapper
#CONFIG_DRIVER_NDISWRAPPER=y
# Driver interface for Atmel driver
#CONFIG_DRIVER_ATMEL=y
# Driver interface for Broadcom driver
#CONFIG_DRIVER_BROADCOM=y
# Example path for wlioctl.h; change to match your configuration
#CFLAGS += -I/opt/WRT54GS/release/src/include
# Driver interface for Intel ipw2100/2200 driver
#CONFIG_DRIVER_IPW=y
CONFIG_DRIVER_MADWIFI=y
# Change include directories to match with the local setup
CFLAGS += -I../madwif
CONFIG_DRIVER_WEXT=y
# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
#CONFIG_DRIVER_BSD=y
#CFLAGS += -I/usr/local/include
#LIBS += -L/usr/local/lib
# Driver interface for Windows NDIS
#CONFIG_DRIVER_NDIS=y
#CFLAGS += -I/usr/include/w32api/ddk
#LIBS += -L/usr/local/lib
# For native build using mingw
#CONFIG_NATIVE_WINDOWS=y
# Additional directories for cross-compilation on Linux host for mingw target
#CFLAGS += -I/opt/mingw/mingw32/include/ddk
#LIBS += -L/opt/mingw/mingw32/lib
#CC=mingw32-gcc
# Driver interface for development testing
#CONFIG_DRIVER_TEST=y
# Driver interface for wired Ethernet drivers
#CONFIG_DRIVER_WIRED=y
CONFIG_IEEE8021X_EAPOL=y
# EAP-MD5 (automatically included if EAP-TTLS is enabled)
CONFIG_EAP_MD5=y
# EAP-MSCHAPv2 (automatically included if EAP-PEAP is enabled)
CONFIG_EAP_MSCHAPV2=y
# EAP-TLS
CONFIG_EAP_TLS=y
# EAL-PEAP
CONFIG_EAP_PEAP=y
# EAP-TTLS
CONFIG_EAP_TTLS=y
# EAP-GTC
CONFIG_EAP_GTC=y
# EAP-OTP
CONFIG_EAP_OTP=y
# LEAP
CONFIG_EAP_LEAP=y
# PKCS#12 (PFX) support (used to read private key and certificate file from
# a file that usually has extension .p12 or .pfx)
CONFIG_PKCS12=y
# Include control interface for external programs, e.g, wpa_cli
CONFIG_CTRL_IFACE=y
  • install wpa_supplicant by # make && make install

Configuration

Set wpa_supplicant.conf to the following:

You have to change the values according to the response of # wpa_passphrase .

For WPA-PSK

 
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
# ap_scan=2 was the one for me you may try 0 or 1 indstead of 2
ap_scan=2
fast_reauth=1

network={
ssid="my_network"
proto=WPA
key_mgmt=WPA-PSK
pairwise=TKIP
group=TKIP
psk="secret_password"
}

For WPA2-Personal

 
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1

network={
ssid="my_network"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="secret_password"
}

Starting wpa_supplicant

When using a recent ipw2200 driver

When using a recent ipw2200 driver (e.g., as found in recent mainline kernels):

# wpa_supplicant -d -c/etc/wpa_supplicant.conf -ieth1 -Dwext

If every thing works as expected, you can replace -d by -B for the deamon mode.

In the instructions below, replace the interface name ath0 with the appropriate one (usually eth1).

When using the madwifi driver

Make sure that the modules ath_pci, ath_hal, ath_rate_sample, wlan, wlan_tkip and wlan_xauth are loaded (using # lsmod).

Now you are able to start wpa_supplicant by

# wpa_supplicant -d -c /etc/wpa_supplicant.conf -iath0 -Dmadwifi

If every thing works as expected, you can replace -d by -B for the deamon mode.

Bringing up the network card manually

  • Bring up the network interface with # ifconfig ath0 up.
NOTE!
At the moment there is a problem within the madwifi driver or wpa_supplicant passing dhcp. That´s why I use a fixed IP.

There are two patches one for wpa_supllicant (http://hostap.epitest.fi/bugz/show_bug.cgi?id=63) and one for madwifi

(http://article.gmane.org/gmane.linux.drivers.madwifi.devel/1275). Each one is supposed to work.
  • Change the routes and add the default gateway.

Bringing up the device at boottime (for Gentoo users)

  • Make a symbolic link
# cd /etc/init.d/
# ln -s net.lo net.ath0
  • Copy wpa_supplicant.conf to /etc/conf.d/wpa_supplicant.
  • Edit /etc/conf.d/net
 #
#net
#
modules=( "wpa_supplicant" )
wpa_supplicant_ath0="-Dmadwifi"modules=( "wpa_supplicant" )
wpa_timeout_ath0=60
config_ath0=(" netmask 255.255.255.0")
routes_ath0=("default gw ")
  • Add net.ath0 to the default runlevel by executing
# rc-update add net.ath0 default
  • Make sure all needed modules are in /etc/modules.autoload/2.x

"


All this is quoted from http://www.thinkwiki.org/wiki/Wpa_supplicant
and all the credit should be given to its authors.
This is just a reference point in case that page is brought down.

Wednesday, January 2, 2008

Gentoo Guide of useful software

Go here
http://gentoo-wiki.com/TIP_Recommended_Packages

nice list of software, for gentoo
good starting point for a bradnd new installation
since its hard to rememebr what to install
in a fresh install of gentoo.