Java教程

网络安全学习--动态路由RIP

本文主要是介绍网络安全学习--动态路由RIP,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

动态路由

基于某种路由协议实现
特点:减少管理任务,占用了网络带宽

动态路由协议

路由器之间用来交换信息的语言

度量值

跳数、带宽、负载、时延、可靠性、成本

按路由执行的算法分类
  • 距离矢量路由协议
    • 依据从源网络到目标网络所经过的路由的个数选择路由
    • RIP、IGRP
  • 链路状态路由协议
    • 综合考虑从源网络到目标网络的各条路径情况选择路由
    • OSPF、IS-IS
RIP

距离-矢量路由选择协议
RIP的基本概念

  • 定期更新
  • 邻居
  • 广播更新(每隔30秒)
  • 全路由表更新

RIP度量值为跳数

  • 最大跳数为15跳,16跳不可达
    RIP更新时间
  • 每隔30秒发送路由更新消息,UDP520端口
    RIP路由更新消息
  • 发送整个路由表信息
    执行水平分割可以阻止路由环路的发生
  • 从一个接口学习到路由信息,不再从这个接口发送出去
  • 同时也能减少路由更新信息占用的链路带宽资源
RIP v1
router rip 
version 1
network 10.0.0.0
network 20.0.0.0
RIP v2
router rip 
version 2
no auto-summary
network 10.0.0.0
network 20.0.0.0
实验一

实验文件下载
在这里插入图片描述

#-----Router0配置
Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#
Router(config)#interface fa0/1
Router(config-if)#ip addr 10.1.1.254 255.255.255.0
Router(config-if)#no shutdown

Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

Router(config-if)#exit
Router(config)#interface fa0/0
Router(config-if)#ip addr 20.1.1.1 255.255.255.0
Router(config-if)#no shutdown

Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

Router(config-if)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.1.1.0/24 is directly connected, FastEthernet0/1
L       10.1.1.254/32 is directly connected, FastEthernet0/1
     20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       20.1.1.0/24 is directly connected, FastEthernet0/0
L       20.1.1.1/32 is directly connected, FastEthernet0/0

Router(config-if)#exit
Router(config)#router rip
Router(config-router)#version 2
Router(config-router)#network 10.0.0.0
Router(config-router)#network 20.0.0.0
Router(config-router)#no auto-summary 
Router(config-router)#exit
Router(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.1.1.0/24 is directly connected, FastEthernet0/1
L       10.1.1.254/32 is directly connected, FastEthernet0/1
     20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       20.1.1.0/24 is directly connected, FastEthernet0/0
L       20.1.1.1/32 is directly connected, FastEthernet0/0
R    30.0.0.0/8 [120/1] via 20.1.1.2, 00:00:17, FastEthernet0/0
R    40.0.0.0/8 [120/2] via 20.1.1.2, 00:00:11, FastEthernet0/0

#-----Router0配置
#-----Router1配置
Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface fa0/0
Router(config-if)#ip addr 20.1.1.2 255.255.255.0
Router(config-if)#no shutdown

Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

Router(config-if)#exit
Router(config)#interface fa0/1
Router(config-if)#ip addr 30.1.1.1 255.255.255.0
Router(config-if)#no shutdown

Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

Router(config-if)#router rip 
Router(config-router)#version 2
Router(config-router)#network 20.0.0.0
Router(config-router)#network 30.0.0.0
Router(config-router)#no auto-summary 
Router(config-router)#exit
Router(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       20.1.1.0/24 is directly connected, FastEthernet0/0
L       20.1.1.2/32 is directly connected, FastEthernet0/0
     30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       30.1.1.0/24 is directly connected, FastEthernet0/1
L       30.1.1.1/32 is directly connected, FastEthernet0/1

Router(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

R    10.0.0.0/8 [120/1] via 20.1.1.1, 00:00:20, FastEthernet0/0
     20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       20.1.1.0/24 is directly connected, FastEthernet0/0
L       20.1.1.2/32 is directly connected, FastEthernet0/0
     30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       30.1.1.0/24 is directly connected, FastEthernet0/1
L       30.1.1.1/32 is directly connected, FastEthernet0/1
R    40.0.0.0/8 [120/1] via 30.1.1.2, 00:00:12, FastEthernet0/1

Router(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

R    10.0.0.0/8 [120/1] via 20.1.1.1, 00:00:07, FastEthernet0/0
     20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       20.1.1.0/24 is directly connected, FastEthernet0/0
L       20.1.1.2/32 is directly connected, FastEthernet0/0
     30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       30.1.1.0/24 is directly connected, FastEthernet0/1
L       30.1.1.1/32 is directly connected, FastEthernet0/1
R    40.0.0.0/8 [120/1] via 30.1.1.2, 00:00:26, FastEthernet0/1

Router(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

R    10.0.0.0/8 [120/1] via 20.1.1.1, 00:00:08, FastEthernet0/0
     20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       20.1.1.0/24 is directly connected, FastEthernet0/0
L       20.1.1.2/32 is directly connected, FastEthernet0/0
     30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       30.1.1.0/24 is directly connected, FastEthernet0/1
L       30.1.1.1/32 is directly connected, FastEthernet0/1
R    40.0.0.0/8 [120/1] via 30.1.1.2, 00:00:01, FastEthernet0/1

Router(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

R    10.0.0.0/8 [120/1] via 20.1.1.1, 00:00:10, FastEthernet0/0
     20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       20.1.1.0/24 is directly connected, FastEthernet0/0
L       20.1.1.2/32 is directly connected, FastEthernet0/0
     30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       30.1.1.0/24 is directly connected, FastEthernet0/1
L       30.1.1.1/32 is directly connected, FastEthernet0/1
R    40.0.0.0/8 [120/1] via 30.1.1.2, 00:00:03, FastEthernet0/1

#-----Router1配置
#-----Router2配置
Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface fa0/1
Router(config-if)#ip addr 30.1.1.2 255.255.255.0
Router(config-if)#no shutdown

Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

Router(config-if)#exit
Router(config)#interface fa0/0
Router(config-if)#ip addr 40.1.1.254 255.255.255.0
Router(config-if)#no shutdown

Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

Router(config-if)#exit
Router(config)#router rip
Router(config-router)#version 2
Router(config-router)#network 30.0.0.0
Router(config-router)#network 40.0.0.0
Router(config-router)#no auto-summary 
Router(config-router)#exit
Router(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

R    10.0.0.0/8 [120/2] via 30.1.1.1, 00:00:03, FastEthernet0/1
R    20.0.0.0/8 [120/1] via 30.1.1.1, 00:00:03, FastEthernet0/1
     30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       30.1.1.0/24 is directly connected, FastEthernet0/1
L       30.1.1.2/32 is directly connected, FastEthernet0/1
     40.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       40.1.1.0/24 is directly connected, FastEthernet0/0
L       40.1.1.254/32 is directly connected, FastEthernet0/0


#-----Router2配置
#查看IP路由协议信息
Router(config)#do show ip protocols
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 2 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 2, receive 2
  Interface             Send  Recv  Triggered RIP  Key-chain
  FastEthernet0/1       2     2     
  FastEthernet0/0       2     2     
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
	10.0.0.0
	20.0.0.0
Passive Interface(s):
Routing Information Sources:
	Gateway         Distance      Last Update
	20.1.1.2             120      00:05:50
Distance: (default is 120)
这篇关于网络安全学习--动态路由RIP的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!