After far to many hours trying to take back control of how a computer I run 
interfaces with the world.

Here's how to do it (at least the best fix I've managed to come up with so far.

The trick to controlling IPv6 addresses assigned to network cards.
(For the awkward gits amongst you (like me) who want to be in contol of the 
network interfaces your system runs)

1). Do not configure the eth card in rc.inet1.
2). In rc.local inject "1" into /proc/sys/net/ipv6/conf/eth?/disable_ipv6
3). Then bring the eth card UP (ifconfig eth? UP)
4). Now in another script inject "0" into 
/proc/sys/net/ipv6/conf/eth?/disable_ipv6
5). The kernel will automatically assign an IPv6 fe80:: LLA address to the 
interface.
6). Capture the automatically assigned address to a file somewhere incase you 
want to use it at some point.
7). Delete the address from the interface.
8). Use rc.local to assign any IPv4 addresses you want assigned.


rc.local example lines:
# Disable IPv6 autoconf on eth0
echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6
# Bring up the eth0 interface
if [ `/sbin/ifconfig eth0 | grep UP | wc -l` -eq 0 ]; then
  /sbin/ifconfig eth0 up
fi
# Start IPv6 interfaces
if [ -x /etc/rc.d/rc.ipv6 ]; then
  /etc/rc.d/rc.ipv6
fi

rc.ipv6 example lines:
# Enable IPv6 autoconf on eth0
echo 0 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6
# Store auto assigned IPv6 address and remove it from the interface
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for line in `ifconfig eth0 | grep inet6` ; do
  ADDR=`echo ${line// /_} | cut -f10 -d_`
  PRFX=`echo ${line// /_} | cut -f13 -d_`
  if [ `grep $ADDR /etc/rc.d/ipv6.addresses | wc -l` -eq 0 ]; then
    echo "$ADDR/$PRFX" >> /etc/rc.d/ipv6.addresses
  fi
  /sbin/ifconfig eth0 inet6 del $ADDR/$PRFX
done
IFS=$SAVEIFS
unset SAVEIFS

9). You now finally have control over whether individual NICs run IPv6 or not, 
and if they do, what addresses you assign to them.

Thanks
Dave
_______________________________________________
ARMedslack mailing list
ARMedslack@lists.armedslack.org
http://lists.armedslack.org/mailman/listinfo/armedslack

Reply via email to