IP-in-IP Decapsulation
Encapsulation of datagrams in a network is done for multiple reasons, such as when a source server wants to influence the route that a packet takes to reach the destination host. The source server is also known as the encapsulation server.
IP-in-IP encapsulation involves the insertion of an outer IP header over the existing IP header. The source and destination address in the outer IP header point to the endpoints of the IP-in-IP tunnel. The stack of IP headers is used to direct the packet over a predetermined path to the destination, provided the network administrator knows the loopback addresses of the routers transporting the packet. This tunneling mechanism can be used for determining availability and latency for most network architectures. It is to be noted that the entire path from source to the destination does not have to be included in the headers, but a segment of the network can be chosen for directing the packets.
The following illustration describes the basic IP-in-IP encapsulation and decapsulation model.
Use Case: Configure IP-in-IP Decapsulation
The following topology describes a use case where IP-in-IP encapsulation and decapsulation are used for different segments of the network from source to destination. The IP-in-IP tunnel consists of multiple routers that are used to decapsulate and direct the packet through the data center fabric network.
The following illustration shows how the stacked IPv4 headers are de-capsulated as they traverse through the de-capsulating routers.
Stacked IP Header in an Encapsulated Packet
The encapsulated packet has an outer IPv4 header that is stacked over the original IPv4 header, as shown in the following illustration.
Configuration
You can use the following sample configuration on the routers to decapsulate the packet as it traverses the IP-in-IP tunnel:
RP/0/RP0/CPU0:router(config)# interface tunnel-ip 10
RP/0/RP0/CPU0:router(config-if)# tunnel mode ipv4 decap
RP/0/RP0/CPU0:router(config-if)# tunnel source loopback 0
RP/0/RP0/CPU0:router(config-if)# tunnel destination 10.10.1.2/32
-
tunnel-ip: configures an IP-in-IP tunnel interface.
-
ipv4 unnumbered loopback address: enables ipv4 packet processing without an explicit address, except for loopback address.
-
tunnel mode ipv4 decap: enables IP-in-IP decapsulation.
-
tunnel source: indicates the source address for the IP-in-IP decap tunnel w.r.t the router interface.
-
tunnel destination: indicates the destination address for the IP-in-IP decap tunnel w.r.t the router interface.
Running Configuration
RP/0/RP0/CPU0:router# show running-config interface tunnel-ip 10
...
interface tunnel-ip 10
tunnel mode ipv4 decap
tunnel source Loopback 0
tunnel destination 10.10.1.2/32
This completes the configuration of IP-in-IP decapsulation.