GRE small experiment

This experiment is implemented using Cisco Packet Tracer.

GRE (Generic Routing Encapsulation) is the general routing encapsulation protocol, which encapsulates datagrams of certain network layer protocols (such as IP and IPX), so that these encapsulated datagrams can be transmitted in another network layer protocol (such as IP) transmission.

1. Experimental Topology

Topology description: Router R2 is the ISP (Internet Operator), R1 is the company, and R3 is the branch. R2 only has routes to R1 and R3, but not to the client. At this time, PC1 cannot ping PC2, and the two clients communicate through the GRE tunnel.

2. Address allocation

3. Experimental configuration

R2 configuration

R2(config)#interface gigabitEthernet 0/0
R2(config-if)#ip address 200.0.0.2 255.255.255.0
R2(config-if)#no shutdown 
R2(config)#interface gigabitEthernet 0/1
R2(config-if)#ip address 100.0.0.2 255.255.255.0
R2(config-if)#no shutdown 

verify

 R2 only needs to be configured with an address, and only needs to have a direct route between R1 and R3.

R1 configuration (our company)

R1(config)#interface gigabitEthernet 0/0
R1(config-if)#ip address 200.0.0.1 255.255.255.0               #接口分配地址
R1(config-if)#no shutdown 
R1(config-if)#exit
R1(config)#interface gigabitEthernet 0/2
R1(config-if)#ip address 172.16.1.254 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit

R1(config)#interface tunnel 1                                  #创建隧道口
R1(config-if)#ip address 10.0.0.1 255.255.255.0                #接口分配地址
R1(config-if)#tunnel source gigabitEthernet 0/0                #指定源接口
R1(config-if)#tunnel destination 100.0.0.3                     #指定目的IP

R1(config)#ip route 0.0.0.0 0.0.0.0 200.0.0.2                  #默认路由
R1(config)#ip route 192.168.1.0 255.255.255.0 10.0.0.3 #去往分公司的路由,下一跳为隧道口IP地址

After the default route is configured on R1 and R3, pc1 and pc2 are disconnected. At this time, the intercommunication is realized through the tunnel.

R3 configuration (branch office)

R3(config)#interface gigabitEthernet 0/1
R3(config-if)#ip address 100.0.0.3 255.255.255.0               #接口分配地址
R3(config-if)#no shutdown 
R3(config-if)#exit
R3(config)#interface gigabitEthernet 0/2
R3(config-if)#ip address 192.168.1.254 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit

R3(config)#interface tunnel 1                                  #创建隧道口
R3(config-if)#ip address 10.0.0.3 255.255.255.0                #接口分配地址
R3(config-if)#tunnel source gigabitEthernet 0/1                #指定源接口
R3(config-if)#tunnel destination 200.0.0.1                     #指定目的IP

R3(config)#ip route 0.0.0.0 0.0.0.0 100.0.0.2                  #默认路由
R3(config)#ip route 172.16.1.0 255.255.255.0 10.0.0.3 #去往本公司的路由,下一跳为隧道口IP地址

After the default route is configured on R1 and R3, pc1 and pc2 are disconnected. At this time, the intercommunication is realized through the tunnel.

configuration verification

 pc1 ping pc2

success

Guess you like

Origin blog.csdn.net/weixin_54223979/article/details/123850107