Creating a GRE tunnel for traversing a public network

This example creates a GRE tunnel between two switches, enabling traffic from two networks to traverse a public network.

Procedure
  1. On switch 1:
    1. Enable interface 1/1/1 and assign the IP address 10.1.1.1/24 to it.
      switch# config
      switch(config)# interface 1/1/1
      switch(config-if)# ip address 10.1.1.1/24
      switch(config-if)# no shutdown
    2. Enable interface 1/1/2 and assign the IP address 180.1.10.2/24 to it.
      switch# config
      switch(config)# interface 1/1/2
      switch(config-if)# ip address 180.1.10.2/24
      switch(config-if)# no shutdown
      switch(config-if)# exit
    3. Create GRE tunnel 10 and assign the IP address 192.168.10.1/24, source address 10.1.1.1, and destination address 20.1.1.1 to it.
      switch(config)# interface tunnel 10 mode gre ipv4
      switch(config-gre-if)# ip address 192.168.10.1/24
      switch(config-gre-if)# source ip 10.1.1.1
      switch(config-gre-if)# destination ip 20.1.1.1
      switch(config-gre-if)# no shutdown
      switch(config-gre-if)# exit
    4. Defines routes so that traffic from network 1 can reach network 2 through the tunnel.
      switch(config)# ip route 20.1.1.0/24 10.1.1.2
      switch(config)# ip route 190.1.10.0/24 tunnel10
  2. On switch 2:
    1. Enable interface 1/1/1 and assign the IP address 20.1.1.1/24 to it.
      switch# config
      switch(config)# interface 1/1/1
      switch(config-if)# ip address 20.1.1.1/24
      switch(config-if)# no shutdown
    2. Enable interface 1/1/2 and assign the IP address 190.1.10.2/24 to it.
      switch(config)# interface 1/1/2
      switch(config-if)# ip address 190.1.10.2/24
      switch(config-if)# no shutdown
      switch(config-if)# exit
    3. Create GRE tunnel 10 and assign the IP address 192.168.10.2/24, source address 20.1.1.1, and destination address 10.1.1.1 to it.
      switch(config)# interface tunnel 10 mode gre ipv4
      switch(config-gre-if)# ip address 192.168.10.2/24
      switch(config-gre-if)# source ip 20.1.1.1
      switch(config-gre-if)# destination ip 10.1.1.1
      switch(config-gre-if)# no shutdown
      switch(config-gre-if)# exit
    4. Defines routes so that traffic from network 2 can reach network 1 through the tunnel.
      switch(config)# ip route 10.1.1.0/24 20.1.1.2
      switch(config)# ip route 180.1.10.0/24 tunnel10