# USAGI Linux/MIP6
#
# $USAGI: MIP6,v 1.3 2003/07/29 06:20:56 takamiya Exp $
#

USAGI's Mobile IPv6 (USAGI MIP6) is based on MIPL.

Table of Contents

	1. Current Status
	2. Building/Installing USAGI MIP6
	2.1. Building Kernel
	2.1.1. Building Kernel for all nodes
	2.1.2. Building Kernel for a MN
	2.1.3. Building Kernel for a HA
	2.2. Installing user-land applications
	2.2.1. Installing the mipdiag command for all nodes
	2.2.2. Installing the radvd for a HA
	2.3. Configuration
	2.3.1. Configuration for a CN
	2.3.2. Configuration for a MN
	2.3.3. Configuration for a HA
	3. Usage
	3.1. Starting a CN
	3.2. Starting a MN
	3.3. Starting a HA
	3.4. Usage after started for all nodes
	3.5. How to use IPsec between MN and HA
	4. References


1. Current Status

USAGI MIP6 is supported Internet-Draft 19(draft-ietf-mobileip-ipv6-19.txt)
(but not complete yet).
	- Using with IPsec has not been supported yet

2. Building/Installing USAGI MIP6

2.1. Building Kernel

When compiling the kernel, you need to select Correspondent Node(CN) at least.
After that, you can select Mobile Node(MN), Home Agent(HA), or none(CN only).
The recommended kernel configuration is as follows:

	Code maturity level options -->
		[o] Prompt for development and/or incomplete code/drivers
	Loadable module support -->
		[o] Enable loadable module support

	General setup -->
		[o] Networking support
		...
		[o] Sysctl support

	Networking options  --->
		...
		<o/M> Unix domain sockets
		[o] TCP/IP networking
		...
		[o] Network packet filtering (replaces ipchains) 
		...
		<o/M>  IP: tunneling
		...
		<o/M>  The IPv6 protocol (EXPERIMENTAL)
		...
		<M>      IPv6: IPv6 over IPv6 Tunneling (EXPERIMENTAL)
		...
		<M>      IPv6: Mobility Support (Correspondent Node) 

	File systems  --->
		[o] /proc file system support

2.1.1.  Building Kernel for a MN

(At first, you must configure as described in 2.1.)

	Networking options  --->
		[o]      IPv6: sub-tree in routing table support (EXPERIMENTAL)
		...
		[o]      MIPv6: Mobile Node Support 


2.1.2.  Building Kernel for a HA

(At first, you must configure as described in 2.1.)

	Networking options  --->
		[o]      IPv6: anycast support
		...
		[o]      MIPv6: Home Agent Support

2.2. Installing user-land applications

2.2.1. Installing the mipdiag command for all nodes

	% cd $USAGI_TOP/usagi/mipdiag
	% ./configure
	% make

	% su
	# make install

(By default, installed path($PREFIX) is '/usr/local/v6', so you can find
mipdiag(8) in '/usr/local/v6/sbin'.)

And, you must create device file for MIP6.

	# mknod /dev/mipv6_dev c 0xf9 0

2.2.1. Installing the radvd for a HA

You need to use radvd which supports MIP6.

	% cd $USAGI_TOP/usagi/radvd
	% ./configure
	% make

	% su
	# make install

(By default, installed path($PREFIX) is '/usr/local/v6', so you can find
radvd(8) in '/usr/local/v6/sbin'.)

2.3. Configuration

Configuration file is network-mip6.conf(5). See manual page for usage
information.

2.3.1. Configuration for a CN

$PREFIX/etc/network-mip6.conf:

FUNCTIONALITY=cn

2.3.2. Configuration for a MN

Here is a MN sample situation:

        +----+
        | MN |eth0(link-local fe80::abcd)
        +----+

$PREFIX/etc/network-mip6.conf:

FUNCTIONALITY=mn
HOMEDEV=eth0
HOMEADDRESS=3ffe:ffff:1234:5678::abcd/64

