RIP:Routing Information Protocol (路由信息协议)
优先选择跳数小的路由做为最优路由,16跳路由表示不可达,也称为毒化路由,设备从之前收到对应路由接口再次收到此路由,并且为16跳,便将本端对应路由表中取消掉。
工作原理:依靠定时器进行收检
实验一:static+rip
R1配置
sys
sysname R1
interface GigabitEthernet0/0/0
ip address 200.1.1.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.1.254 255.255.255.0
interface GigabitEthernet0/0/2
ip address 15.1.1.1 255.255.255.0
rip 1
version 2
network 192.168.1.0
network 15.0.0.0
network 200.1.1.0
ip route-static 192.168.2.0 255.255.255.0 200.1.1.2
#可以把静态路由优先级调高一些,目的是切换到RIP协议下工作:
ip route-static 192.168.2.0 255.255.255.0 200.1.1.2 preference 200
#当然上面一条你可以不做,但是还是要配置默认路由
R2配置
sys
sysname R2
interface GigabitEthernet0/0/0
ip address 200.1.1.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 201.1.1.1 255.255.255.0
ip route-static 192.168.1.0 255.255.255.0 200.1.1.1
ip route-static 192.168.2.0 255.255.255.0 201.1.1.2
R3配置
sys
sysname R3
interface GigabitEthernet0/0/0
ip address 201.1.1.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.2.254 255.255.255.0
interface GigabitEthernet0/0/2
ip address 35.1.1.2 255.255.255.0
rip 1
version 2
network 192.168.2.0
network 201.1.1.0
network 35.0.0.0
ip route-static 192.168.1.0 255.255.255.0 201.1.1.1
R5配置
sys
sysname R5
interface GigabitEthernet0/0/0
ip address 15.1.1.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 35.1.1.1 255.255.255.0
rip 1
version 2
network 15.0.0.0
network 35.0.0.0
实验二:static+ospf
基于第一个实验,使用undo rip 1清除之前的配置。只需要配置ospf的配置。
R1配置
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 15.1.1.0 0.0.0.255
network 192.168.1.0 0.0.0.255
R3配置
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 35.1.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
R5配置
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 15.1.1.0 0.0.0.255
network 35.1.1.0 0.0.0.255
测试
dis ospf peer drief
dis ospf lsdb
dis ospf lsdb router 1.1.1.1
dis ospf routing
#查询路由表
dis ip routing-table
dis ip routing-table protocol ospf
dis ip routing-table | include 192.168.2.0
#以上都是查看
#pc1上做
tracert 192.168.2.1
#结果是下面这四个
#1 192.168.1.254 31 ms 47 ms 47 ms
#2 *200.1.1.2 47 ms 47 ms
#3 *201.1.1.2 62 ms 78 ms
#4 *192.168.2.1 63 ms 94 ms