conf/89061: IPv6 6to4 auto-configuration enhancement

Antonio Querubin tony at lava.net
Tue Nov 15 02:40:18 PST 2005


>Number:         89061
>Category:       conf
>Synopsis:       IPv6 6to4 auto-configuration enhancement
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 15 10:40:15 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Antonio Querubin <tony at lava.net>
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
none
>Environment:
System: FreeBSD pavilion 5.4-STABLE FreeBSD 5.4-STABLE #1: Tue Aug 16 00:43:55 HST 2005 root at pavilion:/usr/obj/usr/src/sys/GENERIC i386


>Description:

	When IPv6 is enabled in /etc/rc.conf but there is no native IPv6 
	routing, 6to4 can be enabled with some reasonable defaults to 
	provide IPv6 connectivity via the nearest 6to4 anycast router (RFC 
	3068).  This patch enhances the IPv6 startup script to 
	automatically setup the stf interface address and the IPv6 default 
	gateway properly if 'auto6to4_enable=YES' is added to /etc/rc.conf 
	to enable this feature.  This provides a simple, working IPv6 
	configuration for a large majority of workstations still on 
	IPv4-only networks.  This is similar to the default 6to4 
	behaviour in Linux and MS Windows XP.

>How-To-Repeat:

	With IPv6 enabled ('ipv6_enable=YES' added to /etc/rc.conf) in a 
	non-IPv6 network, attempt to ping a IPv6 host.

	example:  ping6 www.isc.org

	The ping6 attempt should fail as there is no IPv6 route to the 
	host.

	Install the patch below and add 'auto6to4_enable=YES' to 
	/etc/rc.conf and reboot.  ping6 and traceroute6 should now work 
	to a number of IPv6 hosts.

>Fix:

--- /usr/src/etc/rc.d/network_ipv6	Sun Oct 17 11:00:07 2004
+++ /etc/rc.d/network_ipv6	Sat Nov 12 09:16:54 2005
@@ -100,6 +100,25 @@
 	fi
 
 	# Setup IPv6 to IPv4 mapping
+	if checkyesno auto6to4_enable; then
+		# Determine the interface of the IPv4 default route.
+		ipv4_default_if=`route get default \
+			| awk '/interface:/ {print $NF}'`
+		# Define the 6to4 tunnel's IPv4 address to match the first 
+		# IPv4 address of the IPv4 default interface.
+		stf_interface_ipv4addr=`ifconfig ${ipv4_default_if} inet \
+			| awk '/inet/ {print $2}' \
+			| head -1`
+		# If no IPv6 default gateway is defined, use the RFC 3068 
+		# anycast address.
+		case ${ipv6_defaultrouter} in
+		[Nn][Oo] | '')
+			ipv6_defaultrouter="2002:c058:6301::"
+			;;
+		*)
+			;;
+		esac
+	fi
 	network6_stf_setup
 
 	# Install the "default interface" to kernel, which will be used


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list