Mobile IPv6 with Linux

Augmenting IP with movement awareness.

To start off simply, let's begin without Route Optimization (RO), without IPsec and with a manually configured HA address in the MN. Once we have the basic setup working, we can enhance and expand it incrementally. Keep in mind that in the real world, like on the Internet or in enterprise networks, RO and IPsec are essential. In production networks, you also might desire other extensions, such as Fast Mobile IPv6 (FMIPv6) or Hierarchical Mobile IPv6 (HMIPv6), although those aren't implemented by MIPL.

Let's configure local parameters first, then Layer 2 parameters and finally Layer 3 parameters.

First, let's do the Home Agent configuration (denali), Host State (sysctl). At the outset, we need to put the HA in the right state of mind and configure the HA machine to operate as a router, so we need to turn on packet forwarding. We'll do this by setting the variable /proc/sys/net/ipv6/conf/all/forwarding, using one of the following two commands:

[denali]# echo "1" > /proc/sys/net/ipv6/conf/all/forwarding
[denali]# sysctl -w net.ipv6.conf.all.forwarding=1

You could make those settings permanent across reboots by editing /etc/sysctl.conf.

Now, let's configure Layer 2 (the Data Link Layer) parameters (Listing 1). We'll assign each wireless interface a different wireless network ID (ESSID) and sufficiently space their frequency channels apart to avoid inter-cell interference.

Our next step is to configure the Layer 3 (Network Layer) parameters. This includes addressing, configuring the Router Advertisement Dæmon and configuring the Mobility Dæmon. To configure addressing, use the commands shown in Listing 2.

To configure router advertisements, edit the /etc/radvd.conf file, as shown here:

interface wlan0
        AdvSendAdvert on;
        AdvIntervalOpt on;

        MaxRtrAdvInterval 10;
        MinRtrAdvInterval 1;
        MinDelayBetweenRAs 1;
        AdvHomeAgentFlag on;

        prefix 2001:db8::/64
        AdvOnLink on;
        AdvAutonomous on;
        AdvRouterAddr on;

interface wlan1
        AdvSendAdvert on;
        AdvIntervalOpt on;

        MaxRtrAdvInterval 10;
        MinRtrAdvInterval 1;
        MinDelayBetweenRAs 1;
        AdvHomeAgentFlag off;

        prefix 2001:db8:1::/64
        AdvOnLink on;
        AdvAutonomous on;
        AdvRouterAddr on;

In the stanza pertaining to wlan0, you can see that we have enabled router advertisements on the interface by setting AdvSendAdvert. We also have configured the interface to operate as an HA by setting AdvHomeAgentFlag. The other wireless interface, wlan1, is configured similarly, except that AdvHomeAgentFlag isn't set. Note that the more frequent the router advertisements are, the faster movement can be detected but they generate more overhead.

Now launch the router advertisement dæmon, radvd:

[denali]# radvd -C /etc/radvd.conf

To configure the Mobility Dæmon, we need to edit the /etc/mip6d.conf file, as follows:

NodeConfig HA;

## If set to > 0, will not detach from tty
DebugLevel 0;

## List of interfaces where we serve as Home Agent
Interface "wlan0";
UseMnHaIPsec disabled;

Notice that we merely indicated that the machine is an HA and specified the interface that will be operating as an HA. By launching the Mobility Dæmon, the router is set to fulfill its duty as a faithful HA:

[denali]# mip6d -c /etc/mip6d -d 7

Now, let's move on to the Mobile Node Configuration (raven), Host State (sysctl). Just as with the HA, we'll start by establishing the mindset of the MN. First, we must configure the MN to accept Router Advertisements (RAs) to be able to configure a CoA and discover and track default routers on the link automatically:

[raven]# echo "1" > /proc/sys/net/ipv6/conf/all/accept_ra
[raven]# sysctl -w net.ipv6.conf.all.accept_ra=1

To make the changes permanent across reboots, edit /etc/sysctl.conf.

Next, let's configure Layer 2 parameters. We'll configure the MN as a wireless client (a managed wireless node) of the Home network:

[raven]# iwconfig wlan0 mode managed essid "home"
[raven]# iwconfig wlan0

wlan0     IEEE 802.11b  ESSID:"home"
          Mode:Managed  Frequency:2.422 GHz  Access Point:
          Bit Rate:11 Mb/s   Sensitivity=1/3
          Retry min limit:8   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=48/92  Signal level=-63 dBm  Noise level=-100 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:175   Missed beacon:0

And, finally, let's configure Layer 3 parameters. We'll start by assigning the HoA to the wireless interface:

[raven]# ifconfig wlan0 inet6 add 2001:db8::beef/64
[raven]# ifconfig wlan0 ; ifconfig ip6tnl1

wlan0     Link encap:Ethernet  HWaddr 00:05:5D:F2:DB:2B
          inet6 addr: 2001:db8::beef/64 Scope:Global
          inet6 addr: fe80::205:5dff:fef2:db2b/64 Scope:Link
          inet6 addr: 2001:db8::205:5dff:fef2:db2b/64 Scope:Global
          RX packets:141 errors:0 dropped:0 overruns:0 frame:0
          TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:16094 (15.7 Kb)  TX bytes:5592 (5.4 Kb)
          Interrupt:17 Base address:0x2100

ip6tnl1   Link encap:UNSPEC  
          ↪HWaddr 20-01-0D-B8-00-00-00-00-00-00-00-00-00-00-00-00
          inet6 addr: fe80::205:5dff:fef2:db2b/64 Scope:Link
          UP POINTOPOINT RUNNING NOARP  MTU:1460  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

On the MN, an automatically created tunnel interface, called ip6tnl1 (IPv6 Tunnel 1), represents the tunneling process described above. This interface claims no global addresses when the MN is in the Home network and assumes the HoA when the MN is away.

The primary mobility configuration parameters are the Home Address (HoA) and the Home Agent (HA) address. To configure them, we need to edit the /etc/mip6d.conf file as follows:

NodeConfig MN;

DebugLevel 7;

UseMnHaIPsec disabled;
DoRouteOptimizationMN disabled;
DoRouteOptimizationCN disabled;

Interface "wlan0";
MnHomeLink "wlan0" {
        HomeAddress 2001:db8::beef/64;
        HomeAgentAddress 2001:db8::;



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

MIPL site is down.

Mahipal Rao's picture

I am trying to setup MIP for IPv6 but unable to get the kernel patch for it as mipl site is down always. Is there any alternate place for the patch against 2.6.16 to download?

One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix