配置RIP基本功能示例
介绍RIP基本功能的配置过程,包括在各设备上使能RIP、配置版本。
数据准备
为完成此配置例,需准备如下的数据:
在DeviceA上指定使能RIP的网段192.168.1.0
在DeviceB上指定使能RIP的网段192.168.1.0,172.16.0.0,10.0.0.0
在DeviceC上指定使能RIP的网段172.16.0.0
在DeviceD上指定使能RIP的网段10.0.0.0
在DeviceA、DeviceB、DeviceC和DeviceD上配置RIP-2版本
操作步骤
- 配置各接口的IP地址。(略)
- 配置RIP进程引入静态路由。(略)
- 配置使能RIP的网段。
# 配置DeviceA。
[~DeviceA] rip
[*DeviceA-rip-1] network 192.168.1.0
[*DeviceA-rip-1] commit
[~DeviceA-rip-1] quit
# 配置DeviceB。
[~DeviceB] rip
[*DeviceB-rip-1] network 192.168.1.0
[*DeviceB-rip-1] network 172.16.0.0
[*DeviceB-rip-1] network 10.0.0.0
[*DeviceB-rip-1] commit
[~DeviceB-rip-1] quit
# 配置DeviceC。
[~DeviceC] rip
[*DeviceC-rip-1] network 172.16.0.0
[*DeviceC-rip-1] commit
[~DeviceC-rip-1] quit
# 配置DeviceD。
[~DeviceD] rip
[*DeviceD-rip-1] network 10.0.0.0
[*DeviceD-rip-1] commit
[~DeviceD-rip-1] quit
# 查看DeviceA的RIP路由表。
[~DeviceA] display rip 1 route
Route Flags: R - RIP, T - TRIP
P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect
-------------------------------------------------------------------------
Peer 192.168.1.2 on GigabitEthernet0/1/0
Destination/Mask Nexthop Cost Tag Flags Sec
10.0.0.0/8 192.168.1.2 1 0 RA 14
172.16.0.0/16 192.168.1.2 1 0 RA 14
192.168.1.0/24 192.168.1.2 1 0 RA 14
从路由表中可以看出,RIP-1发布的路由使用的是自然掩码。
- 配置RIP的版本号。
# 在DeviceA上配置RIP-2。
[~DeviceA] rip
[~DeviceA-rip-1] version 2
[*DeviceA-rip-1] commit
[~DeviceA-rip-1] quit
# 在DeviceB上配置RIP-2。
[~DeviceB] rip
[~DeviceB-rip-1] version 2
[*DeviceB-rip-1] commit
[~DeviceB-rip-1] quit
# 在DeviceC上配置RIP-2。
[~DeviceC] rip
[~DeviceC-rip-1] version 2
[*DeviceC-rip-1] commit
[~DeviceC-rip-1] quit
# 在DeviceD上配置RIP-2。
[~DeviceD] rip
[~DeviceD-rip-1] version 2
[*DeviceD-rip-1] commit
[~DeviceD-rip-1] quit
- 验证配置结果。
# 查看DeviceA的RIP路由表。
[~DeviceA] display rip 1 route
Route Flags: R - RIP
A - Aging, S - Suppressed, G - Garbage-collect
-------------------------------------------------------------------------
Peer 192.168.1.2 on GigabitEthernet0/1/0
Destination/Mask Nexthop Cost Tag Flags Sec
10.1.1.0/24 192.168.1.2 1 0 RA 32
172.16.1.0/24 192.168.1.2 1 0 RA 32
192.168.1.0/24 192.168.1.2 1 0 RA 14
从路由表中可以看出,RIP-2发布的路由中带有更为精确的子网掩码信息。
配置文件
DeviceA的配置文件
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
#
rip 1
version 2
network 192.168.1.0
#
return
DeviceB的配置文件
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
rip 1
version 2
network 10.0.0.0
network 172.16.0.0
network 192.168.1.0
#
return
DeviceC的配置文件
#
sysname DeviceC
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.16.1.2 255.255.255.0
#
rip 1
version 2
network 172.16.0.0
#
return
DeviceD的配置文件
#
sysname DeviceD
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
rip 1
version 2
network 10.0.0.0
#
return