Hi there,
What are the variables SLA_INTF and INTF_ID supposed to be in your script above?
Without them it calculates my ipv6 address as: 2002:5e4b:cf23:0000::0000 (from 94.75.207.35) which doesn't look right to me.
Thanks
The entire 2002::/16 IPv6 block is reserved for 6to4. The address above isn't a full address, it's a 6to4 prefix (more succinctly represented as 2002:5e4b:cf23::/48). Basically, a 6to4 prefix is 2002:[half of your IPv4 in hex]:[2nd half]::/48. The 5e 4b cf 23 is 94.75.207.35 in hex. So the address is correct.
You then take your prefix and use it as /64s on your interface and LAN(s), giving you 16 bits of network field to work with (yes, 65,536 subnets possible). For instance, you could set your 6to4 router's 6to4 interface address to 2002:5e4b:cf23::1/64 (which is shorthand for 2002:5e4b:cf23:0000:0000:0000:0000:0001/64 ... double colon represents a run of zeros). Then you could set your inside LAN prefix to say 2002:5e4b:cf23:1::/64 (2002:5e4b:cf23:0001:0000:0000:0000:0000/64), so the inside LAN IPv6 on your 6to4 router might be 2002:5e4b:cf23:1::1/64 (as in IPv4 I tend to use host number 1 as my router IP). You have the entire 4th quad to use for LANs/subnets (2002:5e4b:cf23:0:: - 2002:5e4b:cf23:ffff::), so you could use any of 'em.
Your 6to4 router will encapsulate your IPv6 traffic in a a 6in4 tunnel packet (IPv4 protocol 41), and send it to the 6to4 tunnel server. If you use the anycast address for 6to4 servers (192.88.99.1) for the tunnel destination, it's supposed to send it to the closest 6to4 server, but unfortunately it's at the mercy of your ISP & BGP where it goes, so sometimes it's best to find the closest one to you and use that instead of the anycast.
Return traffic gets sent back to the IPv4 address encoded in the 2nd and 3rd quads of the IPv6 address. Obviously, if your ISP changes your IPv4 frequently, this could be annoying, since your IPv6 prefix will change with it. One of the reasons I stick with statically configured 6in4 tunnels for my IPv6 connectivity. :)
Also, word to the wise, if you get IPv6 going one way or another, make sure you have ip6tables running and configured on your router, otherwise all your machines will be wide open on the IPv6 internet with no firewall!