Enabling IPv6 in MacOS X (10.1.3)

Jun-ichiro itojun Hagino, KAME Project
$Id: index.html,v 1.12 2005/01/18 05:21:57 itojun Exp $
NOTE: this note applies to MacOS 10.1.3. more recent MacOS (like 10.3) does not need this (for instance, with 10.3, kernel is IPv6 ready by default and GUI supports IPv6)


The document describes how you can enable IPv6 in MacOS X (10.1.3), using Darwin public source code.

Update: there was a structural change in Darwin repository, for userland source code - Commands/Next/network_cmds is now found in network_cmds (at the top of CVS tree). The following text is updated for the change, however, patch is not updated yet. (2002/4/26)

MacOS X 10.1.3 kernel (= Darwin xnu Apple-201-15 or Apple-201-19 tag) contains IPv4/v6 stack (sys/netinet and sys/netinet6) which is equivalent to FreeBSD 3.x with KAME patch as of spring 2000. The article describes how to enable IPv6/IPsec portion of the code.

Building kernel

Building library

Apple /usr/lib/libc.dylib lacks many of critical library functions, and some of them behave very strange. Install libbind.a from BIND8. The easiest way is to use NetBSD pkgsrc. Get the latest NetBSD pkgsrc by anoncvs:
% cvs -z3 -d :pserver:anoncvs@anoncvs.netbsd.org:/cvsroot login
% cvs -z3 -d :pserver:anoncvs@anoncvs.netbsd.org:/cvsroot co -P pkgsrc
Then, get darwin-bootstrap.tar.gz and build it.
% tar zxvf darwin-bootstrap.tar.gz
% cd bootstrap-pkgsrc
% sudo ./bootstrap --pkgsrcdir=pkgsrc
Go to pkgsrc/net/bind8 and build it.
% cd pkgsrc/net/bind8
% bmake
% sudo bmake install

Building libinet6 for missing library functions

Build /usr/local/v6/lib/libinet6.a which supplies missing library functions, such as if_nametoindex and getifaddrs.
% cvs -d :pserver:anoncvs@anoncvs.kame.net:/cvsroot/kame login
% cvs -d :pserver:anoncvs@anoncvs.kame.net:/cvsroot/kame co -P kame/Makefile kame/Makefile.inc
% cd kame
% bsdmake TARGET=darwin tree prepare
% (cd darwin/include; bsdmake; sudo bsdmake install)
% (cd darwin/lib/libinet6; bsdmake; sudo bsdmake install)

Building IPv6-ready SSH

Unshar this file under pkgsrc/security and build it.
% cd pkgsrc/security/openssh
% bmake PKG_SYSCONFDIR=/etc
% sudo bmake PKG_SYSCONFDIR=/etc install
If you would like to start IPv6-ready sshd at startup, modify /System/Library/StartupItems/SSH/SSH.

building ifconfig

Make sure you have installed BIND8 already from pkgsrc.

Checkout network_cmds tree from darwin repository.

% cvs -d :pserver:yourid@anoncvs.opensource.apple.com:/cvs/Darwin checkout network_cmds
Apply the patch (it may not apply cleanly - sorry).
% patch -p0 < commands-next-20020323.diff
build and install ifconfig.
% cd network_cmds/ifconfig.tproj
% make
% sudo make install

building netstat and route

Make sure you have installed libinet6 (missing libraries) from kame tree, and BIND8 from pkgsrc.

% cd network_cmds/netstat.tproj
% make
% sudo make install
% cd
% cd network_cmds/route.tproj
% make
% sudo make install


% sudo sysctl -w net.inet6.ip6.accept_rtadv=1

KAME top page
Copyright (c) 1998, 1999, 2000, 2001, 2002, and 2003 by the author (indicated separately). All rights reserved. Freely redistributable. Absolutely no warranty.