GRE stands for Generic Routing Encapsulation, which is a very simple form of tunneling. With GRE we can easily create a virtual link between routers and allow them to be directly connected, even if they physically aren’t.
- R1
interface Loopback0
ip address 1.1.1.1 255.255.255.255
ip ospf 1 area 0
!
interface Ethernet0/0
ip address 192.168.1.1 255.255.255.0
!
interface Ethernet0/1
ip address 172.30.12.1 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/2
no ip address
shutdown
!
interface Ethernet0/3
no ip address
shutdown
!
router ospf 1
router-id 1.1.1.1
!
- R2
interface Ethernet0/0
ip address 172.30.12.2 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/1
ip address 172.30.23.2 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/2
no ip address
shutdown
!
interface Ethernet0/3
no ip address
shutdown
!
router ospf 1
router-id 2.2.2.2
!
- R3
interface Ethernet0/0
ip address 172.30.23.3 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/1
ip address 172.30.34.3 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/2
no ip address
shutdown
!
interface Ethernet0/3
no ip address
shutdown
!
router ospf 1
router-id 3.3.3.3
!
- R4
interface Loopback0
ip address 4.4.4.4 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/0
ip address 192.168.2.1 255.255.255.0
shutdown
!
interface Ethernet0/1
ip address 172.30.34.4 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/2
no ip address
shutdown
!
interface Ethernet0/3
no ip address
shutdown
!
router ospf 1
router-id 4.4.4.4
!
- R1
interface Tunnel100
ip address 10.100.100.1 255.255.255.252
tunnel source 1.1.1.1
tunnel destination 4.4.4.4
!
ip route 192.168.2.0 255.255.255.0 10.100.100.2
- R2
interface Tunnel100
ip address 10.100.100.2 255.255.255.252
tunnel source 4.4.4.4
tunnel destination 1.1.1.1
!
ip route 192.168.1.0 255.255.255.0 10.100.100.1
Now let try ping between 2 VPC: