Cisco GRE basic configuration in detail

Today, I'll tell you about the Cisco GRE tunneling technology.
Before configuring the GRE tunnel Let's take a look at Cisco's GR tunneling.
GRE (Generic Routing Encapsulation) that is GRE protocol, there is a lightweight tunneling protocol developed by Cisco (networking vendors currently support the basic GRE protocol). It can be a variety of network protocols (IP protocols and non-IP protocol) encapsulated in the tunnel. Because of the small GRE head, so high encapsulation efficiency GRE tunneling protocol is called lightweight. But GRE no security mechanism, is transmitted in clear text, you can see Tunnl IP information packet capture. Generally use IPSec to encrypt protect GRE. When the GRE packets are encapsulated in IPv4, the IPv4 protocol 47 required
data packet format transmitted GRE tunnel follows:
Cisco GRE basic configuration in detail
to know the technical principles of the GRE tunnel, we have to start preparing the following configuration GRE! ! !
In this study, the environment is to use the Cisco Packet Tracer 7 to complete this lab
Router 2811 Series routers to select switch selects 2960-24TT
purpose of the experiment: an enterprise of two sites, have access to the Internet, now want two sites can communicate with each
experiment ideas :
1. in-house use rip protocol
2. the use of the public internet protocol ospf
3. the use of technology on the border nat
experiment topology
Cisco GRE basic configuration in detail
Shanghai
SW2-1 configuration
Switch # conf t
Switch (config) #hostname SW2-1
SW2-1 (config) #vlan 10
SW2-1 (config-VLAN) 20 is #vlan
sw2-1(config-vlan)#ex
sw2-1(config)#interface range fastEthernet 0/1-10
sw2-1(config-if-range)#switchport access vlan 10
sw2-1(config-if-range)#ex
sw2-1(config)#interface range fastEthernet 0/11-20
sw2-1(config-if-range)#switchport mode access
sw2-1(config-if-range)#switchport access vlan 20
sw2-1(config-if-range)#no shutdown
sw2-1#conf t
sw2-1(config)#interface fastEthernet 0/3
sw2-1(config-if)#no shutdown
sw2-1(config-if)#switchport mode trunk
sw2-1(config-if)#no shutdown
lan-route-1 配置
Router(config)#hostname lan-route-1
lan-route-1(config)#interface fastEthernet 0/0
lan-route-1(config-if)#no shutdown
lan-route-1(config-if)#no ip address
lan-route-1(config)#interface fastEthernet 0/0.1
lan-route-1(config-subif)#encapsulation dot1Q 10
lan-route-1(config-subif)#ip address 192.168.1.1 255.255.255.0
lan-route-1(config-subif)#no shutdown
lan-route-1(config)#interface fastEthernet 0/0.2
lan-route-1(config-subif)#ip address 192.168.2.1 255.255.255.0
lan-route-1(config-subif)#encapsulation dot1Q 20
lan-route-1(config-subif)#ip address 192.168.2.1 255.255.255.0
lan-route-1(config-subif)#no shutdown
lan-route-1(config)#interface serial 0/2/0
lan-route-1(config-if)#ip address 1.1.1.1 255.255.255.0
lan-route-1(config-if)#no shutdown
lan-route-1(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2
lan-route-1(config)#router rip
lan-route-1(config-router)#version 2
lan-route-1(config-router)#network 192.168.1.0
lan-route-1(config-router)#network 192.168.2.0
做PAT NAT
lan-route-1(config-router)#default-information originate #这里把刚才的缺省路由进行引入
lan-route-1(config-router)#ex
lan-route-1(config)#access-list 10 permit 192.168.1.0 0.0.0.255
lan-route-1(config)#access-list 10 permit 192.168.2.0 0.0.0.255
lan-route-1(config)#ip nat pool 123 1.1.1.1 1.1.1.1 netmask 255.255.255.252
lan-route-1(config)#ip nat inside source list 10 pool 123 overload
lan-route-1(config)#interface serial 0/2/0
lan-route-1(config-if)#ip nat outside
lan-route-1(config)#interface fastEthernet 0/0.1
. 1-route-LAN (config-subif) #ip NAT Inside
LAN-route-. 1 (config) #interface fastEthernet 0 / 0.2
LAN-route-. 1 (config-subif) #ip Inside NAT
to create a tunnel
lan-route1-2 (config). 1 #interface Tunnel
LAN-route1-2 (config-IF) #ip address 172.16.1.1 255.255.255.0
LAN-route1-2 (config-IF) #no the shutdown
LAN-route1-2 (config-IF) # tunnel destination 1.1.3.2 # here is the end of the IP router
lan-route1-2 (config-if) #tunnel source serial 0/2/0 # here is the self-side port
LAN-route1-2 (config) #router RIP
LAN -route1-2 (config-router) #network 172.16.1.0

公网上的路由器:
Router1配置:
Router(config)#hostname Router1
Router1(config)#interface Serial0/2/0
Router1(config-if)#ip address 1.1.1.2 255.255.255.252
Router1(config-if)#no shutdown
Router1(config)#interface Serial0/2/1
Router1(config-if)#ip address 1.1.2.1 255.255.255.252
Router1(config-if)#no shutdown
Router1(config)#router ospf 1
Router1(config-router)#network 1.1.1.0 0.0.0.3 area 0
Router1(config-router)#network 1.1.2.0 0.0.0.3 area 0
Router2配置
Router2(config)#interface Serial0/2/0
Router2(config-if)#ip address 1.1.2.2255.255.255.252
Router2(config-if)#no shutdown
Router2(config)#interface Serial0/2/1
Router2(config-if)#ip address 1.1.3.1 255.255.255.252
Router2(config-if)#no sh
Router2(config)#router ospf 1
Router2(config-router)#network 1.1.2.0 0.0.0.3 area 0
Router2(config-router)#network 1.1.3.0 0.0.0.3 area 0
北京
Router(config)#hostname lan-route1-2
lan-route1-2lan-route1-2lan-route1-2(config)#interface Serial0/2/0
lan-route1-2lan-route1-2(config-if)#ip address 1.1.3.2 255.255.255.252
lan-route1-2(config-if)#ip address 1.1.3.2 255.255.255.252
lan-route1-2(config-if)#no shutdown
lan-route-1-2(config)#interface fastEthernet 0/0
lan-route-1-2(config-if)#no shutdown
lan-route-1-2(config-if)#no ip address
lan-route-1-2(config)#interface fastEthernet 0/0.1
lan-route-1-2(config-subif)#encapsulation dot1Q 50
lan-route-1-2(config-subif)#ip address 192.168.5.1 255.255.255.0
lan-route-1-2(config-subif)#no shutdown
lan-route-1-2(config)#interface fastEthernet 0/0.2
lan-route-1-2(config-subif)#ip address 192.168.2.1 255.255.255.0
lan-route-1-2(config-subif)#encapsulation dot1Q 60
lan-route-1-2(config-subif)#ip address 192.168.6.1 255.255.255.0
lan-route-1-2(config-subif)#no shutdown
lan-route-1-2(config)#ip route 0.0.0.0 0.0.0.0 1.1.3.1
lan-route-1-2(config)#router rip
lan-route-1-2(config-router)#version 2
lan-route-1-2(config-router)#network 192.168.6.0
lan-route-1-2(config-router)#network 192.168.5.0
lan-route-1-2(config-router)#default-information originate #这里把刚才的缺省路由进行引入
lan-route-1-2(config-router)#ex
lan-route1-2(config)#ip nat inside source static 192.168.5.2 1.1.3.2
lan-route1-2(config)#ip nat inside source static 192.168.6.2 1.1.3.2
这里我放了一点小懒 就做静态NAT ,正确步骤跟上面一样做PAT NAT
lan-route-1(config)#interface serial 0/2/0
lan-route-1(config-if)#ip nat outside
lan-route-1(config)#interface fastEthernet 0/0.1
lan-route-1(config-subif)#ip nat inside
lan-route-1(config)#interface fastEthernet 0/0.2
lan-route-1(config-subif)#ip nat inside
创建一个隧道
lan-route1-2(config)#interface tunnel 1
lan-route1-2(config-if)#ip address 172.16.1.2 255.255.255.0
lan-route1-2(config-if)#no shutdown
lan-route1-2(config-if)#tunnel destination 1.1.1.1#这里是对端路由器的IP
lan-route1-2(config-if)#tunnel source serial 0/2/0 # 这里是自己端的端口
lan-route1-2(config)#router rip
lan-route1-2(config-router)#network 172.16.1.0
sw2-2
Switch#conf t
Switch(config)#hostname sw2-1
sw2-1(config)#vlan 50
sw2-1(config-vlan)#vlan 60
sw2-1(config-vlan)#ex
sw2-1(config)#interface range fastEthernet 0/1-10
sw2-1(config-if-range)#switchport access vlan 50
sw2-1(config-if-range)#ex
sw2-1(config)#interface range fastEthernet 0/11-20
sw2-1(config-if-range)#switchport mode access
sw2-1(config-if-range)#switchport access vlan60
SW2-1 (config-IF-Range) #no the shutdown
SW2-1 the conf # T
SW2-1 (config) #interface fastEthernet 0/3
SW2-1 (config-IF) #no the shutdown
SW2-1 (config-IF) Trunk the MODE #switchport
SW2-1 (config-IF) #no the shutdown
now we have to look at the results:
Beijing production ping the Ministry of Finance
Cisco GRE basic configuration in detail
Beijing production ping Shanghai technology
Cisco GRE basic configuration in detail
Beijing life department ping Shanghai Finance Department
Cisco GRE basic configuration in detail
Beijing life department ping Shanghai technology
Cisco GRE basic configuration in detail
Beijing production visit Shanghai sever
Cisco GRE basic configuration in detail
Cisco GRE basic configuration in detail
If you still do not understand can look at my files
link: https://pan.baidu.com/s/1G-NjhhLXgsr1UF198_2odg
extraction code: povi
Remember this experiment software is 7.0 Cisco Packet Tracer
bloggers write not easy to leave your heart carefully.
Thank you for your support! ! ! !

Guess you like

Origin blog.51cto.com/14198958/2445737