Welcome to the new location of Alien's Wiki, sharing a single dokuwiki install with the SlackDocs Wiki.

Welcome to Eric Hameleers (Alien BOB)'s Wiki pages.

If you want to support my work, please consider a small donation:

This is an old revision of the document!


Configuring your network in Slackware

FIXME This text is being worked on at the moment (Eric - 20080909) FIXME

This article will is intended to be an in-depth look into the way network cards are configured in Slackware. The network scripts themselves are well-documented but there is not much other written documentation apart from the Network Configuration chapter in the Slackware Linux Essentials book.

Wired network

History

Network configuration parameters

IFNAME[4]="eth0:1"             # Set up an IP alias.
HWADDR[4]="00:01:23:45:67:89"  # Overrule the card's hardware MAC address
MTU[4]=""                      # The default MTU is 1500, but you might need
                               # 1360 when you use NAT'ed IPSec traffic.
DHCP_TIMEOUT[4]=15             # The default timeout for the DHCP client to
                               # wait for server resonse is 30 seconds, but
                               # you might want a shorter wait.
DHCP_KEEPRESOLV[4]="yes"       # If you dont want /etc/resolv.conf overwritten
DHCP_KEEPNTP[4]="yes"          # If you don't want ntp.conf overwritten
DHCP_KEEPGW[4]="yes"           # If you don't want the DHCP server to change
                               # your default gateway
DHCP_IPADDR[4]=""              # Request a specific IP address from the DHCP
                               # server

(Re) starting a network interface

In Slackware, the way to start your network (meaning, the configuration of your nics and bringing the interfaces up, and creating a default route if required) is by running the command

/etc/rc.d.rc.inet1

Restarting the whole network is done in a similar fashion:

/etc/rc.d.rc.inet1 restart

This is quite crude, and not adequate for the dynamic detection and configuration of network devices. Therefore, when your computer boots, and UDEV detects your network hardware, it will run the following command after loading the kernel driver and determining the name of the interface (let's assume that it is wlan0):

/etc/rc.d.rc.inet1 wlan0_start

More generically speaking, you can start/stop/restart any network interface yourself by running one of the commands

/etc/rc.d.rc.inet1 INTERFACE_start
/etc/rc.d.rc.inet1 INTERFACE_stop
/etc/rc.d.rc.inet1 INTERFACE_restart

Wireless Network

If you have a Wireless Access Point that is broadcasting its station ID (the ESSID), and is not configured for encrypted traffic, then you're ready to go with the default configuration as it comes with Slackware. This kind of open wireless network is typical when

  1. you just took your Wireless Access Point out of the box you bought it in, and didn't have time yet to configure it;
  2. you are at an airport/hotel/pub where they offer free wireless access.

If you need to configure specific parameters to make the wireless card talk to your Access Point - for instance, the ESSID (in case the Access Point is hiding its station ID), or the channel, or a WEP key, etc) then you will need to edit either the file

/etc/rc.d/rc.wireless.conf

or the file

/etc/rc.d/rc.inet1.conf

(one of the two will do) and add a specific configuration that matches your wireless card and Access Point.

History

Historically, the pcmcia subsystem did support (wired as well as) wireless cards already, but these cards were typically configured using the /etc/pcmcia/network.opts and /etc/pcmcia/wireless.opts files. The introduction on the market of wireless PCCard (which is essentially 32-bit PCI with a PCMCIA interface) and PCI devices demanded a new approach. Support for these cards would have to he added to the rc.inet1 script.

The first release of Slackware to have support for PCI and PCCard wireless network cards was 10.0. The script /etc/rc.d/rc.wireless takes care of configuring the wireless parameters for a network interface. This script is being called by the generic network configuration script /etc/rc.d/rc.inet1 for every network interface which is being initialized. The rc.wireless script will return control to rc.inet1 immediately if it determines that the interface has no wireless capabilities.

The rc.wireless script is not meant to be run on it's own by the user.

However, it would take until Slackware 10.2 to support network cards out of the box whose name did not start with eth … The prefix eth was hard-coded in the rc.inet1 script until then. That meant, a wireless interface had to be called for instance eth1 to be supported. Early PC-Card devices would indeed be configured by their drivers as ethN, while the older PCMCIA (16-bit) cards were typically configured as wlanN.

