1. Brief introduction
GRE (Generic Routing Encapsulation) GRE is one of the most traditional tunneling protocols, its fundamental function is to realize the tunneling function, in order to realize the inter-site network can be accessed through the internal private network.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/24/wKioL1X2g5PgmdvjAAJ-RUxbgmE407.jpg "title=" Vpn.png "alt=" Wkiol1x2g5pgmdvjaaj-ruxbgme407.jpg "/>
For example, assuming that the IP address of 10.1.1.1 XP1 want to access the IP address of 192.168.1.1 XP2, the process is as follows:
The source IP is 10.1.1.1, the destination IP 192.168.1.1 packet arrives after the router R2, because the R2 configuration has GRE, so at this time the original packet is then encapsulated an IP header, the source IP is 1.1.1.1, the target IP is 1.1.1.2.
Packets are sent to the public network, and the original packet is encapsulated with a new IP header, the source IP is 12.1.1.2, the destination IP is 13.1.1.3, and the router sends the data packets according to the route.
After the packet arrives at the router R3, it unlocks the received packet, discovers the GRE header, and itself is the end of the GRE tunnel, again unpacking the packet, when it discovers that the source IP address is 10.1.1.1, the destination IP address is 192.168.1.1, and the packet is then sent to XP2.
After the XP2 receives the packet, it responds with a packet with a source IP of 192.168.1.1 and a destination IP of 10.1.1.1. The GRE header is also encapsulated after reaching router R3, with a source IP of 1.1.1.2 and a target IP of 1.1.1.1. Then the package public IP header, the source IP is 13.1.1.3, the target IP is 12.1.1.2. Finally, the data packets sent out.
After the packet arrives at the router R2, it unlocks the received packet, discovers the GRE header, and itself is the end of the GRE tunnel, again unpacking the packet, when it discovers that the source IP address is 192.168.1.1, the destination IP address is 10.1.1.1, and the packet is then sent to XP1. This completes a complete communication process through private network visits.
2, basic network configuration.
R1 configuration:
Interface fastethernet0/0
IP address 12.1.1.1 255.255.255.0
Interface fastethernet1/0
IP address 13.1.1.1 255.255.255.0
R2 configuration:
Interface fastethernet0/0
IP address 12.1.1.2 255.255.255.0
Interface fastethernet1/0
IP address 10.1.1.254 255.255.255.0
IP Route 0.0.0.0 0.0.0.0 12.1.1.1
R3 configuration:
Interface fastethernet0/0
IP address 13.1.1.3 255.255.255.0
Interface fastethernet1/0
IP address 192.168.1.254 255.255.255.0.3
IP Route 0.0.0.0 0.0.0.0 13.1.1.1
At this time XP1 and XP2 can not be connected through the private network.
3. GRE Configuration
R2 configuration:
Interface Tunnel2
IP Address 1.1.1.1 255.255.255.252
Tunnel Source 12.1.1.2
Tunnel Destination 13.1.1.3
R3 configuration:
Interface Tunnel3
IP address 1.1.1.2 255.255.255.252
Tunnel Source 13.1.1.3
Tunnel Destination 12.1.1.2
At this time XP1 and XP2 still can not be connected through the private network, because the packet is sent through the physical port data, and reached the public network, because the public network does not have a private network routing and discard packets.
4, GRE routing configuration.
R2 configuration:
IP route 192.168.1.0 255.255.255.0 Tunnel2
R3 configuration:
IP Route 10.1.1.0 255.255.255.0 Tunnel3
After the GRE route is configured, all packets to the private network go to the GRE tunnel. This can be done through the private network normal interoperability.
GNS3 Configuring GRE (Generic Routing encapsulation)