Cấu hình GRE Tunnel để cho phép mạng Lan giữa SAIGON và VUNGTAU có thể giao tiếp được với nhau.
SAIGON(config)#interface tunnel 1
SAIGON(config-if)#ip address 10.1.1.1 255.255.255.0
Dùng địa chỉ của cổng s0/0 làm địa chỉ nguồn
SAIGON(config-if)#tunnel source s0/0
Địa chỉ “tunnel” đích
SAIGON(config-if)#tunnel destination 151.1.1.1
Khi gói tin đến mạng 192.168.2.0/24 sẽ được chuyển đến tunnel 1 và thực hiện việc đóng gói.
SAIGON(config)#ip route 192.168.2.0 255.255.255.0 tunnel 1
VUNGTAU(config)#interface tunnel 1
VUNGTAU(config-if)#ip address 10.1.1.2 255.255.255.0
VUNGTAU(config-if)#tunnel source s0/0
VUNGTAU(config-if)#tunnel destination 150.1.1.1
VUNGTAU(config)#ip route 192.168.1.0 255.255.255.0 tunnel 1
SAIGON
Building configuration...
Current configuration : 1354 bytes
!
hostname SAIGON
!
!
interface Tunnel1
ip address 10.1.1.1 255.255.255.0
tunnel source Serial0/0
tunnel destination 151.1.1.1
!
interface Loopback0
ip address 192.168.1.1 255.255.255.0
!
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!
interface Serial0/0
ip address 150.1.1.1 255.255.255.0
clockrate 2000000
!
ip classless
ip route 0.0.0.0 0.0.0.0 150.1.1.2
ip route 192.168.2.0 255.255.255.0 Tunnel1
!
end
VUNGTAU
Building configuration...
Current configuration : 1091 bytes
!
hostname VUNGTAU
!
interface Tunnel1
ip address 10.1.1.2 255.255.255.0
tunnel source Serial0/0
tunnel destination 150.1.1.1
!
interface Loopback0
ip address 192.168.2.1 255.255.255.0
!
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!
interface Serial0/0
ip address 151.1.1.1 255.255.255.0
clockrate 2000000
!
!
ip classless
ip route 0.0.0.0 0.0.0.0 151.1.1.2
ip route 192.168.1.0 255.255.255.0 Tunnel1
!
end
ISP
Building configuration...
Current configuration : 980 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname ISP
!
interface Serial0/0
ip address 150.1.1.2 255.255.255.0
clockrate 2000000
!
interface Serial0/1
ip address 151.1.1.2 255.255.255.0
clockrate 2000000
!
ip classless
!
ip http server
no ip http secure-server
!
end
Kiểm tra bảng định tuyến
SAIGON#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 150.1.1.2 to network 0.0.0.0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Tunnel1
C 192.168.1.0/24 is directly connected, Loopback0
S 192.168.2.0/24 is directly connected, Tunnel1
150.1.0.0/24 is subnetted, 1 subnets
C 150.1.1.0 is directly connected, Serial0/0
S* 0.0.0.0/0 [1/0] via 150.1.1.2
Giao tiếp thành công giữa hai site
SAIGON#ping 192.168.2.1 source 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/81/152 ms
Cấu trúc gói tin khi được đóng gói
Hình 7.2
SAIGON#sh interfaces tunnel 1
Tunnel1 is up, line protocol is up
Hardware is Tunnel
Internet address is 10.1.1.1/24
MTU 1514 bytes, BW 9 Kbit, DLY 500000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation TUNNEL, loopback not set
Keepalive not set
Tunnel source 150.1.1.1 (Serial0/0), destination 151.1.1.1
Tunnel protocol/transport GRE/IP, key disabled, sequencing disabled
Tunnel TTL 255
Checksumming of packets disabled, fast tunneling enabled
Last input 00:12:54, output 00:12:54, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
5 packets input, 620 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
30 packets output, 3720 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 output buffer failures, 0 output buffers swapped out