User Tools

Site Tools


doc:appunti:linux:sa:pcmcia_network

WARNING: intormation in this page is not verified!

PCMCIA networking

On a Debian GNU/Linux Etch system the PCMCIA network is bringed up after the boot process, later than Ethernet interfaces. However the configuration of interface and network services (NFS mounts, etc.) are controlled by the /etc/network/interfaces file.

It is no longer needed to configure PCMCIA networking within /etc/pcmcia/network.opts, everything is controlled by /etc/network/interfaces. To activate this new approach, we have into /etc/default/pcmcia:

REFRAIN_FROM_IFUP=yes

You must make sure that the PCMCIA network interface is not listed in any auto line in /etc/network/interfaces. To get advantage of the PCMCIA scheme mechanism (used to change network configuration on the fly using cardctl scheme command) you can set up a /etc/network/interfaces like this:

#---------------------------------------------------------------------
# The hotplug subsystem does an "ifup eth0=hotplug" when a PCMCIA
# network card is detected. This mapping script will return the
# name "eth0-<pcmcia_scheme>" so that the proper
# "ifup eth0-<pcmcia_scheme>" will be executed.
#---------------------------------------------------------------------
allow-hotplug eth0
mapping hotplug
        script /usr/local/sbin/map-scheme

iface eth0-dhcp inet dhcp

iface eth0-home inet static
        address 192.168.2.5
        netmask 255.255.255.0
        gateway 192.168.2.2

When the hotplug subsystem detects a PCMCIA network card, it executes an ifup eth0=hotplug, the mapping stanza above will convert it into an ifup eth0-pcmcia_scheme. So the configuration from iface eth0-pcmcia_scheme inet … stanza will be used.

The script /usr/local/sbin/map-scheme is the following:

#! /bin/sh
# Recevies the name of a network interface as the 1st parameter.
# It returns on stdout the string <ifname>-<pcmcia_scheme>.
# It is used to map the real interface name to the appropriate
# configuration stanza into /etc/network/interfaces.
iface="$1"
if [ "$iface" = "" ]; then iface="eth0"; fi
scheme="$(cat /var/lib/misc/pcmcia-scheme 2> /dev/null)"
if [ -n "$scheme" ]; then
    echo $iface-$scheme
else
    echo $iface
fi
exit 0
doc/appunti/linux/sa/pcmcia_network.txt · Last modified: 2005/12/30 22:07 by 127.0.0.1