Here's the script that adds a link-local address to an arbitrary interface.
You'll need the ``ahcp-compute-address'' utility, which you'll find in the
ahcpd distribution.

                                        Juliusz
#!/bin/sh

die() { echo "$0: $@" >&2;  exit 1; }
warn() { echo "$0: warning: $@" >&2; }

if [ "$#" -ne 1 ] ; then
    die "Usage: $0 interface"
fi

if (ip addr show dev $1 | grep -q '^ *inet6  *fe80:') ; then
    die "interface $1 already has a link-local address"
fi

mac="$(ip addr show dev $1 | grep '^ *link/ether ' | sed -e 's|^ *link/ether \([0-9a-z:]*\) .*$|\1|' -e q)"
if [ -z "$mac" ] ; then
    warn "couldn't find MAC address"
fi
addr=$(ahcp-generate-address fe80:: $mac)

ip -6 addr add "$addr"/64 dev $1
_______________________________________________
Babel-users mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/babel-users

Reply via email to