动态路由特点:
1、减少了管理任务
2、占用了网络带宽
动态路由协议概述
动态路由是路由器之间用来交换信息的语言,通常以度量值来衡量。度量值包括:条数,带宽,负载,时延,可靠性,成本。路由器会通过度量值来确定最优路由路径。
收敛:整个网络中所有路由表都达到一致状态的过程
静态路由与动态路由的比较,网络中静态路由和动态路由互相补充,静态路由配置麻烦,动态路由配置简单,占用带宽。
按照路由执行的算法分类
距离矢量路由协议:依据从源网络到目标网络所经过的路由器的个数选择路由;包括RIP
链路状态路由协议:综合考虑从源网络到目标网络的各条路径的情况选择路由;包括OSPF、IS-IS
RIP协议
RIP是距离矢量路由选择协议
RIP的基本概念:1、定期更新,2、邻居(邻接路由器),3、广播更新(或者组播更新),4、全路由表更新
路由器先学习到自己的直连路由,更新周期到30S的时候,路由器会广播或者组播的方式以整表发送给相邻的路由器,
路由器会学习到自己路由表中没有的路由路径,再经过30S的更新周期时候继续发送整表给相邻的路由器,直到网络中所有的
路由器都学习到了整个路由表,这样就达到了抑制状态。
RIP度量值为跳数,最大跳数为15跳,16跳为不可达
RIP的更新时间:每隔30s发送路由更新消息,使用UDP520端口
RIP v1 和V2的区别
V1:有类路由协议、广播更新(255.255.255.255)、不支持VLSM、自动路由汇总,不可关闭、不支持不连续的子网
V2:无类路由协议、组播更新(224.0.0.9)、支持VLSM、自动汇总可关闭,可手工汇总、支持不连续子网
RIP的配置
rip 1
//启动RIP
version 2
//启动版本2(缺省为版本1)
undo sunnary
//关闭路由自动聚合(即所有路由信息都会按照IP地址分类归类)
network 192.168.10.0
//宣告主网络号,V2会携带掩码组播更新224.0.0.9,V1不携带掩码,广播更新255.255.255.255
SW3的配置:
<Huawei>
<Huawei>sys
[Huawei]sys SW3
[SW3]un in en
[SW3]user-i co 0
[SW3-ui-console0]idle 0 0
[SW3-ui-console0]q
[SW3]vlan b 10 20
[SW3]int vlanif 10
[SW3-Vlanif10]ip add 192.168.10.1 24 ==//三层交换机在VLANIF上设置IP==
[SW3-Vlanif10]int vlanif 20
[SW3-Vlanif20]ip add 12.0.0.1 24
[SW3-Vlanif20]un sh
[SW3-Vlanif20]q
[SW3]rip 1
[SW3-rip-1]vers 2
[SW3-rip-1]un su
[SW3-rip-1]net 45.0.0.0
[SW3-rip-1]net 192.168.20.0
[SW3-rip-1]q
[SW3]int g0/0/2
[SW3-GigabitEthernet0/0/2]p l a
[SW3-GigabitEthernet0/0/2]p d v 10
[SW3-GigabitEthernet0/0/2]un sh
[SW3-GigabitEthernet0/0/2]dis th
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
#
return
[SW3-GigabitEthernet0/0/1]q
[SW3]int g0/0/1
[SW3-GigabitEthernet0/0/1]p l a
[SW3-GigabitEthernet0/0/1]p d v 20
[SW3-GigabitEthernet0/0/1]un sh
[SW3-GigabitEthernet0/0/1q
[SW3]
SW2的配置:
<Huawei>sys
[Huawei]sys SW2
[SW2]un in en
[SW2]user-i co 0
[SW2-ui-console0]idle 0 0
[SW2-ui-console0]q
[SW2]v b 10 20
[SW2]int vlanif 10
[SW2-Vlanif10]ip add 192.168.10.1 24
[SW2-Vlanif10]un sh
[SW2-Vlanif10]int vlanif 20
[SW2-Vlanif20]ip add 12.0.0.1 24
[SW2-Vlanif20]un sh
[SW2-Vlanif20]q
[SW2]rip 1
[SW2-rip-1]vers 2
[SW2-rip-1]un su
[SW2-rip-1]net 12.0.0.0
[SW2-rip-1]net 129.168.10.0
[SW2-rip-1]q
Interface IP Address/Mask Physical Protocol
MEth0/0/1 unassigned down down
NULL0 unassigned up up(s)
Vlanif1 unassigned up down
Vlanif10 192.168.10.1/24 down down
Vlanif20 12.0.0.1/24 down down
[SW2]rip 1
[SW2-rip-1]ver
[SW2-rip-1]verify-source
[SW2-rip-1]version 2
[SW2-rip-1]net 12.0.0.0
[SW2-rip-1]net 192.168.10.0
[SW2-rip-1]q
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]p l a
[SW2-GigabitEthernet0/0/1]p d v 10
[SW2-GigabitEthernet0/0/1]un sh
[SW2-GigabitEthernet0/0/1]q
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]p l a
[SW2-GigabitEthernet0/0/2]p d v 20
[SW2-GigabitEthernet0/0/2]un sh
[SW2-GigabitEthernet0/0/2]dis th
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
#
return
[SW2-GigabitEthernet0/0/2]q
[SW2]
R1的配置:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 23.0.0.2 24
[R1-GigabitEthernet0/0/0]un sh
[R1-GigabitEthernet0/0/0]q
[R1]un in en
[R1]user-i co 0
[R1-ui-console0]idle 0 0
[R1-ui-console0]q
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 12.0.0.2 24
[R1-GigabitEthernet0/0/2]un sh
[R1-GigabitEthernet0/0/2]q
[R1]rip 1 ==//启动RIP==
[R1-rip-1]vers 2 ==//版本2==
[R1-rip-1]un summary ==//关闭路由自动聚合(即所有路由信息都会按照IP地址分类归类)==
[R1-rip-1]net 12.0.0.0 ==//宣告网段==
[R1-rip-1]net 23.0.0.0
[R1-rip-1]q
[R1]
R2的配置:
<Huawei>sys
[Huawei]sys R2
[R2]un in en
[R2]user-i co 0
[R2-ui-console0]idle 0 0
[R2-ui-console0]q
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 23.0.0.3 24
[R2-GigabitEthernet0/0/0]un sh
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 34.0.0.3 24
[R2-GigabitEthernet0/0/1]un sh
[R2-GigabitEthernet0/0/1]q
[R2]rip 1
[R2-rip-1]vers 2
[R2-rip-1]un summary
[R2-rip-1]net 23.0.0.0
[R2-rip-1]net 34.0.0.0
[R2-rip-1]q
[R2]
R3的配置:
<Huawei>sys
[Huawei]sys R3
[R3]un in en
Info: Information center is disabled.
[R3]user-i co 0
[R3-ui-console0]idle 0 0
[R3-ui-console0]q
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 34.0.0.4 24
[R3-GigabitEthernet0/0/1]un sh
[R3-GigabitEthernet0/0/1]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 45.0.0.4 24
[R3-GigabitEthernet0/0/0]un sh
[R3-GigabitEthernet0/0/0]q
[R3]rip 1
[R3-rip-1]
[R3-rip-1]vers 2
[R3-rip-1]un summary
[R3-rip-1]net 34.0.0.0
[R3-rip-1]net 45.0.0.0
[R3-rip-1]q
[R3]