cht now provides IPv6 for their home broadband subscribers with simple online registration. But since the wifi router they provided doesn't support it, I was wondering if I can simply use the PPPoE on Mac OSX(Yosemite) to get IPv6 going over the wifi as bridge.

It turns out pppd is not setting up inet6 stuff properly. You'll have to provide a script to properly configure it.

The tricky bit is forcibly configure the relevant resolver to use IPv6, as scutil --dns somehow shows they only resolve A records but not AAAA records. Without doing this ping6 resolves properly but browsers can't (probably AF_UNSPEC code path goes through the scutil-managed resolvers)

This is my etc/ppp/ipv6-up (remember to chmod 755 etc/ppp/ipv6-up), mostly a combination of references I found here and here)

#!/bin/bash
scutil=/usr/sbin/scutil

get_hash_for_interface () {
    echo 'list' | $scutil |grep 'State:/Network/Service.*IPv4' | awk '{print $4}' | while read key;
    do
      ifname=`echo "show $key" | $scutil | grep 'InterfaceName' | awk '{print $3}'`;
      if [ "x$ifname" == "x$1" ]; then
        hash=`echo $key | cut -d/ -f4`;
        echo $hash
        return 0
      fi
    done
}

set_dns() {
    hash=`get_hash_for_interface $IFNAME`
    printf "d.add ServerAddress * 2001:b000:168::1\nset State:/Network/Service/$hash/DNS\nd.show\n" | $scutil
}

PREFIXINFO=`/usr/sbin/tcpdump -nvi $IFNAME -c 2 icmp6 | grep prefix`
PREFIX=`echo $PREFIXINFO|cut -f2- -d:|cut -f1 -d/|cut -c2-`
PREFIXLEN=`echo $PREFIXINFO|cut -f2 -d/|cut -f1 -d,`
ADDR="cafe"

/sbin/ifconfig $IFNAME inet6 ${PREFIX}${ADDR}/$PREFIXLEN

/sbin/route add -inet6 default -interface $IFNAME
set_dns

Comments

comments powered by Disqus