When you won't use Dynamic Home Agent Address Discovery(DHAAD), MN's HA is
required to be specified manually like below:

HOMEAGENT=3ffe:ffff:1234:5678::1111/64

2.3.3. Configuration for a HA

Here is a HA sample situation:
      -----+----
           |
           | eth0
        +--+--+
        | HA  |
        +--+--+
           | eth1(3ffe:ffff:1234:5678::1111/64)
           |
      -----+----- <home link>


$PREFIX/etc/network-mip6.conf:

FUNCTIONALITY=ha
HOMELINK=eth1


You also have to setup radvd(8). Configuration file is radvd.conf(5).
Remember to specify 'prefix' definitions with a value of HA's global address
instead of prefix like below.

$PREFIX/etc/radvd.conf:

interface eth1 {
	AdvSendAdvert on;
	AdvHomeAgentFlag on;
	AdvHomeAgentInfo on;

	prefix 3ffe:ffff:1234:5678::1111/64 {
		AdvOnLink on;
		AdvAutonomous on;
		AdvRouterAddr on;
	};
};


3. Usage

A startup script for USAGI MIP6 is mobile-ip6. You can use it for your system
startup. :-)

3.1. Starting a CN

Just start mobile-ip6.
	# $PREFIX/etc/init.d/mobile-ip6 start

3.2. Starting a MN

When using DHAAD, MN has to start at its foreign link.

Start mobile-ip6.
	# $PREFIX/etc/init.d/mobile-ip6 start

3.3. Starting a HA

Start radvd(8).
	# $PREFIX/sbin/radvd

Then start mobile-ip6.
	# $PREFIX/etc/init.d/mobile-ip6 start

3.4. Usage after started for all nodes

You can show or edit status with mipdiag(8). See manual page for usage
information.

3.5. How to use IPsec between MN and HA

You can use IPsec between MN and HA for protect Home Registration and
reverse tunneling packets.

If you want to use this function, you must enable CONFIG_IPV6_IPSEC on
the both HA and MN.

The following is the steps how to configure IPsec.

(1)Configure the kernel with the following options.

   o For MN:
     - CONFIG_IPV6_IPSEC
     - CONFIG_IPV6_MOBILITY_MN
     - CONFIG_IPV6_MOBILITY_IPSEC_HA

   o For HA:
     - CONFIG_IPV6_IPSEC
     - CONFIG_IPV6_MOBILITY_HA
     - CONFIG_IPV6_MOBILITY_IPSEC_HA

(2)Recompile and install the kernel and modules, then restart the system.

(3)Configure for the Mobile IPv6(Refer to the 3.1-3.4).

(4)Configure the IPsec Policy and Security Association on the both HA and MN.

   In draft-ietf-mobileip-mipv6-ha-ipsec-06.txt, the following IPsec SA and
   SPD is defined.

   o for Home Registration

     - SPD1: SRC=HoA DST=HA  transport mode proto = MH
     - SPD2: SRC=HA  DST=HoA transport mode proto = MH
     - SAD1: SRC=HoA DST=HA  proto = MH
     - SAD2: SRC=HA  DST=HoA proto = MH

     for Return Routability

     - SPD3: SRC=HoA DST=any tunnel mode SGW=HA  proto = MH
     - SPD4: SRC=any DST=HoA tunnel mode SGW=CoA proto = MH
     - SAD3: SRC=CoA DST=HA
     - SAD4: SRC=HA  DST=CoA

     for Mobile Prefix Discovery

     - SPD5: SRC=HoA DST=HA  transport mode proto = ICMPv6
     - SPD6: SRC=HA  DST=HoA transport mode proto = ICMPv6
     - SAD5: SRC=HoA DST=HA  proto = ICMPv6
     - SAD6: SRC=HA  DST=HoA proto = ICMPv6

   o for Payload Packet

     - SPD7: SRC=HoA DST=any tunnel mode SGW=HA  proto = any
     - SPD8: SRC=any DST=HoA tunnel mode SGW=CoA proto = any
     - SAD7: SRC=CoA DST=HA
     - SAD8: SRC=HA  DST=CoA

   IPsec tunnel mode doesn't support specifying upper protocol, so
   SPD3(SAD3) is identical to SPD7(SAD7) and SPD4(SAD4) is identical
   SPD8(SAD8).

  The following is the sample using AH. In this sample, HoA is 2001:0:0:1::cafe/64 and HA is 2001:0:0:1::beba/64

