<HTML ><HEAD ><TITLE >IP in IP tunneling</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Linux Advanced Routing & Traffic Control HOWTO" HREF="index.html"><LINK REL="UP" TITLE="GRE and other tunnels" HREF="lartc.tunnel.html"><LINK REL="PREVIOUS" TITLE="A few general remarks about tunnels:" HREF="lartc.tunnel.remarks.html"><LINK REL="NEXT" TITLE="GRE tunneling" HREF="lartc.tunnel.gre.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Linux Advanced Routing & Traffic Control HOWTO</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="lartc.tunnel.remarks.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 5. GRE and other tunnels</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="lartc.tunnel.gre.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="LARTC.TUNNEL.IP-IP" ></A >5.2. IP in IP tunneling</H1 ><P >This kind of tunneling has been available in Linux for a long time. It requires 2 kernel modules, ipip.o and new_tunnel.o.</P ><P >Let's say you have 3 networks: Internal networks A and B, and intermediate network C (or let's say, Internet). So we have network A:</P ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" >network 10.0.1.0 netmask 255.255.255.0 router 10.0.1.1</PRE ></FONT ></TD ></TR ></TABLE ><P >The router has address 172.16.17.18 on network C.</P ><P >and network B:</P ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" >network 10.0.2.0 netmask 255.255.255.0 router 10.0.2.1</PRE ></FONT ></TD ></TR ></TABLE ><P >The router has address 172.19.20.21 on network C.</P ><P >As far as network C is concerned, we assume that it will pass any packet sent from A to B and vice versa. You might even use the Internet for this.</P ><P >Here's what you do:</P ><P >First, make sure the modules are installed:</P ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" >insmod ipip.o insmod new_tunnel.o</PRE ></FONT ></TD ></TR ></TABLE ><P >Then, on the router of network A, you do the following:</P ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" >ifconfig tunl0 10.0.1.1 pointopoint 172.19.20.21 route add -net 10.0.2.0 netmask 255.255.255.0 dev tunl0</PRE ></FONT ></TD ></TR ></TABLE ><P >And on the router of network B:</P ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" >ifconfig tunl0 10.0.2.1 pointopoint 172.16.17.18 route add -net 10.0.1.0 netmask 255.255.255.0 dev tunl0</PRE ></FONT ></TD ></TR ></TABLE ><P >And if you're finished with your tunnel:</P ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" >ifconfig tunl0 down</PRE ></FONT ></TD ></TR ></TABLE ><P >Presto, you're done. You can't forward broadcast or IPv6 traffic through an IP-in-IP tunnel, though. You just connect 2 IPv4 networks that normally wouldn't be able to talk to each other, that's all. As far as compatibility goes, this code has been around a long time, so it's compatible all the way back to 1.3 kernels. Linux IP-in-IP tunneling doesn't work with other Operating Systems or routers, as far as I know. It's simple, it works. Use it if you have to, otherwise use GRE.</P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="lartc.tunnel.remarks.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="lartc.tunnel.gre.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >A few general remarks about tunnels:</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="lartc.tunnel.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >GRE tunneling</TD ></TR ></TABLE ></DIV ></BODY ></HTML >