Mobile IP hack using IP over UDP (via ethertap on Linux)


I had a slow wireless network PCMCIA card for my laptop (2mbps). It was nice to be able to compute anywhere around my house without dragging along an ethernet cable, but sometimes, when transferring files or even just browsing the web, it was just too slow. In those cases I would much rather have 100mbps ethernet.

The problem here is that when I unplugged my ethernet card and plugged in the wireless card (or the other way around), existing TCP connections on my laptop would die because the interface the sockets were associated with went down. Also, my IP address would change because the wireless network and the ethernet network were on diff subnets. The IP address change would surely kill my TCP connection since my endpoint 4-tuple would change.

The IP address problem could be solved with a bridge, but a bridge was unavilable to me at the time.


My laptop was running Linux, so I wrote a tunnel daemon that used ethertap to create a new network interface. I gave that interface a IP on a new subnet.
wireless network:
ethernet network:
mobile IP network:

wireless gateway card IP:
wireless laptop card IP:
ethernet gateway card IP:
ethernet laptop card IP:
mobile ip (ethertap) gateway IP:
mobile ip (ethertap) laptop IP:

so at any given time, I have 2 of the above interfaces running (ethernet + ethertap or wireless + ethertap). I also have a default route to gateway

Now, I run this program on my laptop with 2 arguments: ./tunnel

This sends any pkts that were going to go over the ethertap interface to the IP addresses on the cmdline via UDP pkts on port 9998. It also listens on UDP port 9998 for pkts and injects them into the ethertap interface. On the wireless gateway machine, I run the same app with 2 arguments: ./tunnel

This should be self explanatory now. If its not, email me and I'll write more!


This works so well. My laptop's IP is, and never changes. When I change cards, the IP stays the same, it just happens to use one interface instead of the other non-existant to tunnel over.