Subject: Re: auto-config of stf0
To: Michael Richardson <mcr@sandelman.ottawa.on.ca>
From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
List: tech-net
Date: 12/16/2000 16:11:09
>  I'm looking for suggestions on the best mechanism to do the following.
>
>  I want to run "rtsold" at boot time, and also leave it as a daemon. 
>If, at any time, I don't have a v6 default route, then I'd like to configure
>stf0 up with my an IP address that is known to be public (e.g. if I see that
>I got 192.168.1.2, then forget it, there is likely a NAT).
>
>  This way, i should always have IPv6 connectivity, it is can be available.

	it would need some shell/perl script, invoked periodically, or
	invoked every time you move to different subnet.  easiest approximation
	would be /etc/apm/resume.

	to check if you have the real IPv6 router, you can use ndp(8).
	- if "ndp -r" generates empty output, you have no router
	  visible via RA.
	- if "ndp -p" has no "reachable" routers, you have no reachable routers.

	the tricky part is, we have two elements which control the IPv6
	default route setting.
	- inbound RA processing logic, which is in the kernel.
		if you have real IPv6 router on your subnet, you need to do
		nothing.
	- configuration for stf(4) tunnel.
		after you detect that there's no real IPv6 router present,
		you need to configure a static (IPv6) default route to
		6to4 relay router, like 6to4.kfu.com.
	they inherently conflict with each other.  you need to be careful
	when you configure an IPv6 default route.

	another tricky issue would be like below:
	- can we assume global IPv4 reachability?  I bet we can't.
	  ("IPsec over NAT" look premature/too wacky to me)
	- if you configure 6to4, you will want to pick the nearest 6to4 relay
	  router.  how can we pick the closest one?  if you don't do long-haul
	  travels, it is non-issue.

itojun