Friday, August 13, 2010

IPv6 PPPoE on MacOSX

Teksavvy, a canadian provider, is offering IPv6 service through DSL PPPoE. As an IPv6 oldtimer, I subscribe to their service to give it a try. They gave me an IPv4-only PPPoE service userid/password and an IPv4 and IPv6 PPPoE service userid/password. This blog describes how to have MacOSX (10.6.4) running as the PPPoE end host.
Here are the steps:
  1. Create a new network configuration: Preferences->Network->Configuration->Modify Configurations-> + -> PPPoE
  2. Select the new network configuration.
  3. IPv4 Configuration->Create a new PPPoE Service. Enter the PPPoE username and password given by the service provider.
  4. Enable IPv6: Advanced->Configure IPv6->Automatic
  5. Connect: Apply the configs, select the PPPoE interface and then Connect.
IPv4 should be running. IPv6 not quite. In Terminal window, type ifconfig ppp0. You should see something like (IP addresses changed):
# ifconfig ppp0
ppp0: flags=8051 mtu 1492
inet --> netmask 0xffffff00
inet6 fe80::5123:35ff:fef4:1234%ppp0 prefixlen 64 scopeid 0xa

IPv6 link-local addresses were negotiated during the PPP multilink session. See the PPP logs:
# grep IPV6CP /var/log/ppp.log
... : rcvd [IPV6CP ConfReq id=0x46 ]
... : sent [IPV6CP ConfAck id=0x46 ]
(Note: you can also view the logs within the Console application.)

However, the IPv6 global addresses are now shown anywhere, either in the Network Settings Panel, nor with ifconfig ppp0. The IPv6 PPP specification(RFC5072) says that the global address is obtained by router advertisements on the PPP link or by DHCPv6.
Inspection of MacOSX shows that router advertisements were not enabled (surprisingly, becauseI'm using IPv6 RA at the office without having to do any change in the kernel config) in the kernel, so I enable them.
# sudo sysctl -w net.inet6.ip6.accept_rtadv=1
net.inet6.ip6.accept_rtadv: 0 -> 1

And restart the PPP session.
Now I see my global IPv6 address on the PPP interface:
#ifconfig ppp0
ppp0: flags=8051 mtu 1492
inet --> netmask 0xffffff00
inet6 fe80::5123:35ff:fef4:1234%ppp0 prefixlen 64 scopeid 0xa
inet6 2001:db8:1234:167:55123:35ff:fef4:1234 prefixlen 64 autoconf

However, the default IPv6 route is not created. So I did manually pointing to the PPP interface.
# route add -inet6 default -iface ppp0

Now it works!

# ping6
PING6(56=40+8+8 bytes) 2001:db8:1234:167:55123:35ff:fef4:1234 --> 2620:0:230:8000::2
16 bytes from 2620:0:230:8000::2, icmp_seq=0 hlim=50 time=55.993 ms
16 bytes from 2620:0:230:8000::2, icmp_seq=1 hlim=50 time=56.896 ms
16 bytes from 2620:0:230:8000::2, icmp_seq=2 hlim=50 time=56.585 ms
--- ping6 statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 55.993/56.491/56.896/0.375 ms

To automate these steps, I'm using pppd scriptability. From pppd man page, one can create the following files which are executed upon certain actions.

# sudo echo '/sbin/route add -inet6 default -iface ppp0' > /etc/ppp/ipv6-up
# sudo echo '/sbin/route delete -inet6 default -iface ppp0' > /etc/ppp/ipv6-down
# sudo chmod +x /etc/ppp/ipv6*

Restarting PPP will execute these scripts when IPv6 will be up and down. One can confirm the execution of the scripts by looking at the logs:
# grep Script /var/log/ppp.log
... : Script /etc/ppp/ipv6-up started (pid 78398)
... : Script /etc/ppp/ipv6-up finished (pid 78398), status = 0x0

I'm still looking for a way to integrate the sysctl command in the right script file.


Stan said...

In the paragraph that starts with "However" I am guessing you meant to say "not shown" not "now shown" In that first sentence.

Anurag said...

Really a helpful information blog article. If computer's hard disk full of data then only one solution to increase the speed of our system that is install RAM. By this we extend the speed of computer system. Thanks for sharing.
PC optimization
Setup, Configure and Troubleshoot Wireless Network (Wi-Fi)
operating system support

markjacktechnicalsupport said...

I'm hoping that they completely remove storage limits. Do it for April Fools Day. Then buy Dropbox and do the same thing.
operating system support
Setup, Configure and Troubleshoot Wireless Network (Wi-Fi)
computer repair

Sergiu Norocea said...

HI ! Put net.inet6.ip6.accept_rtadv=1 in etc/sysctl.conf and you should be set even after reboot.