A network card that shows up as ath0 can not be setup with an IP address using the configuration files that are part of pre-Slackware 10.2 releases. We are going to assume here that you are running Slackware 10.2 or newer. Most people with wireless cards will be better of with a recent release like Slackware 12.1. For older releases, there are directions in an other Wiki article about updating the network scripts.

The first versions of the rc.wireless script relied on the /etc/rc.d-rc.wireless.conf file to hold all of your wireless card's configuration. Starting with Slackware 10.2, it was also possible to use /etc/rc.d/rc.inet1.conf to store wireless parameters. Support for WPA encryption (using wpa_supplicant) was also added, although it would take until Slackware 11.0 before a wpa_supplicant package was actually added to the /testing directory. In Slackware 12.0, wpa_supplicant finally became part of the 'N' package series.

Choosing between rc.wireless.conf or rc.inet1.conf

In the previous section, I briefly mentioned the fact that you can store your wireless network parameters (excluding WPA) in both rc.wireless.conf and rc.inet1.conf. I will show you how to use rc.wireless.conf but first let me explain why I prefer to let people use rc.inet1.conf instead.

Originally, rc.wireless.conf was the file to store your wireless parameters. When support for wireless parameters was also added to rc.inet1.conf this was done with a reason.
The rc.wireless and rc.wireless.conf files were initially based on the pcmcia scripts for wireless cards. That means your card's parameters were tied to it's MAC address (with the option to use a wildcard in that MAC address to support different brands of cards). This is different from the standard way of configuring a network card in Slackware, where network configuration parameters are tied to the name of the interface. Adding the option to define your wireless configuration parameters in rc.inet1.conf allows you to keep all your network settings (apart from WPA) in one file: rc.inet1.conf. I can hear you think “what happens if I define a wireless parameter in both files?”. Good question! In fact, a parameter value which is set in rc.inet1.conf will always override the value you might have set for that same parameter in rc.wireless.conf.
I regularly hear from Slackware users that they are confused by the possibility to use two configuration files for the same settings. Well, I agree. This rc.wireless.conf is a historic left-over and ultimately I would like to see it removed from the Slackware wireless-tools package completely. I think there is no good reason to want to keep using rc.wireless.conf. In fact, you can safely delete that entire file! But for those who do not want to say goodbye to it, we will keep support for it in the network configuration scripts.

Any wireless parameter defined in rc.wireless.conf and called FOO is equivalent to the wireless parameter called WLAN_FOO[n] in rc.inet1.conf (the [n] being the index relating to your card). The WLAN_ prefix is what distinguishes the two.
Please use /etc/rc.d/rc.inet1.conf as the single configuration file for all your network parameters (wired as well as wireless)

