tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How do I keep an inet6 address from being added to an interface?



On Wed, May 05, 2010 at 07:53:44PM -0700, Dennis Ferguson wrote:
> 
> I tried this, but ifconfig inet6 delete is disallowed for ipv6 (this
> is documented on the manual page), while ifconfig -alias seems to produce
> an error when trying to take off the last remaining address.  There seems
> to be no way to get it off once it is on there that I can find.

I use this, which seems to work on NetBSD 5.

#!/bin/sh

# Copyright 2009 Coyote Point Systems, Inc.  All rights reserved.

# Usage: stripv6 <if> removes the autoconfigured IPv6 address, if any,
#                     from network interface <if>, allowing it to be
#                     attached to an upper-layer interface such as an agr.
#
# Exit status:        0 if an address is removed, 1 elsewise.

autov6=$(ifconfig $1 \
         | awk '/inet6 fe80/ { split($2, a, "%"); printf("%s", a[1]) }')

if [ -n "$autov6" ]; then
    ifconfig $1 inet6 $autov6 -alias
    exit 0
fi

exit 1



Home | Main Index | Thread Index | Old Index