Ifplugd

From CBLFS
Jump to: navigation, search
Download Source: http://0pointer.de/lennart/projects/ifplugd/ifplugd-0.28.tar.gz

Contents

Introduction to Ifplugd

ifplugd is a Linux daemon which will automatically configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network adapters, since it will only configure the interface when a cable is really connected.

With the clfs-bootscripts, you will get an ethernet connection if the cable is connected when you boot, but otherwise will not - even if you connect the cable later. With ifplugd, you will have a connection whenever the cable is connected - regardless of whether it was connected on boot or how many times you unplug and plug it back in after booting. ifplugd also works with wireless devices.

Project Homepage: http://0pointer.de/lennart/projects/ifplugd/

Dependencies

Required

Optional

  • xmltoman (for rebuilding the man pages)
  • Subversion (for rebuilding svn-release.h)
  • Lynx (for regenerating the README)

Additional Configuration Options

If you don't have Lynx installed, pass the following flag to configure:

--disable-lynx

If you don't have xmltoman installed, pass the following flag to configure:

--disable-xmltoman

If you don't have Subversion installed, pass the following flag to configure:

--disable-subversion

Nothing bad happens if you don't have one of the optional packages and you forget to pass the disabling flag, but configure will complain with a warning.

Non-Multilib

Compile the package:

./configure --prefix=/usr --sysconfdir=/etc \
    --sbindir=/sbin
make

Install the package:

make install

Command Explanations

--sysconfdir=/etc: We use this flag because the default is /usr/etc which you probably don't want to happen.

--sbindir=/sbin: We use this flag because the default is /usr/sbin and you may want ifplugd to be available even when /usr is on another partition.

rm -v ....: The ifplugd script effectively replaces clfs-bootscripts' network script, so we need to remove the network script (or at least its links in /etc/rc.d/rcX.d) so that they won't try to run.

ln -sv ....: We need to have links in the /etc/rc.d/rcX.d directories in order for ifplugd to run.

sed -i ....: ifplugd.action points to /sbin for the ifdown and ifup scripts, but on clfs systems, they reside in /etc/sysconfig/network-devices, so we need to redirect it.

Multilib

This package does not provide any libraries so only one installation is needed.

32Bit

Compile the package:

PKG_CONFIG_PATH="${PKG_CONFIG_PATH32}" CC="gcc ${BUILD32}" \
./configure --prefix=/usr --sysconfdir=/etc \
    --sbindir=/sbin &&
make

Install the package:

make install

N32

Compile the package:

PKG_CONFIG_PATH="${PKG_CONFIG_PATHN32}" CC="gcc ${BUILDN32}" \
./configure --prefix=/usr --sysconfdir=/etc \
    --sbindir=/sbin &&
make

Install the package:

make install

64Bit

Compile the package:

PKG_CONFIG_PATH="${PKG_CONFIG_PATH64}" CC="gcc ${BUILS64}" \
./configure --prefix=/usr --sysconfdir=/etc \
    --sbindir=/sbin &&
make

Install the package:

make install

Configuring ifplugd

Configuration File

/etc/ifplugd/ifplugd.conf

Bootscript

In ifplugd.conf, set INTERFACES to the network interfaces that you have on your computer (e.g. eth0).

Also, if you want to pass ifplugd parameters other than the defaults, you need to set ARGS (also within ifplugd.conf) to the parameters that you actually want. However, the defaults are probably sufficient.

Remove unnecessary links from the bootscripts:

rm -v /etc/rc.d/*/K80network
rm -v /etc/rc.d/*/S20network

If you want, you can remove the network bootscript, but if you decide you want it, you'll have to reinstall it from the clfs-bootscripts package.

rm -v /etc/rc.d/init.d/network

Create the links necessary to have ifplugd actually run:

ln -sv ../init.d/ifplugd /etc/rc.d/rc1.d/K75ifplugd
ln -sv ../init.d/ifplugd /etc/rc.d/rc2.d/S25ifplugd
ln -sv ../init.d/ifplugd /etc/rc.d/rc3.d/S25ifplugd
ln -sv ../init.d/ifplugd /etc/rc.d/rc4.d/S25ifplugd
ln -sv ../init.d/ifplugd /etc/rc.d/rc5.d/S25ifplugd
ln -sv ../init.d/ifplugd /etc/rc.d/rc6.d/K75ifplugd

Alter /etc/ifplugd/ifplugd.action so that it points to the correct location for the ifdown and ifup scripts:

sed -i 's@/sbin/@/etc/sysconfig/network-devices/@g' /etc/ifplugd/ifplugd.action

Contents

Installed Programs: ifplugd, ifplugstatus
Installed Libraries: None
Installed Scripts: ifplugd
Installed Directory: /etc/ifplugd

Short Descriptions

ifplugd is a daemon which will automatically configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled.
ifplugstatus is an utility which may be used to detect the link status of a local Linux ethernet device.
Personal tools