Let us have a better look at these two files now.

  • rc.wireless.conf
    You will notice that the content of /etc/rc.d/rc.wireless.conf is basically a number of sections that apply to certain (ranges of) wireless network cards. The distinguishing factor is the hardware address (the MAC address) of a card. A section for a specific card or range of cards looks like this:
      MAC_Address)
          INFO="a string that decribes your card type"
          PARAMETER1="value1"
          PARAMETER2="value2"
          [more parameters] .......
          ;;

    The MAC_Address in this example can be a full MAC address (six HEX bytes separated by colons, like 00:12:8E:A0:32:DC) that matches a single network card, or a wildcard address that matches a whole range of cards, typically all cards from a specific vendor (like 00:12:8E:A0:*).
    If you intend to use rc.wireless.conf you will probably have to add such a section for your specific card, and this is how to do it:

    • If your wireless interface called wlan0, run ifconfig wlan0 to get the MAC address of the card.
    • Edit /etc/rc.d/rc.wireless.conf and comment out this section right in the beginning of the file:
        *)
            INFO="Any ESSID"
            ESSID="any"
            ;;

      so that it will look like this:

      # *)
      #     INFO="Any ESSID"
      #     ESSID="any"
      #     ;;
    • Somewhere further below the lines you just commented out, add a few lines (easiest is to add it to the very bottom of the file for instance, right above the esac line) that will apply to your card, like these:
        00:06:25:13:2B:D4)
            INFO="D-LINK DWL-G510 revB1"
            ESSID="your_ap_essid"
            KEY="0100030203"
            ;;

      The first line is your card's MAC address followed by a ')', and the last line must only consist of two semicolons - all by themselves (copy and paste one of the available examples if you're unsure).
      Your MAC address, ESSID, KEY and info comment are obviously going to be different from the values in the above example.

  • rc.inet1.conf
    We covered this file earlier on in the wired section of this article. For wireless cards, it is a matter of extending the parameter definitions of your card with the ones that relate to wireless. The rc.inet1.conf file that is installed by the network-scripts package has a lot of examples at it's end.
    Let's go through a typical configuration of a wireless interface called ath0.
    • The first thing to do is define the interface name because it is different from the default ethN. The variable IFNAME is used to define the interface name. You will need to add or modify a few lines in /etc/rc.d/rc.inet1.conf in order to get a configuration like this:
      # Config information for ath0 (using dhcp):
      IFNAME[1]="ath0"
      IPADDR[1]=""
      NETMASK[1]=""
      USE_DHCP[1]="yes"
      DHCP_HOSTNAME[1]="mywirelessbox"

      Or like this:

      # Config information for ath0 (using static IP address):
      IFNAME[1]="ath0"
      IPADDR[1]="192.168.3.11"
      NETMASK[1]="255.255.255.0"
      USE_DHCP[1]=""
      DHCP_HOSTNAME[1]=""
      GATEWAY="192.168.3.1"

      These are example values of course and you will have to substitute your own.

    • NOTE
      In the above example, where I used the index 1, like in: VARIABLENAME[1], you may use whatever index is not used for any other card that you may have installed. If you do not have an eth0 interface for instance, you might as well want to use the unused 0 array index. The last configuration example would then look like this:
      # Config information for ath0 (using static IP address):
      IFNAME[0]="ath0"
      IPADDR[0]="192.168.3.11"
      NETMASK[0]="255.255.255.0"
      USE_DHCP[0]=""
      DHCP_HOSTNAME[0]=""
      GATEWAY="192.168.3.1"

      Obviously, any array index value ([0],[1],[2], ) in /etc/rc.d/rc.inet1.conf should be used for exactly one card's configuration. If you copy a set of lines, be sure to change the array index to an unused value. If you forget this, and create a double entry, then Slackware will happily forget about the first, and will use only the last value for any parameter found in the file.

Wireless configuration parameters

Let us have a better look at adding more wireless configuration parameters, like a WEP key, the ESSID, and such:

IFNAME[1]="ath0"
   ...