##################################################
# IPsec-HA transport mode SA and SPD
##################################################
# MH
pfkey -A sp -s 2001:0:0:1::cafe -d 2001:0:0:1::babe -T ah -S 0x1001 -p 62
pfkey -A sp -s 2001:0:0:1::babe -d 2001:0:0:1::cafe -T ah -S 0x1002 -p 62
pfkey -A sa -s 2001:0:0:1::cafe -d 2001:0:0:1::babe -T ah -S 0x1001 -p 62 --auth hmac-md5 --authkey 1234567890abcdef
pfkey -A sa -s 2001:0:0:1::babe -d 2001:0:0:1::cafe -T ah -S 0x1002 -p 62 --auth hmac-md5 --authkey 1234567890abcdef

#ICMPv6
pfkey -A sp -s 2001:0:0:1::cafe -d 2001:0:0:1::babe -T ah -S 0x1005 -p 58
pfkey -A sp -s 2001:0:0:1::babe -d 2001:0:0:1::cafe -T ah -S 0x1006 -p 58
pfkey -A sa -s 2001:0:0:1::cafe -d 2001:0:0:1::babe -T ah -S 0x1005 -p 58 --auth hmac-md5 --authkey 1234567890abcdef
pfkey -A sa -s 2001:0:0:1::babe -d 2001:0:0:1::cafe -T ah -S 0x1006 -p 58 --auth hmac-md5 --authkey 1234567890abcdef

##################################################
# IPsec-HA tunnel mode SA and SPD
##################################################

#Return Routability
pfkey -A sp -s 2001:0:0:1::cafe/128 -d ::/0 -T ah -S 0x1003 -p 62 --tunnel --sad 2001:0:0:1::babe
pfkey -A sp -s ::/0 -d 2001:0:0:1::cafe/128 -T ah -S 0x1004 -p 62 --tunnel --sad 2001:0:0:1:cafe
pfkey -A sa -s 2001:0:0:1:cafe -d 2001:0:0:1::babe -T ah -S 0x1003 -p 62 --auth hmac-md5 --authkey 0x0123456789abcdef0123456789abcdef
pfkey -A sa -s 2001:0:0:1::babe -d 2001:0:0:1:cafe -T ah -S 0x1004 -p 62 --auth hmac-md5 --authkey 0x0123456789abcdef0123456789abcdef

#payload tunneled via Home Agent
pfkey -A sp -s 2001:0:0:1::cafe/128 -d ::/0 -T ah -S 0x1007 -p any --tunnel --sad 2001:0:0:1::babe
pfkey -A sp -s ::/0 -d 2001:0:0:1::cafe/128 -T ah -S 0x1008 -p any --tunnel --sad 2001:0:0:1:cafe
pfkey -A sa -s 2001:0:0:1:cafe -d 2001:0:0:1::babe -T ah -S 0x1007 -p any --auth hmac-md5 --authkey 0x0123456789abcdef0123456789abcdef
pfkey -A sa -s 2001:0:0:1::babe -d 2001:0:0:1:cafe -T ah -S 0x1008 -p any --auth hmac-md5 --authkey 0x0123456789abcdef0123456789abcdef

(5)Start Mobile IPv6 on the both HA and MN.

(6)Caveat

   o This implementation doesn't erase IPsec policies and Security
     Associations when MN returns to home link.
   o This implementation is not supported IKE.


4. References

MIPL		http://www.mipl.mediapoli.com
USAGI		http://www.linux-ipv6.org
