Configure GRE for IPv4 Network Communication

  • Home
  • News
  • Configure GRE for IPv4 Network Communication

Static routing mode

Networking requirements

 

Configuration steps

Configuring network interfaces

#############SwitchA##########################

SwitchA(config)# interface eth-0-1

SwitchA(config-if)# no switchport

SwitchA(config-if)# ip address 192.168.1.1/24

SwitchA(config-if)# exit

SwitchA(config)# interface eth-0-23

SwitchA(config-if)# no switchport

SwitchA(config-if)# ip address 10.1.1.1/24

SwitchA(config-if)# exit

SwitchA(config)#

#############SwitchB##########################

SwitchB(config)# interface eth-0-23

SwitchB(config-if)# no switchport

SwitchB(config-if)# ip address 10.1.1.2/24

SwitchB(config-if)# exit

SwitchB(config)# interface eth-0-24

SwitchB(config-if)# no switchport

SwitchB(config-if)# ip address 10.1.2.2/24

SwitchB(config-if)# exit

SwitchB(config)#

#############SwitchC##########################

SwitchC(config)# interface eth-0-24

SwitchC(config-if)# no switchport

SwitchC(config-if)# ip address 10.1.2.3/24

SwitchC(config-if)# exit

SwitchC(config)# interface eth-0-1

SwitchC(config-if)# no switchport

SwitchC(config-if)# ip address 192.168.2.1/24

SwitchC(config-if)# exit

SwitchC(config)#

Configure static routes to make the tunnel network reachable

#############SwitchA##########################

SwitchA(config)# ip route 10.1.2.0/24 10.1.1.2

SwitchA(config)#

#############SwitchC##########################

SwitchC(config)# ip route 10.1.1.0/24 10.1.2.2

SwitchC(config)#

Configure GRE Tunnel

#############SwitchA##########################

SwitchA(config)# interface eth-0-23

SwitchA(config-if)# tunnel enable

SwitchA(config-if)# exit

SwitchA(config)# interface tunnel 1

SwitchA(config-if)# tunnel mode gre

SwitchA(config-if)# tunnel source eth-0-23

SwitchA(config-if)# tunnel destination 10.1.2.3

SwitchA(config-if)# keepalive 5 3

SwitchA(config-if)# ip address 192.168.168.1/24

SwitchA(config-if)# exit

#############SwitchC##########################

SwitchC(config)# interface eth-0-24

SwitchC(config-if)# tunnel enable

SwitchC(config-if)# exit

SwitchC(config)# interface tunnel 1

SwitchC(config-if)# tunnel mode gre

SwitchC(config-if)# tunnel source eth-0-24

SwitchC(config-if)# tunnel destination 10.1.1.1

SwitchC(config-if)# keepalive 5 3

SwitchC(config-if)# ip address 192.168.168.2/24

SwitchC(config-if)# exit

Configure GRE tunnel routes

#############SwitchA##########################

SwitchA(config)# ip route 192.168.2.0/24 tunnel1

#############SwitchC##########################

SwitchC(config)# ip route 192.168.1.0/24 tunnel1

Result verification

Check tunnel status

SwitchA# show interface tunnel 1

Interface tunnel1

Interface current state: UP

Hardware is Tunnel

Index 8193 , Metric 1 , Encapsulation TUNNEL

VRF binding: not bound

Internet primary address:

192.168.168.1/24 pointopoint 192.168.168.255

Tunnel protocol/transport GRE/IP, Status Valid

Tunnel source 10.1.1.1(eth-0-23)

Tunnel destination 10.1.2.3

Tunnel DSCP inherit,  Tunnel TTL 254

Tunnel GRE key disable

Tunnel GRE keepalive enable, Send period: 5, Retry times: 3

11882 packets input, 1253396 bytes

17259 packets output, 1734436 bytes

SwitchA#

Verify the tunnel is reachable

SwitchA# ping -a 192.168.168.1 192.168.168.2

PING 192.168.168.2 (192.168.168.2) from 192.168.168.1 : 56(84) bytes of data.

64 bytes from 192.168.168.2: icmp_seq=1 ttl=64 time=1.87 ms

64 bytes from 192.168.168.2: icmp_seq=2 ttl=64 time=1.61 ms

64 bytes from 192.168.168.2: icmp_seq=3 ttl=64 time=1.59 ms

64 bytes from 192.168.168.2: icmp_seq=4 ttl=64 time=1.52 ms

64 bytes from 192.168.168.2: icmp_seq=5 ttl=64 time=1.65 ms

 

— 192.168.168.2 ping statistics —

5 packets transmitted, 5 received, 0% packet loss, time 4006ms

rtt min/avg/max/mdev = 1.524/1.653/1.872/0.120 ms

SwitchA#

 

Network intercommunication

In this case, PC2 can be pinged from PC1. The test procedure is omitted.