WLAN_MODE[1]=Managed
WLAN_ESSID[1]="my access point"
WLAN_KEY[1]="D5AD1F04ACF048EC2D0B1C80C7"
  • Note that I deliberately used an ESSID (the access point's Station Set Identifier) which has spaces. This requires that you use quotes around the name: “my access point”. When your access point has a name without spaces, you do not need these quotes - in fact it is better to leave those out: WLAN_ESSID[1]=Darkstar.
  • You may have defined your WEP key as a string of ascii characters (i.e. a readable passphrase like “Hogwarts”) instead of a string of hexadecimal characters (like “6CC07C36169B8E7524886F9A19”). If you want to use this readable string instead of remembering HEX characters, you can use the following key format in rc.inet1.conf
    WLAN_KEY[1]="s:Hogwarts"

    This is for a 128-bit (aka 104-bit) WEP key. The even weaker 64-bit (aka 40-bit) WEP keys are still being used - in this case you would need to provide one of 4 keys (or all four with one of them defined as active), this key would have to be the one that the access point considers active as well. Suppose we want to set key [2] to the ascii value “Hogwarts” and then make this the active key, this will take two iwconfig commands: “iwconfig key [2] s:Hogwarts” and “iwconfig key [2]”. These commands can be combined into one: “iwconfig key [2] s:Hogwarts key [2]” and the corresponding entry in rc.inet1.conf would become (the first “key” word removed):

    WLAN_KEY[1]="[2] s:Hogwarts key [2]"

WEP key generators can be found all over the internet. A nice one is PowerDog's cgi script.

A comprehensive list of supported wireless parameters follows (taken from rc.inet1.conf):

IFNAME[4]="wlan0"              # Use a different interface name instead of
                               # the default 'eth4'
WLAN_ESSID[4]=DARKSTAR         # Your access point's name
WLAN_MODE[4]=Managed           # "Managed" mode for use with Access Points.
                               # "Ad-Hoc" is for peer-to-peer connections.
WLAN_RATE[4]="54M auto"        # The transmission rates you want the driver to try
                               # ("auto" means that bandwidth can be variable)
WLAN_CHANNEL[4]="auto"         # The channel to which the Access Point is tuned
                               # ("auto" to let the driver find out the correct channel) 
WLAN_KEY[4]="D5A31F54ACF0487C2D0B1C10D2"
                               # Definition of a WEP key
WLAN_IWPRIV[4]="set AuthMode=WPAPSK | set EncrypType=TKIP | set WPAPSK=thekey"
                               # Some drivers require a private ioctl to be
                               # set through the iwpriv command. If more than
                               # one is required, you can place them in the
                               # IWPRIV parameter (separated with the pipe (|)
                               # character, see the example).
WLAN_WPA[4]="wpa_supplicant"   # Run wpa_supplicant for WPA support
WLAN_WPADRIVER[4]="ndiswrapper"# Tell wpa_supplicant to specifically use the
                               # ndiswrapper driver. If you leave this empty
                               # the 'wext' driver is used by default; most
                               # modern wireless drivers use 'wext'
WLAN_WPAWAIT[4]=30             # In case it takes long for the WPA association
                               # to finish, you can increase the wait time before
                               # rc.wireless decides that association failed
                               # (defaults to 10 seconds)
Read the iwconfig man page if you want to know more about the possibilities for the various WLAN_ parameters that are available. These parameter values translate directly into iwconfig commands

WPA encryption

WPA stands for Wi-Fi Protected Access. It is an encryption standard which was devised after it became clear that the older WEP (Wired Equivalent Privacy) encryption algorhitm was seriously flawed - WEP can be cracked in a matter of seconds. Note that WPA is not 100% safe either, but much harder to crack than WEP. Just make sure that you use a non-trivial WPA passphrase to create your WPA key. The WPA cracking methods that rely on dictionary attacks will eventually break through your encryption if you use common words to make up your passphrase.

OK… configuring WPA encryption seems to be quite problematic for many people. But it is not hard at all if you know where to configure! I am assuming that you already have your wireless card up and running without any encryption, or possibly with WEP encryption - the way to do that was shown in the previous section.
Do not try to add WPA support if you do not yet have a functional wireless network connection!

  • To enable WPA support for your card, ensure that you installed the wpa_supplicant package (it is part of a full Slackware install) and then open the file /etc/wpa_supplicant.conf in an editor - as root, because this file is protected from normal users. It should look something like this:
      ctrl_interface=/var/run/wpa_supplicant
      ctrl_interface_group=0
      eapol_version=1
      ap_scan=1
      fast_reauth=1
      
      network={
            scan_ssid=0
            ssid="your_essid"
            proto=WPA
            key_mgmt=WPA-PSK
            pairwise=CCMP TKIP
            group=CCMP TKIP WEP104 WEP40
            psk=your_64_hex_characters_long_key
      }

    but you'll need to supply your own values for the ssid and the psk. The ssid is the same as the ESSID you use in rc.inet1.conf. The psk is the Pre Shared Key.

  • There is a way to generate the hexadecimal value for the PSK if you have an access point which uses a passphrase. As root, run:
    wpa_passphrase YOURSSID passphrase

    with the SSID of your AP and the passphrase youve entered in its WPA-PSK configuration. You'll receive an output, which looks like this:

    network={
        ssid="YOURSSID"
        #psk="passphrase"
        psk=04dffae0172e3a255e5bab6f28ab78cc23d845f3dd8d4a63ba64a37555e2a33b
    }

    Next, you should copy the three lines that you find inside the network={} section of the command's output and paste them inside the network={} section of the file /etc/wpa_supplicant.conf. Do not forget to check the permissions of the configuration file! The key that it contains should be protected from prying eyes.

    chmod 600 /etc/wpa_supplicant.conf
  • You will also need to apply the following patch to /etc/hotplug/net.agent if you're not yet running Slackware 10.2 or newer. The patch makes the network initialization cleaner if you have more than one network interface, and wpa_supplicant needs that.
    --- net.agent.org       2005-04-17 00:48:48.000000000 +0200
    +++ net.agent   2005-04-17 00:41:56.000000000 +0200
    @@ -67,7 +67,7 @@
                     # Interface already up?  If so, skip.
                     if ! /sbin/ifconfig | grep "^${INTERFACE} " 1> /dev/null ; then
                         debug_mesg run rc.inet1
    -                    exec /etc/rc.d/rc.inet1
    +                    exec /etc/rc.d/rc.inet1 ${INTERFACE}_start
                     fi
                # RedHat and similar
  • Finally, you'll need to upgrade your wireless-tools to at least wireless-tools-27 (if you run anything older than Slackware 10.2). There is a package for wireless-tools here in case you need a more advanced version.
  • Now, if your network configuration in rc.inet1.conf looked like this at first:
      # Config information for ath0 (using dhcp):
      IFNAME[1]="ath0"
      IPADDR[1]=""
      NETMASK[1]=""
      USE_DHCP[1]="yes"
      DHCP_HOSTNAME[1]="mywirelessbox"

    then you'd have to add two lines so that it will read:

      # Config information for ath0 (using dhcp):
      IFNAME[1]="ath0"
      IPADDR[1]=""
      NETMASK[1]=""
      USE_DHCP[1]="yes"
      DHCP_HOSTNAME[1]="mywirelessbox"
      WLAN_WPA[1]="wpa_supplicant"
      WLAN_WPADRIVER[1]="wext"

    Adapt this to your own configuration of course. With kernels older than 2.6.14, the last line should become

      WLAN_WPADRIVER[1]="madwifi"

    and you'll need the version of wpa_supplicant that has support for the madwifi driver (see above).

  • You can restart your wireless network card (ath0) now, by running
    /etc/rc.d/rc.inet1 ath0_restart

    If your WPA connection does not activate, try some debugging:

WPA debugging

  • [If you run a kernel older than 2.6.14 :] Was wpa_supplicant compiled with support for madwifi?
    Run the command wpa_supplicant on the commandline, and verify that the output mentions madwifi = MADWIFI 802.11 support (Atheros, etc.) under drivers:. If not, you will have to find another package which has the support for madwifi compiled in, or build a wpa_supplicant package yourself, and make sure that the build script finds the madwifi source code on your box.
  • Debug the WPA authentication process.
    Make sure the network interface is down (run
    /etc/rc.d/rc.inet1 ath0_stop

    to make sure). Start the wpa_supplicant daemon as a foreground process with additional debugging enabled:

    wpa_supplicant -dw -c/etc/wpa_supplicant.conf -Dwext -iath0

    Then activate the network interface in another terminal (run

    /etc/rc.d/rc.inet1 ath0_start)

    Look at the output of wpa_supplicant in the first terminal, it might give you pointers to look for a solution.

  • Get a run-time status overview of the supplicant:
    As root, run
    wpa_cli status

    to see the current status of wpa_supplicant's authentication process.

  • Debug Slackwares network intitialization.
    Change
    DEBUG_ETH_UP="no"

    to

    DEBUG_ETH_UP="yes"

    in /etc/rc.d/rc.inet1.conf and look for logger messages that are written to /var/log/messages. Maybe those messages will help you trace your problem.
    NOTE: with debugging enabled, Slackware will write your WEP/WPA keys to the message log as well, in clear text!

  • The WPA association might take a long time.
    Start the interface again after a little time, this may help if it takes wpa_supplicant a long time to associate (no restart, just a start):
    /etc/rc.d/rc.inet1 ath0_start

    If this makes your wirelesss work, but the problem occurs often, you can change the 'wait' time for the WPA authentication process by editing the file /etc/rc.d/rc.inet1.conf and adding the line

    WLAN_WPAWAIT[?]=30

    or any other larger value that helps your particular setup.
    NOTE: in the last line make sure that you replace the questionmark in [?] with the array value that matches your wireless card configuration In the above example this array index would be [1].

  • The Access Point is not broadcasting the SSID.
    I have tried and failed in getting WPA to work when the Access Point has a hidden SSID. Check if your AP is broadcasting the SSID and if not, enable it. There is little point in hiding the SSID anyway, with WPA as a protection layer you should not fear break-ins (as long as you do not use easy-to-guess passphrases!!! WPA can be cracked with dictionary attacks and no I will not supply a link here).
 Configuring your network in Slackware ()
SlackDocs