6-21 RIP协议配置实验

image-20240316220802475

实验拓扑图如图所示,

  • 路由器R1的GE0/0/0口的地址为12.1.1.1/24,路由器R2的GE0/0/0口的地址为12.1.1.2/24

  • 路由器R1存在以下2个环回口地址

    • 10.1.1.1/24

    • 10.1.2.1/24

  • 路由器R1存在以下2个环回口地址

    • 10.1.100.1/24

    • 10.1.200.1/24

实验目的:通过RIP协议配置,使得2个路由器学习到对方的环回路由信息

实验过程

配置R1 R2地址

配置R1地址

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
27
28
29
30
31
32
33
34
35
36
37
38
[Huawei]sysname R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1/24 # 注意这里不能写成/形式,IP和掩码要分开写
^
Error: Wrong parameter found at '^' position.
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
Mar 16 2024 22:04:13-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.

[R1-GigabitEthernet0/0/0]interface lo0
[R1-LoopBack0]ip address 10.1.1.0 24 # 10.1.1.0是一个网段地址,不能分配给设备或接口使用,是无效地址
Error: The specified IP address is invalid.
[R1-LoopBack0]ip add 10.1.1.1 24
[R1-LoopBack0]lo1
^
Error: Unrecognized command found at '^' position.

[R1]interface lo1
[R1-LoopBack1]ip add 10.1.2.1 24
[R1-LoopBack1]q

[R1]dis ip int brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.1.1.1/24 up up
GigabitEthernet0/0/1 unassigned down down
LoopBack0 10.1.1.1/24 up up(s)
LoopBack1 10.1.2.1/24 up up(s)
NULL0 unassigned up up(s)

配置R2地址

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
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
Mar 16 2024 22:12:38-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.

[R2-GigabitEthernet0/0/0]int lo0
[R2-LoopBack0]ip add 10.1.100.1 24

[R2-LoopBack0]int lo1
[R2-LoopBack1]ip add 10.1.200.1 24
[R2-LoopBack1]dis ip int brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.1.1.2/24 up up
GigabitEthernet0/0/1 unassigned down down
LoopBack0 10.1.100.1/24 up up(s)
LoopBack1 10.1.200.1/24 up up(s)
NULL0 unassigned up up(s)

查看R1 R2路由表

查看R1路由表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[R1]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13

Destination/Mask Proto Pre Cost Flags NextHop Interface

10.1.1.0/24 Direct 0 0 D 10.1.1.1 LoopBack0
10.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.2.0/24 Direct 0 0 D 10.1.2.1 LoopBack1
10.1.2.1/32 Direct 0 0 D 127.0.0.1 LoopBack1
10.1.2.255/32 Direct 0 0 D 127.0.0.1 LoopBack1
12.1.1.0/24 Direct 0 0 D 12.1.1.1 GigabitEthernet
0/0/0
12.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.1.1.255/32 Direct 0 0 D 127.0.0.1 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

R1尝试pingR2的环回路由ping 10.1.100.1不通,因为没有能够到达的路由

1
2
3
4
5
6
7
8
9
10
11
12
[R1]ping 10.1.100.1
PING 10.1.100.1: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out

--- 10.1.100.1 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss

配置R1 R2的RIP协议

R1配置RIP协议

配置前注意事项:

  • 宣告:RIP协议的宣告通常指的是路由器通过RIP协议将自己的路由信息发送给其他路由器的过程,以此来告知其他路由器如何到达特定的网络。(笔者注:理解network 10.0.0.0表示向相邻路由器说:我这能到10.0.0.0网络)

  • 默认的RIP协议为RIPv1,其宣告和路由更新信息仅支持分类/定长子网掩码划分网络,因此RIP学到的

  • 对于RIPv2,其宣告仅支持分类/定长子网掩码划分网络,但路由更新时会交互非主类网络路由

1
2
3
[R1]rip
[R1-rip-1]network 12.0.0.0 # 宣告直连网络,且RIPv1仅支持分类/定长子网掩码划分网络
[R1-rip-1]network 10.0.0.0 # 宣告环回网络,前面配置的2个环回网络都能够广播出去

R2配置RIP协议

1
2
3
[R2]rip 
[R2-rip-1]network 12.0.0.0
[R2-rip-1]network 10.0.0.0

再次查看R1 R2路由表

显示R1路由表

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
[R1]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 14 Routes : 14

Destination/Mask Proto Pre Cost Flags NextHop Interface

10.0.0.0/8 RIP 100 1 D 12.1.1.2 GigabitEthernet0/0/0 # 此条路由即为RIP学习到的,能够到达R1的环回口
10.1.1.0/24 Direct 0 0 D 10.1.1.1 LoopBack0
10.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.2.0/24 Direct 0 0 D 10.1.2.1 LoopBack1
10.1.2.1/32 Direct 0 0 D 127.0.0.1 LoopBack1
10.1.2.255/32 Direct 0 0 D 127.0.0.1 LoopBack1
12.1.1.0/24 Direct 0 0 D 12.1.1.1 GigabitEthernet
0/0/0
12.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.1.1.255/32 Direct 0 0 D 127.0.0.1 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

显示R2路由表

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
[R2-rip-1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 14 Routes : 14

Destination/Mask Proto Pre Cost Flags NextHop Interface

10.0.0.0/8 RIP 100 1 D 12.1.1.1 GigabitEthernet0/0/0 # 此条路由即为RIP学习到的,能够到达R1的环回口
10.1.100.0/24 Direct 0 0 D 10.1.100.1 LoopBack0
10.1.100.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.100.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.200.0/24 Direct 0 0 D 10.1.200.1 LoopBack1
10.1.200.1/32 Direct 0 0 D 127.0.0.1 LoopBack1
10.1.200.255/32 Direct 0 0 D 127.0.0.1 LoopBack1
12.1.1.0/24 Direct 0 0 D 12.1.1.2 GigabitEthernet
0/0/0
12.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.1.1.255/32 Direct 0 0 D 127.0.0.1 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

测试RIP是否生效

ping对方环回口测试

1
2
3
4
5
6
7
8
9
10
11
12
13
[R1]ping 10.1.100.1
PING 10.1.100.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.100.1: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 10.1.100.1: bytes=56 Sequence=2 ttl=255 time=10 ms
Reply from 10.1.100.1: bytes=56 Sequence=3 ttl=255 time=10 ms
Reply from 10.1.100.1: bytes=56 Sequence=4 ttl=255 time=10 ms
Reply from 10.1.100.1: bytes=56 Sequence=5 ttl=255 time=20 ms

--- 10.1.100.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/18/40 ms

tracert测试

1
2
3
4
5
6
7
[R1]tracert 10.1.100.1

traceroute to 10.1.100.1(10.1.100.1), max hops: 30 ,packet length: 40,press CT
RL_C to break

1 12.1.1.2 20 ms 20 ms 20 ms # 可见连接至10.1.100.1,经过了1跳,该跳为12.1.1.2

上述测试可见RIP生效

RIP基本配置过程

  1. 启动RIP
  2. 宣告网络

抓包分析RIP交互信息

在R1的GE0/0/0接口处点击抓包

image-20240316224333134

抓包结果

image-20240316224712240

展开可见RIP协议交互的内容为路由信息

image-20240316224926992

若将RIP版本改为RIPv2,如下命令

1
2
3
[R1-rip-1]version ?
INTEGER<1-2> Version of RIP process
[R1-rip-1]version 2

抓包分析,可见RIPv2的广播包变成了组播包

image-20240316225210866

站内搜索

没有找到内容!