配置GRE扩大网络跳数范围(RIP)示例

组网需求

  1. Router A、Router B、Router C、Router D之间部RIP路由协议实现互通,Router A到Router D只有1跳,Cost值为1
  2. Router A、Router D之间没有直连,可以建立GRE隧道实现

组网拓扑

配置GRE扩大网络跳数范围拓扑图

配置思路

  1. Router A、Router B、Router C 之间运行RIP协议,实现路由器之间互联互通,RIP进程为1
  2. Router A与Router C之间配置GRE隧道
  3. Router A、Router C、Router D 之间运行RIP协议,进程为2

配置命令

  1. 配置路由器基本功能以及各个接口IP地址

    • Router A配置

      1
      2
      3
      4
      sys
      sys Router A
      int g0/0/0
      ip add 20.1.1.1 30
  • Router B配置

    1
    2
    3
    4
    5
    6
    sys
    sys Router B
    int g0/0/0
    ip add 20.1.1.2
    int g0/0/1
    ip add 30.1.1.1 30
  • Router C配置

    1
    2
    3
    4
    5
    6
    sys
    sys Router C
    int g0/0/1
    ip add 30.1.1.2 30
    int g0/0/2
    ip add 40.1.1.1 30
  • Router D配置

    1
    2
    3
    4
    sys
    sys Router D
    int g0/0/2
    ip add 40.1.1.2 30
  1. 配置RIP协议,进程为1,实现Router A、Router B、Router C互通

    • Router A配置

      1
      2
      3
      4
      sys
      rip 1
      version 2
      network 20.0.0.0
  • Router B配置

    1
    2
    3
    4
    5
    sys
    rip 1
    version 2
    network 20.0.0.0
    network 30.0.0.0
  • Router C配置

    1
    2
    3
    4
    sys
    rip 1
    version 2
    network 30.0.0.0
  1. 配置Tunnel接口,隧道协议为GRE,配置接口IP、源地址、目的地址

    • Router A配置

      1
      2
      3
      4
      5
      6
      sys
      int tunnel 0/0/0
      ip add 10.1.1.1 30
      tunnel-protocol gre
      source 20.1.1.1
      destination 30.1.1.2
  • Router C配置

    1
    2
    3
    4
    5
    6
    sys
    int tunnel 0/0/0
    ip add 10.1.1.2 30
    tunnel-protocol gre
    source 30.1.1.2
    destination 20.1.1.1
  1. 配置RIP协议,进程为2,实现Router A、Router C、Router D互通

    • Router A配置

      1
      2
      3
      4
      sys
      rip 2
      version 2
      network 10.0.0.0
  • Router C配置

    1
    2
    3
    4
    5
    sys
    rip 2
    version 2
    network 10.0.0.0
    network 40.0.0.0
  • Router D配置

    1
    2
    3
    4
    sys
    rip 2
    version 2
    network 40.0.0.0

查看命令

  1. 查看Router A、Router B、Router C配置RIP协议后的路由表,进程为1

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    display ip routing-table 

    [Router A-rip-2]dis ip routing-table
    Route Flags: R - relay, D - download to fib
    ------------------------------------------------------------------------------
    Routing Tables: Public
    Destinations : 11 Routes : 11

    Destination/Mask Proto Pre Cost Flags NextHop Interface

    10.1.1.0/30 Direct 0 0 D 10.1.1.1 Tunnel0/0/0
    10.1.1.1/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
    10.1.1.3/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
    20.1.1.0/30 Direct 0 0 D 20.1.1.1 GigabitEthernet
    0/0/0
    20.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    0/0/0
    20.1.1.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    0/0/0
    30.1.1.0/30 RIP 100 1 D 20.1.1.2 GigabitEthernet
    0/0/0
    127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
    127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
  1. 查看GRE隧道的连通性

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    ping -a 10.1.1.1 10.1.1.2

    <Router A>ping -a 10.1.1.1 10.1.1.2
    PING 10.1.1.2: 56 data bytes, press CTRL_C to break
    Reply from 10.1.1.2: bytes=56 Sequence=1 ttl=255 time=30 ms
    Reply from 10.1.1.2: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 10.1.1.2: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 10.1.1.2: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 10.1.1.2: bytes=56 Sequence=5 ttl=255 time=30 ms

    --- 10.1.1.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/28/30 ms
  1. 查看Router A、Router C、Router D配置RIP协议,进程为2的路由表

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    display ip routing-table protocol rip

    <Router A>dis ip routing-table protocol rip
    Route Flags: R - relay, D - download to fib
    ------------------------------------------------------------------------------
    Public routing table : RIP
    Destinations : 2 Routes : 2

    RIP routing table status : <Active>
    Destinations : 2 Routes : 2

    Destination/Mask Proto Pre Cost Flags NextHop Interface

    30.1.1.0/30 RIP 100 1 D 20.1.1.2 GigabitEthernet
    0/0/0
    40.1.1.0/30 RIP 100 1 D 10.1.1.2 Tunnel0/0/0

    RIP routing table status : <Inactive>
    Destinations : 0 Routes : 0
  1. 测试到Router A到Router D的连通性与路径

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    ping 40.1.1.2

    <Router A>ping 40.1.1.2
    PING 40.1.1.2: 56 data bytes, press CTRL_C to break
    Reply from 40.1.1.2: bytes=56 Sequence=1 ttl=254 time=50 ms
    Reply from 40.1.1.2: bytes=56 Sequence=2 ttl=254 time=30 ms
    Reply from 40.1.1.2: bytes=56 Sequence=3 ttl=254 time=40 ms
    Reply from 40.1.1.2: bytes=56 Sequence=4 ttl=254 time=40 ms
    Reply from 40.1.1.2: bytes=56 Sequence=5 ttl=254 time=50 ms

    --- 40.1.1.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/42/50 ms

    tracert 40.1.1.2

    <Router A>tracert 40.1.1.2

    traceroute to 40.1.1.2(40.1.1.2), max hops: 30 ,packet length: 40,press CTRL_C
    to break

    1 10.1.1.2 30 ms 30 ms 20 ms

    2 40.1.1.2 30 ms 40 ms 40 ms
吴超 wechat
subscribe to my blog by scanning my public wechat account