Creating a Tunnel
Problem
You want to tunnel IP traffic through your network.
Solution
The basic GRE tunnel configuration is simply a matter of defining the source and destination addresses or interfaces on both devices. On the first router, you need to create the tunnel interface and define its source and destination:
Router1#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router1(config)#interface TunnelRouter1(config-if)#1ip addressRouter1(config-if)#192.168.35.6 255.255.255.252tunnel sourceRouter1(config-if)#172.25.1.5tunnel destinationRouter1(config-if)#172.25.1.7exitRouter1(config)#endRouter1#
Then, on the other router you must create a tunnel interface with a matching source and destination:
Router5#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router5(config)#interface TunnelRouter5(config-if)#3ip addressRouter5(config-if)#192.168.35.5 255.255.255.252tunnel sourceRouter5(config-if)#172.25.1.7tunnel destinationRouter5(config-if)#172.25.1.5exitRouter5(config)#endRouter5#
Discussion
Creating a basic tunnel is very simple—you just need to define a source and destination on each of two routers. When you do this, as with any other virtual interface such as subinterfaces and loopback interfaces, there is an additional memory requirement on the router. However, the CPU overhead is not as bad as you might initially think. This is because GRE tunnels do work well with Cisco Express Forwarding (CEF). So the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access