> I haven't really tested it very well (in particular, the router-specific
> code is completely untested, because, well I don't really have the
> ability at the moment). Comments welcome, or if one of the KAME team
> members with commit privileges wants to fix it up and/or try to get
> this code commited, that's fine too.
>
> Cheers,
>
> Bruce.
Hi, sorry for delay but I tried it and added some fixes
including change of some variable names to look like somewhat
consistent with IPv4 variables.
Please try if this works in your environment.
Other people's trials are also welcome.
And again, thanks for creating the template. :-)
That was very helpful and I might not have tried to make this
because I am lazy.
Yoshinobu
--- rc.orig Tue Feb 15 03:59:38 2000
+++ rc Sun Feb 13 17:27:21 2000
@@ -191,6 +191,15 @@
network_pass1
fi
+case ${ipv6_enable} in
+[Yy][Ee][Ss])
+ if [ -r /etc/rc.net6 ]; then
+ . /etc/rc.net6 # We only need to do this once also.
+ net6_pass1
+ fi
+ ;;
+esac
+
# Mount NFS filesystems.
echo -n "Mounting NFS file systems"
mount -a -t nfs
--- defaults/rc.conf.orig Tue Feb 15 03:59:29 2000
+++ defaults/rc.conf Tue Feb 15 03:58:15 2000
@@ -184,6 +184,29 @@
### Miscellaneous network options: ###
icmp_bmcastecho="NO" # respond to broadcast ping packets
+### IPv6 options: ###
+ipv6_enable="NO" # Set to YES to set up for IPv6.
+ipv6_network_interfaces="auto" # List of network interfaces (or "auto").
+ipv6_gateway_enable="NO" # Set to YES if this host will be a gateway.
+ipv6_router_enable="NO" # Set to YES to enable an IPv6 routing daemon.
+ipv6_router="/usr/sbin/route6d" # Name of IPv6 routing daemon.
+ipv6_router_flags="" # Flags to IPv6 routing daemon.
+#ipv6_router_flags="-l" # example for route6d with IPv6 site local addr
+#ipv6_network_interfaces="ed0 ep0" #examples for router
+#prefix_ed0="fec0:0000:0000:0001 fec0:0000:0000:0002" #examples for router
+#prefix_ep0="fec0:0000:0000:0003 fec0:0000:0000:0004" #examples for router
+rtadvd_enable="NO" # Set to YES to enable an IPv6 Router
+ # Advertisement daemon
+rtadvd_flags=""
+mroute6d_enable="NO" # Do IPv6 multicast routing.
+mroute6d="/usr/sbin/pim6dd" # Name of IPv6 multicast routing daemon.
+mroute6d_flags="" # Flags to IPv6 multicast routing daemon.
+gifs="NO" # List of GIF tunnels (or "NO").
+#gifs="gif0 gif1" #examples typically for a router
+#gifconfig_gif0="10.1.1.1 10.1.2.1" #examples typically for a router
+#gifconfig_gif1="10.1.1.2 10.1.2.2" #examples typically for a router
+defaultiface="" # Default output interface for scoped addrs
+
##############################################################
### System console options #################################
#! /bin/sh
# $FreeBSD$
# Note that almost all of the user-configurable behavior is no longer in
# this file, but rather in /etc/defaults/rc.conf. Please check that file
# first before contemplating any changes here. If you do need to change
# this file for some reason, we would like to know about it.
# IPv6 startup
net6_pass1() {
echo -n 'Doing IPv6 network setup:'
if [ X"${ipv6_gateway_enable}" = X"YES" ]; then
#
# list of interfaces, and prefix for interfaces
# NOTE: no trailing double colon necessary here!
#
case ${ipv6_network_interfaces} in
[Aa][Uu][Tt][Oo])
ipv6_network_interfaces="`ifconfig -l`"
;;
esac
else
#
# manual configurations - in case ip6router=NO
# you can configure only single interface, as specification assumes
that
# autoconfigured host has single interface only.
#
case ${ipv6_network_interfaces} in
[Aa][Uu][Tt][Oo])
ipv6_network_interfaces="`ifconfig -l | sed -e 's/ .*//'`"
;;
esac
fi
# tool locations
prefixconfig=/usr/sbin/prefix
rtsol=/sbin/rtsol
gifconfig=/usr/sbin/gifconfig
route=/sbin/route
rtadvd=/usr/sbin/rtadvd
ndp=/usr/sbin/ndp
# just to make sure
ifconfig lo0 up
#determine the "default interface" used below
#if [ X"$defaultiface" = X"" ]; then
# for i in $ipv6_network_interfaces; do # use 1st interface in the list
# defaultiface=$i
# break
# done
#fi
# disallow unicast packets without outgoing scope identifiers.
# if you instead want to route such packets to a "default" interface,
# comment out the 1st two lines, and enable the lines after them.
if [ X"$defaultiface" != X"" ]; then
$route add -inet6 fe80:: ::1 -prefixlen 10 -interface -ifp $defaultiface
-cloning
$route add -inet6 fec0:: ::1 -prefixlen 10 -interface -ifp $defaultiface
-cloning
else
$route add -inet6 fe80:: -prefixlen 10 ::1 -reject
$route add -inet6 fec0:: -prefixlen 10 ::1 -reject
fi
# disallow "internal" addresses to appear on the wire
$route add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject
$route add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject
if [ X"${ipv6_gateway_enable}" = X"YES" ]; then
# act as a router
sysctl -w net.inet6.ip6.forwarding=1
sysctl -w net.inet6.ip6.accept_rtadv=0
# wait for DAD
for i in $ipv6_network_interfaces; do
ifconfig $i up
done
sleep `sysctl net.inet6.ip6.dad_count | awk '{print $NF}'`
sleep 1
# setting up interfaces
for i in $ipv6_network_interfaces; do
eval prefix=\$prefix_$i
if [ X"$prefix" = X"" ]; then
continue
fi
for j in $prefix; do
if [ -x $prefixconfig ]; then
$prefixconfig $i $j::
else
laddr=`ifconfig $i inet6 | grep 'inet6 fe80:'
| head -1 | \
awk '{print $2}'`
hostid=`echo $laddr | sed -e
's/fe80:[0-9a-fA-F]+::/fe80::/' -e 's/fe80:://' -e 's/@.*//'`
address=$j\:$hostid
eval hostid_$i=$hostid
eval address_$i=$address
ifconfig $i inet6 $address prefixlen 64 alias
fi
# subnet-router anycast address (rfc2373)
ifconfig $i inet6 $j:: prefixlen 64 alias anycast
done
ifconfig $i inet6
done
# again, wait for DAD's completion (for global addrs)
sleep `sysctl net.inet6.ip6.dad_count | awk '{print $NF}'`
sleep 1
# gifconfig
case ${gifs} in
[Nn][Oo] | '')
;;
*)
for i in $gifs; do
eval peers=\$gifconfig_$i
if [ X"$peers" = X"" ]; then
continue
fi
$gifconfig $i $peers
done
;;
esac
# ipv6_router
if [ X"${ipv6_router_enable}" = X"YES" -a -x $ipv6_router ]; then
$ipv6_router $ipv6_router_flags
fi
# rtadvd
# This should enabled with a great care.
# You may want to fine-tune /etc/rtadvd.conf.
if [ X"${rtadvd_enable}" = X"YES" -a -x $rtadvd ]; then
# $rtadvd $rtadvd_flags $ipv6_network_interfaces
$rtadvd -P "in ipsec
ah/transport/fec0:0:0:1000::2a0:c9ff:fe84:ebd9-fec0:0:0:1000::1/require"
$ipv6_network_interfaces
fi
# mroute6d
if [ X"${mroute6d_enable}" = X"YES" -a -x $mroute6d ]; then
$mroute6d $mroute6d_flags
fi
else
# act as endhost - automatically configured
sysctl -w net.inet6.ip6.forwarding=0
sysctl -w net.inet6.ip6.accept_rtadv=1
ifconfig $ipv6_network_interfaces up
$rtsol $ipv6_network_interfaces
# install the "default interface" to kernel, which will be used
# as the default route when there's no router.
# [ -x $ndp ] && $ndp -I $defaultiface
# wait for DAD's completion (for global addrs)
sleep `sysctl net.inet6.ip6.dad_count | awk '{print $NF}'`
sleep 1
fi
echo '.'
# Let future generations know we made it.
#
net6_pass1_done=YES
}