Mobile IPv6 user space daemons for Android
This tutorial shows how to build the UMIP.org MIPv6 implementation for an Android phone. I recommend to read a previous post on the issue, where it is explained how to compile and configure the UMIP.org for an ordinary (Ubuntu) Linux environment.
Initially I have tried to use the prebuilt Android toolchain and after a lot of time spent trying to patch the code to fit the Bionic and other libraries requirements, I started looking for alternatives.
Thanks to Christian Graffe, who in his post on the Nautilus6 forum, give me the hints on how to go on. The solution to almost all my problems was using the CodeSourcery ARM GNU/Linux toolchain, which I’ve already used in my initial steps but I didn’t realize to use for compiling UMIP.
Requirements
Create a directory to held all the packages, libraries, etc.
$ mkdir mytestdir
$ cd mytestdir
The ~/mytestdir
will be used from now on as the root path, but you can change it for the one you like. Just keep in mind to include -I
and -L
options for the different libraries.
Install CodeSourcery ARM GNU/Linux and include it in your path (better put it in your login script).
$ wget https://sourcery.mentor.com/sgpp/lite/arm/portal/package8741/public/arm-none-linux-gnueabi/arm-2011.03-41-arm-none-linux-gnueabi.bin
$ ./arm-2011.03-41-arm-none-linux-gnueabi.bin
...Follow the instructions...
$ export PATH=/Sourcery_G++_Lite/bin:$PATH
Note: CodeSourcery is now Mentor Graphics Sourcery Tools. To download lite toolchains follow the link and specifically for ARM this one [2]
Although it is not required as the UMIP.org source code includes its own crypto implementation you can compile it against OpenSSL library. This is up to you, so this step can be skipped.
Kernel configuration
On a previous post I have explained how to create a custom kernel and flash it. For running Mobile IPv6, it is required you enable at least the following options in your kernel configuration [3]:
General setup
--> Prompt for development and/or incomplete code/drivers [CONFIG_EXPERIMENTAL]
--> System V IPC [CONFIG_SYSVIPC]
Networking support [CONFIG_NET]
--> Networking options
--> Transformation user configuration interface [CONFIG_XFRM_USER]
--> Transformation sub policy support [CONFIG_XFRM_SUB_POLICY]
--> Transformation migrate database [CONFIG_XFRM_MIGRATE]
--> PF_KEY sockets [CONFIG_NET_KEY]
--> PF_KEY MIGRATE [CONFIG_NET_KEY_MIGRATE]
--> TCP/IP networking [CONFIG_INET]
--> The IPv6 protocol [CONFIG_IPV6]
--> IPv6: AH transformation [CONFIG_INET6_AH]
--> IPv6: ESP transformation [CONFIG_INET6_ESP]
--> IPv6: IPComp transformation [CONFIG_INET6_IPCOMP]
--> IPv6: Mobility [CONFIG_IPV6_MIP6]
--> IPv6: IPsec transport mode [CONFIG_INET6_XFRM_MODE_TRANSPORT]
--> IPv6: IPsec tunnel mode [CONFIG_INET6_XFRM_MODE_TUNNEL]
--> IPv6: MIPv6 route optimization mode [CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION]
--> IPv6: IPv6-in-IPv6 tunnel [CONFIG_IPV6_TUNNEL]
--> IPv6: Multiple Routing Tables [CONFIG_IPV6_MULTIPLE_TABLES]
--> IPv6: source address based routing [CONFIG_IPV6_SUBTREES]
File systems
--> Pseudo filesystems
--> /proc file system support [CONFIG_PROC_FS]
OpenSSL library cross-compilation
Download OpenSSL source code. I have used v0.9.8r but I guess there shouldn’t be any problem with recent v1.
$ wget http://www.openssl.org/source/openssl-0.9.8r.tar.gz
$ tar xvfz openssl-0.9.8r.tar.gz
$ cd openssl-0.9.8r
Configure and compile for ARMv7 (it is the one for the Nexus S)
$ MACHINE=armv7 \
CROSSCOMPILE=arm-none-linux-gnueabi- \
CC=${CROSSCOMPILE}gcc \
AR=${CROSSCOMPILE}ar \
ARD=${CROSSCOMPILE}ar \
RANLIB=${CROSSCOMPILE}ranlib \
./config --prefix=$HOME/mytestdir/install
Change the install path if you want to.
Check the output of config
just to be sure that everything has gone well and all the requirements are fulfilled. My system has the necessary libraries, but if yours doesn’t use apt-get install
(if on Debian based Linux) to solve your problems.
$ make CFLAGS="-g -O2 -static"
$ make install
Compile UMIP
Download UMIP.org from the git repository
$ git clone git://git.umip.org/umip.git umip
$ cd umip
$ autoreconf -ivf
Update:
As from a comment by Benjamin Green I have uploaded UMIP.org to GitHub, so now you can just get the code from there. If you want to modify anything just feel free.
$ git clone git://github.com/jlanza/umip.git
For the configuration step you have several options, depending on how and where you plan to use the binaries in the phone. In case you want them to be installed by default in your own ROM you can choose to put them under /system/local
. If you want to manually install and run them you can put them in /data/local
. The path of your choice should be included in as the prefix when running the configure
script. Below you can find some examples.
$ ./configure --prefix=/system/local --host=arm-none-linux-gnueabi ARCH=arm CC="arm-none-linux-gnueabi-gcc" CROSS_COMPILE="arm-none-linux-gnueabi-" --sysconfdir=/system/usr/local/etc
$ ./configure --prefix=$HOME/mytestdir/install --host=arm-none-linux-gnueabi --build=x86_64-unknown-linux-gnu ARCH=arm CC="arm-none-linux-gnueabi-gcc" CROSS_COMPILE="arm-none-linux-gnueabi-" --enable-vt LDFLAGS="-L$HOME/mytestdir/install/lib" CPPFLAGS="-I$HOME/mytestdir/install/include"
$ ./configure --prefix=/data/local/umip --host=arm-none-linux-gnueabi --build=x86_64-unknown-linux-gnu ARCH=arm CC="arm-none-linux-gnueabi-gcc" CROSS_COMPILE="arm-none-linux-gnueabi-" --enable-vt LDFLAGS="-L$HOME/mytestdir/install/lib" CPPFLAGS="-I$HOME/mytestdir/install/include"
Note: The –enable-vt option enables a virtual terminal, which can be useful to retrieve the binding cache or binding update list information on the Home Agent or the Mobile Node. When compiling you get some warnings.
$ make CFLAGS="-g -O2 -static"
As a result of the compilation you will get the daemon mip6d
(under src
directory).
If you install ($ make install
) the path would be the one you have set when running the configure script. Besides that the configure path will be the location to search for the different configuration files.
$ ls <install_dir>
./sbin
./sbin/mip6d
./share
./share/man
./share/man/man1
./share/man/man1/mip6d.1
./share/man/man7
./share/man/man7/mipv6.7
./share/man/man5
./share/man/man5/mip6d.conf.5
Running UMIP
The phone most of the times will act as the Mobile Node (MN). This is the reason why it is only included the configuration of the MN. More information on how to configure Home Agent (HA), etc. is available in [4]. Having said that, it is required you have a network with a HA and the different elements required.
In the umip/extra
directory you can find several configuration examples for the different roles your node can play.
$ find . -iname "*.conf"
./extras/example-mn.conf
./extras/example-nemo-mn.conf
./extras/example-nemo-ha.conf
./extras/example-ha.conf
./extras/example-cn.conf
Our custom configuration for a MN, mip6d-mn.conf
, is:
# MIPv6 Mobile Node NodeConfig MN; # Set DebugLevel to 0 if you do not want debug messages DebugLevel 10; # Enable the optimistic handovers OptimisticHandoff enabled; # Disable Route optimization with other MNs (it is not compatible # with IPsec Tunnel Payload) DoRouteOptimizationMN enabled; # Disable Route optimization with other CNs DoRouteOptimizationCN enabled; UseCnBuAck enabled; # List here the interfaces that you will use # on your mobile node. The available one with # the smallest preference number will be used. Interface "wlan0" { MnIfPreference 1; } # Replace wlan0 with one of your interface used on # your mobile node MnHomeLink "wlan0" { # Set the HA address HomeAgentAddress 3ffe:2620:6:1::1; # Set the HA network mask HomeAddress 3ffe:2620:6:1::1234/64; # address opt. #MnRoPolicy 3ffe:2060:6:1::3 enabled; #MnRoPolicy disabled; } UseMnHaIPsec enabled; IPsecPolicySet { HomeAgentAddress 3ffe:2620:6:1::1; HomeAddress 3ffe:2620:6:1::1234/64; IPsecPolicy HomeRegBinding UseESP; IPsecPolicy TunnelMh UseESP; }
It has to be further checked how to include and manage multiple interfaces. In that case it should be included the following template configuration.
# List here the interfaces that you will use # on your mobile node. The available one with # the smallest preference number will be used. Interface "wlan0" { MnIfPreference 1; } Interface "eth0" { MnIfPreference 2; } # Replace wlan0 with one of your interface used on # your mobile node MnHomeLink "wlan0" { # Set the HA address HomeAgentAddress 3ffe:2620:6:1::1; # Set the HA network mask HomeAddress 3ffe:2620:6:1::1234/64; # address opt. #MnRoPolicy 3ffe:2060:6:1::3 enabled; #MnRoPolicy disabled; } # Replace eth0 with one of your interface used on # your mobile node MnHomeLink "eth0" { HomeAgentAddress 2001:db8:ffff:0::1000; HomeAddress 2001:db8:ffff:0::1/64; }
Note: Still to be tested.
Move the files to the phone and enter phone shell.
$ adb pull mip6d /data/local
$ adb pull mip6d-mn.conf /data/local
$ adb shell
Now you have the configuration for you MN, it is time to run it. On the phone, move to the directory where you have installed the mip6d
daemon.
$ su
# cd /data/local
# ./mip6d -c ./mip6d-mn.conf
If you don’t set the -c option, the daemon will look at the default location you set at configuration and compilation time. Other options are available, just access the help.
$ ./mip6d -h
Usage: mip6d [options]
Options:
-V, --version Display version information and copyright
-?, -h, --help Display this help text
-c Read configuration from
--vt-service Set VT service (default=7777)
These options override values read from config file:
-d Set debug level (0-10)
-l Write debug log to instead of stderr
-C, --correspondent-node Node is CN
-H, --home-agent Node is HA
-M, --mobile-node Node is MN
For bug reporting, see URL:http://www.mobile-ipv6.org/bugs/.
If everything is setup correctly, the daemon should be running and your phone is behaving as a MN.
References
[1] Nautilus6 DSMIPv6 implementation Mailing List – Re: UMIP-DSMIPv6 current status
[2] Download Sourcery CodeBench Lite Edition for ARM
[3] How to install UMIP (kernel and userland)
[4] How to setup a Mobile IPv6 testbed (with IPsec static keying)
Sory I’m a newbie, where can
we type All the command above?
thanks
Hi,
We are still in a testing phase, but more or less we know that almost all work on a desktop.
Concerning the android system, as you can see in the post, the grey boxes has different font color. The black color is for computer and the grey font is for android.
Do you have some text or reference how to configure the access router, home agent and correspondent node for this android as the mobile node?
Thanks
Hope in the next few week we put more information. This was a preliminary entry, and right now I’m busy with some deadlines and unable to finish the developments.
These configuration files are slight modifications of the examples provided in FMIP and UMIP.
need help, can you show me how to root android?
thx
Please use the search engines a little bit before asking 😉
There is a link https://devjlanza.wordpress.com/2011/09/01/enable-root-access-on-android-phone-nexus-s/ where I show how to root an android, but there are many others on the web.
how to log in as superuser in android?
i had try in my android terminal emulator, but can’t…
Ok, thanks jlanza……
can i get your email??
Sorry for my carp question, but i really need your help.
I has following all the step above on my android galaxy mini,
I has configure a home agent, correspondent node, and a next area router for mipv6 testbed,
but i don’t know what type of application on android for running service like ping, voice, or video that support ipv6..
Can you help me?
thanks
Hi,
What I’ve done is log-in into the android shell using adb. Then from the shell you can run the ping to test that everything goes smoothly, that is IPv6 address assignment, routes,… and do a ping6.
Concerning the apps, we are still working on it, trying to stabilized the testbed. Probably in the next weeks there will be a new post on the issue.
Hello sir please would tell me whether HIP support is there or not in android or only till date only MIPV6 support only available ?
pls it’ urgent
Sorry for the late response.
I don’t know. I don’t recall having seen it when compiling the kernel. But maybe there is complete support on user-space. Just search for it 😉
nice post devjlanza
i was trying to execute ./arm-2011.03-41-arm-none-linux-gnueabi.bin
but the result was like this
bash : /arm-2011.03-41-arm-none-linux-gnueabi.bin : Permission Denied
why it can be executed?
thanks
Try to set execution permissions to the file:
chmod +x arm…..
./arm…
or exectute it with sh.
P.S.: Thanks for the comments 😉 We will try to enhance the description with configuration examples.
can it work on galaxy mini ??
It should be possible. You have to customize the kernel to fit the requirements (see other post about it). Then the compiling procedure for the daemons is the same
Hi jlanza!
I pushed mip6d to emulator,but when a try to running, i got the following error:
# ./mip6d -h
./mip6d: 1: Syntax error: “(” unexpected
what im doing wrong?
thanks
Actually I don’t know what could be. It seems like an error in the compilation, as the error is in line 1 (I think). Have you tried to compile a simple hello world program before to check that the toolchain is well configured?
May can you sent me the mip6d file, because a simple hello world runs without error. Thanks
I think the problem might be cause by not using the appropiate config file, have you put on?
The best thing you can do is compile and try in laptop and then migrate the configuration to android.
Concerning my mip6d I will try to upload it and post a link, but I didn’t do anything special.
Thanks, i will try again, but if you can, pleas send me your file. My address: vnowordpress@gmail.com Thanks!
Hai devjlanza,
can you share your Mipv6 costumize kernel ?
I don’t know if this is legal or not. I mean upload a binary of the kernel.
WOW.. nice post
I’ve succesed compile the the kernel,
But when i tried to cross compile the umip, i stuck ed at
./configure ….
bash: ./configure: No such file or directory
What happen here?
The configuration file should be there. This is just as dowloaded from the git repo. You can try autoreconf -ivf to generate all the automake files. I don’t remember if I did so 😦
Edit: I’ve updated the post to include the autoreconf command. I forgot to put it.
Thanks dev, autoconf work..
but the result
–host=arm-none-linux-gnueabi ARCH=arm CC=”arm-none-linux-gnueabi-gcc” CROSS_COMPILE=”arm-none-linux-gnueabi-” –sysconfdir=/system/usr/local/etc
configure: WARNING: if you wanted to set the –build type, don’t use –host.
If a cross compiler is detected then cross compile mode will be used
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for arm-none-linux-gnueabi-strip… no
checking for strip… strip
checking for a thread-safe mkdir -p… /bin/mkdir -p
checking for gawk… no
checking for mawk… mawk
checking whether make sets $(MAKE)… yes
checking build system type… i686-pc-linux-gnu
checking host system type… arm-none-linux-gnueabi
checking for style of include used by make… GNU
checking for arm-none-linux-gnueabi-gcc… arm-none-linux-gnueabi-gcc
checking whether the C compiler works… no
configure: error: in `/MIPv6-Kernel/umip’:
configure: error: C compiler cannot create executables
See `config.log’ for more details
Can you explain this command mean?
$ ./configure –prefix=/system/local –host=arm-none-linux-gnueabi ARCH=arm CC=”arm-none-linux-gnueabi-gcc” CROSS_COMPILE=”arm-none-linux-gnueabi-” –sysconfdir=/system/usr/local/etc
$ ./configure –prefix=$HOME/mytestdir/install –host=arm-none-linux-gnueabi –build=x86_64-unknown-linux-gnu ARCH=arm CC=”arm-none-linux-gnueabi-gcc” CROSS_COMPILE=”arm-none-linux-gnueabi-” –enable-vt LDFLAGS=”-L$HOME/mytestdir/install/lib” CPPFLAGS=”-I$HOME/mytestdir/install/include”
$ ./configure –prefix=/data/local/umip –host=arm-none-linux-gnueabi –build=x86_64-unknown-linux-gnu ARCH=arm CC=”arm-none-linux-gnueabi-gcc” CROSS_COMPILE=”arm-none-linux-gnueabi-” –enable-vt LDFLAGS=”-L$HOME/mytestdir/install/lib” CPPFLAGS=”-I$HOME/mytestdir/install/include”
Do you have included your arm-none-linux-gnueabi in the PATH? It seems that the compiler, strip, etc are not found.
Concerning the configure lines, these are several options for configuration depending on your needs, with/without telnet console to mip6d management interface, setting the default directories where conf files will be located (you can place then whereever you want by using -c option).
Hope that helps.
great post jlanza!
Just a couple of question: accordingly with umip site that you linked for the HA settings, umip, HA side, rely on setkey for managing IpSec. Tey also say that setkey must run also on the MN to use that configuration, that imply to crosscompile that tools too. What I do not understand from your post is if your configuration need the setup of a set of preshared secret beetween the MN and the HA or if is useless in both.
R.
p.s. sorry for the english
Currently I have not done any encryption at all, so no idea how the IpSec configuration should be 😦 If I made any progress on that I’ll post it. Anyway, please keep me posted on your progress so I can reference you and update/enhance the tutorial.
Hello Christian Graffe here… Thanks for the credits.. Let me tell you that i will be posting on the mailing list an Android native application that manages all mip6d daemon functionality and more, for the people interested using this app will help a lot for the day to day use and testing. It already includes the mip6d daemon precompiled and just need the custom kernel to be installed. The name of the app is MIPv6Droid
1 quote.. for me, mip6d fails to run when the virtual terminal option is active
2 quote.. The phone needs to be rooted, the emulator is already rooted but the phones are not, people may consider to built the custom kernel already rooted. that´s how I did for my college final work
Cheers
Hi Christian,
Thanks for passing around and leave your comments. I have to credit you because without your expertise this couldn’t have been done. Some people ask me to post the daemon and I was trying to do so, but work on other issues didn’t let me do so. I was thinking on uploading my custom kernel as well, but I guess it is very personal and it is not so difficult to create one. Actually there is another post concerning this issue. If you think it is interesting I can upload it. Besides in my project I have other applications compiled for android, like some IPv6 tunneling options which are not available on default android ip command.
Please, send me the link to the precompiled mip6d daemon so I link it. Otherwise I will upload mine (hope to do so soon).
Help! Anyone who has been looking Mobile IPv6 and the umip.org website. After looking into this it appears that git.umip.org was hosted on a home machine with a static IP… this is all fine but it has gone down along with the mail server for natisbad.org. If any of you have a copy of the repository you can push to github or something that would be really useful.
Sorry for the panic but I cannot find the source anywhere, although it will make me look foolish I hope that the site is back up before anyone has chance to help me 🙂
I have the source code, so I will try to upload it. Hope I don’t break any licence, otherwise I will send it to you by mail
Hi Benjamin,
Post updated, you have a github version of the code I downloaded. Please try to compile it in order to see if everything goes fine. I have just pushed the code I have.
Thank you for your help, the umip.org appears to be back up! Thank you very much for your help.
thank you for share!