菱形组网***-GRE篇_第1张图片

菱形之GRE

OSPFIGP协议,保证PE1PE4互通,建立PE1PE4 GRE隧道。

interface Tunnel0/0/14                                                         

 ip address 10.1.4.1 255.255.255.0  (统一用10段的,可以借用)                                           

 tunnel-protocol gre                                                            

 keepalive period 20 (保证隧道的连通性,定时发送探测数据包,避免对端不可达造成数据丢失)                                                          

 source 100.1.2.1      (也可以用loopback地址)                                                      

 destination 100.2.4.2 

源地址和目的地址分别是物理接口的IP地址和隧道本身的IP地址不同,隧道协议是GRE,决定了隧道性质。

PE1的隧道接口pingPE4的隧道接口

[PE1]ping -a 10.1.4.1 10.1.4.2                                                 

  PING 10.1.4.2: 56  data bytes, press CTRL_C to break                         

    Reply from 10.1.4.2: bytes=56 Sequence=1 ttl=255 time=12 ms                

    Reply from 10.1.4.2: bytes=56 Sequence=2 ttl=255 time=16 ms

可以看到keepalive报文

[PE1-Tunnel0/0/14]display keepalive packets count                              

Send 2 keepalive packets to peers, Receive 2 keepalive response packets from pee

rs                                                                              

Receive 3 keepalive packets from peers, Send 3 keepalive response packets to pee

rs.

查看tunnel接口信息

[PE1]dis interface Tunnel 0/0/14                                               

Tunnel0/0/14 current state : UP                                                 

Line protocol current state : UP                                               

Last line protocol up time : 2015-12-07 16:07                               

Description:HUAWEI, Tunnel0/0/14 Interface                                      

Route Port,The Maximum Transmit Unit(L3) is 1500 bytes                          

Internet Address is 10.1.4.1/24                                                

Encapsulation is TUNNEL, loopback not set                                      

Tunnel source 100.1.2.1 (GigabitEthernet0/2/5), destination 100.2.4.2          

Tunnel protocol/transport GRE/IP, key disabled                                 

keepalive enable period 20 retry-times 3                                       

Checksumming of packets disabled                                               

Current system time: 2015-12-07 16:07                                       

    20 seconds input rate 48 bits/sec, 0 packets/sec                           

    20 seconds output rate 16 bits/sec, 0 packets/sec                          

    0 seconds input rate 0 bits/sec, 0 packets/sec                             

    0 seconds output rate 0 bits/sec, 0 packets/sec                            

    63 packets input,  4616 bytes                                              

    0 input error                                                              

    37 packets output,  2076 bytes                                             

    0 output error                                                             

    Input:                                                                     

      Unicast: 58 packets, Multicast: 0 packets                                

    Output:                                                                     

      Unicast: 5 packets, Multicast: 0 packets                                 

    Input bandwidth utilization  :    0%                                       

    Output bandwidth utilization :    0% 

 

[PE1]dis ip routing-table                                                      

Route Flags: R - relay, D - download to fib                                    

------------------------------------------------------------------------------ 

Routing Tables: Public                                                         

         Destinations : 23       Routes : 23                                   

                                                                                

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface     

       10.1.4.0/24  Direct  0    0           D   10.1.4.1        Tunnel0/0/14  

       10.1.4.1/32  Direct  0    0           D   127.0.0.1       Tunnel0/0/14  

     10.1.4.255/32  Direct  0    0           D   127.0.0.1       Tunnel0/0/14