GRE LAB


 

To create the tunnel first we have to use the interface tunnel <no> command. This command is used in global config mode. The interface number do not have to match between the two routers. Its just a number which is local to the router. The syntax of the command is shown below.
                                                            Router(config)#interface tunnel <number>

Next we have to use tunnel mode gre ip interface  command to tell the IOS to use GRE encapsulation on the tunnel. This is an optional command since by default the router will use gre ip mode only. The syntax for this command is mentioned below.

                                                                Router(config-if)#tunnel mode gre ip

Next we have to assign the ip address to the tunnel interface using the ip address <address>< mask>  command as shown below.
                                                                Router(config-if)#ip address <address><mask>

Next we have to configure the tunnel source ip address .The source ip address of the tunnel should be same as the destination address of the other end router. To do this we can use the command tunnel source <ip address>   command as shown below.

                                                                     Router(config-if)# tunnel source <ip address >

Next we have to configure the tunnel destination ip address .The destination ip address of the tunnel should be same as the source address of the other end router. To do this we can use the command tunnel destination <ip address>   command as shown below.

                                                                      Router(config-if)# tunnel destination <ip address >

 


R1 Configuration

R1(config)#int tunnel1
R1(config-if)#ip address 10.1.1.1 255.255.255.0
R1(config-if)#tunnel mode gre ip
R1(config-if)#tunnel source
R1(config-if)#tunnel source 172.16.1.1
R1(config-if)#tunnel destination 172.16.3.4

R4 Configuration:

R4(config)#int tunnel1
R4(config-if)#ip address 10.1.1.2 255.255.255.0
R4(config-if)#tunnel mode gre ip
R4(config-if)#tunnel source 172.16.3.4
R4(config-if)#tunnel destination 172.16.1.1

Verification 

R1#show ip route
Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
ia – IS-IS inter area, * – candidate default, U – per-user static route
o – ODR, P – periodic downloaded static route

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 3 subnets
C 172.16.1.0 is directly connected, Serial1/0
D 172.16.2.0 [90/2681856] via 172.16.1.2, 00:08:55, Serial1/0
D 172.16.3.0 [90/3193856] via 172.16.1.2, 00:08:53, Serial1/0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Tunnel1

R1#ping 10.1.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 84/111/132 ms

*Mar 1 00:04:44.799: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel1, changed state to up

R4(config-if)#do show ip route
Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
ia – IS-IS inter area, * – candidate default, U – per-user static route
o – ODR, P – periodic downloaded static route

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 3 subnets
D 172.16.1.0 [90/3193856] via 172.16.3.3, 00:09:27, Serial1/0
D 172.16.2.0 [90/2681856] via 172.16.3.3, 00:09:28, Serial1/0
C 172.16.3.0 is directly connected, Serial1/0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Tunnel1
R4(config-if)#

R4(config-if)#do ping 10.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 96/112/128 ms
R4(config-if)#