交换
路由
 -路由器
-多层交换机
  -核心工作表:
      路由表
         -路由条目
              类型   prefix/mask   [AD/Metric] via next-hop , interface 
             Conneted
              Static
              RIP

路由类型:
直连路由
非直连
   静态
   动态
     IGP:Internal gateway protocol ,内部网关协议
        目的: 
            在内网,快速,计算出一个去往目标网络的,无环,最短,
            数据转发路径;
        DV-distance vector ,距离矢量路由协议
           RIP 
           IGRP
           EIGRP
        LS-link state ,链路状态路由协议
           ISIS
           OSPF
     EGP: external gateway protocol ,外部网关协议
        目的: 
           在网络之间,通过BGP实现路由的灵活控制和选路,同时确保
           无环;
           BGP

   RIP 协议配置命令:

 1、配置终端设备 - PC1/2 

   2、配置网络设备
  R1/R2/R3/R4
    router rip  // 启用路由协议 RIP 
       version 2  // 配置路由器使用 RIP 版本2
       no auto-summary // 关闭 RIP 协议的自动汇总
       network 192.168.10.0 
       network 192.168.12.0  // 以上两个network表示的是
                                宣告网络 192.168.10.0
                                         192.168.12.0 进入 RIP 协议;                                    

 3、验证、测试、保存
    show ip protocols //显示当前设备上正在使用的所有路由协议

    show ip route // 显示路由表

    PC1/2:
       ping 192.168.20.1 

    R1/R2/R3/R4 : 
       Route#write

 在IGP协议中, network 的作用:
# network  10.0.0.0 , 10.0.0.0 表示的是一个“网络范围”
      &在设备上凡是被 10.0.0.0 表示的范围所覆盖住的接口,都启用
       路由协议进程:
           1、可以在该端口上发送协议报文;
           2、可以在该端口上接收协议报文;
           3、可以将该端口上的IP地址中的网络部分,放入协议报文中;

    interface gi0/1 -> 192.168.34.4 255.255.255.0
    interface gi0/2 -> 192.168.20.254 255.255.255.0
    interface loopback 0 -> 10.10.4.4 255.255.255.0
            #发包
            #收包
            #10.10.4.0/24 --> RIP --> 发出去;
router rip 
   network 10.10.4.0 255.255.255.0

==================================================================

  RIP
  -定义:
    routing information protocol , 路由信息协议
    在内网的多个路由器之间自动的学习、同步路由表,
    以计算出一个去往目标网络的最短、无环、数据转发路径;
 -场景:
    一般在小规模的企业内部网络使用
    (因为RIP有最大跳数限制,最大为 16 跳)
 -版本: 
    version 1
         #属于有类路由选择协议(报文不携带子网掩码)
         #广播的发送方式 - 255.255.255.255
         #无法关闭自动汇总
    version 2 
         #属于无类路由选择协议(报文携带子网掩码)      
         #组播的发送方式 - 224.0.0.9
         #多了一个路由标记(tag)字段,可以实现路由的批量管理;
         #多了一个认证功能(使用的是RIP respone报文的第一个路由条目来充当)
         #多了一个 mask 字段,从而可以支持关闭自动汇总;
         #多了一个 next-hop 字段,从而可以解决“MA网络中的”次优路径问题;

-报文:
    request:请求,用于向其他RIP路由器请求更新条目;
    respone:响应,用于向其他RIP路由器发送更新条目;是对request的回应
-工作表:
    (RIP邻居表):
           #凡是能与自己互通的路由器,都称之为 RIP 邻居;
    RIP数据库:
           #本地宣告的路由条目
           #从其他路由器学习过来的路由条目
    RIP路由表:
           #表示的是从数据库中挑选出来的最好的路由;        
 -原理:
    1、路由器启用RIP以后,会将自己本地路由表中的条目进行宣告进入到RIP
    2、在启动RIP协议的端口上发送这些更新条目;
    3、对方RIP路由器接收以后,经过路由比较,将最好的条目放入路由表;
    4、所有的RIP路由器都会进行周期性、全部路由表更新,以广播的方式;
        (在RIPv2中,是触发式、增量更新,并且是以组播的方式)       
  -配置
   目前网络中凡是使用 RIP 的网络,均使用的 RIPv2 ;
#思科
router rip 
   version 2
   no auto-summary 
   network x.x.x.x (x.x.x.x必须是主类网络的形式)
#华为
[Router]rip [id] // 如果不写后面的id,默认是1;
[Router-rip-1]version 2 // 在华为中,启用RIPv2以后,默认关闭了自动汇总;
[Router-rip-1]network x.x.x.x 
  -验证 
   show ip protocols //查看目前正在运行的所有的路由协议;
   show ip rip database // 查看RIP的数据库
   show ip route rip //仅仅查看路由表中的 RIP 路由;
   show ip route      //查看路由表;

   display rip [id]
   display rip {id} neighbor // 查看 rip id 的 邻居表;
   display rip {id} database // 查看 rip id 的 数据库;
   display rip {id} route // 查看 rip id 的路由表;
   display ip routing-table





案例:




1 案例1:RIP路由协议原理
 1.1 问题
1)动态路由协议的分类有哪些?

2)RIP路由协议的最大跳数是什么?

  3)简述水平分割的作用

   1.2 步骤
实现此案例需要按照如下步骤进行。

 内部和外部网关协议
内部网关路由协议(IGP):RIP、OSPF、IS-IS
外部网关路由协议(EGP):BGP
距离矢量和链路状态路由协议
距离矢量路由协议:依据从源网络到目标网络所经过的路由器的个数选择路由,例如RIP、IGRP

 链路状态路由协议:综合考虑从源网络到目标网络的各条路径的情况选择路由,例如OSPF、IS-IS

从一个接口学习到路由信息,不再从这个接口发送出去
  同时也能减少路由更新信息占用的链路带宽资源
   2 案例2:配置RIP路由协议
  2.1 问题
 1)配置RIP协议实现网络互通

 2)查看路由表,验证网络和RIP协议正常

2.2 方案
使用eNSP搭建实验环境,如图-1所示。

2.3 步骤
实现此案例需要按照如下步骤进行。

  步骤一:配置RIP路由协议

[R1]dis cu [V200R003C00]

sysname R1

snmp-agent local-engineid 800007DB03000000000000 snmp-agent

clock timezone China-Standard-Time minus 08:00:00

portal local-server load portalpage.zip

drop illegal-mac alarm

set cpu-usage threshold 80 restore 75

aaa authentication-scheme default authorization-scheme default accounting-scheme default domain default domain default_admin local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http

firewall zone Local priority 15

interface GigabitEthernet0/0/0 ip address 192.168.12.1 255.255.255.0

interface GigabitEthernet0/0/1 ip address 192.168.13.1 255.255.255.0

interface GigabitEthernet0/0/2

interface NULL0

interface LoopBack0 ip address 192.168.10.1 255.255.255.0

rip 1 network 192.168.12.0 network 192.168.13.0 network 192.168.10.0

user-interface con 0 authentication-mode password user-interface vty 0 4 user-interface vty 16 20

wlan ac

return [R2]dis cu [V200R003C00]

sysname R2

snmp-agent local-engineid 800007DB03000000000000 snmp-agent

clock timezone China-Standard-Time minus 08:00:00

portal local-server load portalpage.zip

drop illegal-mac alarm

set cpu-usage threshold 80 restore 75

aaa authentication-scheme default authorization-scheme default accounting-scheme default domain default domain default_admin local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http

firewall zone Local priority 15

interface GigabitEthernet0/0/0 ip address 192.168.12.2 255.255.255.0

interface GigabitEthernet0/0/1 ip address 192.168.24.2 255.255.255.0

interface GigabitEthernet0/0/2 ip address 192.168.23.2 255.255.255.0

interface NULL0

interface LoopBack0 ip address 192.168.20.1 255.255.255.0

rip 1 network 192.168.12.0 network 192.168.23.0 network 192.168.24.0 network 192.168.20.0

user-interface con 0 authentication-mode password user-interface vty 0 4 user-interface vty 16 20

wlan ac

return [R3]dis cu [V200R003C00]

sysname R3

snmp-agent local-engineid 800007DB03000000000000 snmp-agent

clock timezone China-Standard-Time minus 08:00:00

portal local-server load portalpage.zip

drop illegal-mac alarm

set cpu-usage threshold 80 restore 75

aaa authentication-scheme default authorization-scheme default accounting-scheme default domain default domain default_admin local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http

firewall zone Local priority 15

interface GigabitEthernet0/0/0

interface GigabitEthernet0/0/1 ip address 192.168.13.3 255.255.255.0

interface GigabitEthernet0/0/2 ip address 192.168.23.3 255.255.255.0

interface NULL0

interface LoopBack0 ip address 192.168.30.1 255.255.255.0

rip 1 network 192.168.13.0 network 192.168.23.0 network 192.168.30.0

user-interface con 0 authentication-mode password user-interface vty 0 4 user-interface vty 16 20

wlan ac

return [R4]dis cu [V200R003C00]

sysname R4

snmp-agent local-engineid 800007DB03000000000000 snmp-agent

clock timezone China-Standard-Time minus 08:00:00

portal local-server load portalpage.zip

drop illegal-mac alarm

set cpu-usage threshold 80 restore 75

aaa authentication-scheme default authorization-scheme default accounting-scheme default domain default domain default_admin local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http

firewall zone Local priority 15

interface GigabitEthernet0/0/0

interface GigabitEthernet0/0/1 ip address 192.168.24.4 255.255.255.0

interface GigabitEthernet0/0/2

interface NULL0

interface LoopBack0 ip address 192.168.40.1 255.255.255.0

rip 1 network 192.168.24.0 network 192.168.40.0

user-interface con 0 authentication-mode password user-interface vty 0 4 user-interface vty 16 20

wlan ac

return 步骤二:查看路由表,验证全网互通

[R1]dis ip ro Route Flags: R - relay, D - download to fib

Routing Tables: Public Destinations : 18 Routes : 19
Destination/Mask Proto Pre Cost Flags NextHop Interface 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 192.168.10.0/24 Direct 0 0 D 192.168.10.1 LoopBack0 192.168.10.1/32 Direct 0 0 D 127.0.0.1 LoopBack0 192.168.10.255/32 Direct 0 0 D 127.0.0.1 LoopBack0 192.168.12.0/24 Direct 0 0 D 192.168.12.1 GigabitEthernet 0/0/0 192.168.12.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.12.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.13.0/24 Direct 0 0 D 192.168.13.1 GigabitEthernet 0/0/1 192.168.13.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.20.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet 0/0/0 192.168.23.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet 0/0/0 RIP 100 1 D 192.168.13.3 GigabitEthernet 0/0/1 192.168.24.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet 0/0/0 192.168.30.0/24 RIP 100 1 D 192.168.13.3 GigabitEthernet 0/0/1 192.168.40.0/24 RIP 100 2 D 192.168.12.2 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 [R2]dis ip ro Route Flags: R - relay, D - download to fib

Routing Tables: Public Destinations : 20 Routes : 21
Destination/Mask Proto Pre Cost Flags NextHop Interface 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 192.168.10.0/24 RIP 100 1 D 192.168.12.1 GigabitEthernet 0/0/0 192.168.12.0/24 Direct 0 0 D 192.168.12.2 GigabitEthernet 0/0/0 192.168.12.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.12.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.13.0/24 RIP 100 1 D 192.168.12.1 GigabitEthernet 0/0/0 RIP 100 1 D 192.168.23.3 GigabitEthernet 0/0/2 192.168.20.0/24 Direct 0 0 D 192.168.20.1 LoopBack0 192.168.20.1/32 Direct 0 0 D 127.0.0.1 LoopBack0 192.168.20.255/32 Direct 0 0 D 127.0.0.1 LoopBack0 192.168.23.0/24 Direct 0 0 D 192.168.23.2 GigabitEthernet 0/0/2 192.168.23.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 192.168.23.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 192.168.24.0/24 Direct 0 0 D 192.168.24.2 GigabitEthernet 0/0/1 192.168.24.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.24.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.30.0/24 RIP 100 1 D 192.168.23.3 GigabitEthernet 0/0/2 192.168.40.0/24 RIP 100 1 D 192.168.24.4 GigabitEthernet 0/0/1 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 [R3]dis ip ro Route Flags: R - relay, D - download to fib

Routing Tables: Public Destinations : 18 Routes : 19
Destination/Mask Proto Pre Cost Flags NextHop Interface 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 192.168.10.0/24 RIP 100 1 D 192.168.13.1 GigabitEthernet 0/0/1 192.168.12.0/24 RIP 100 1 D 192.168.13.1 GigabitEthernet 0/0/1 RIP 100 1 D 192.168.23.2 GigabitEthernet 0/0/2 192.168.13.0/24 Direct 0 0 D 192.168.13.3 GigabitEthernet 0/0/1 192.168.13.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.20.0/24 RIP 100 1 D 192.168.23.2 GigabitEthernet 0/0/2 192.168.23.0/24 Direct 0 0 D 192.168.23.3 GigabitEthernet 0/0/2 192.168.23.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 192.168.23.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 192.168.24.0/24 RIP 100 1 D 192.168.23.2 GigabitEthernet 0/0/2 192.168.30.0/24 Direct 0 0 D 192.168.30.1 LoopBack0 192.168.30.1/32 Direct 0 0 D 127.0.0.1 LoopBack0 192.168.30.255/32 Direct 0 0 D 127.0.0.1 LoopBack0 192.168.40.0/24 RIP 100 2 D 192.168.23.2 GigabitEthernet 0/0/2 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 [R4]dis ip ro Route Flags: R - relay, D - download to fib

Routing Tables: Public Destinations : 16 Routes : 16
Destination/Mask Proto Pre Cost Flags NextHop Interface 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 192.168.10.0/24 RIP 100 2 D 192.168.24.2 GigabitEthernet 0/0/1 192.168.12.0/24 RIP 100 1 D 192.168.24.2 GigabitEthernet 0/0/1 192.168.13.0/24 RIP 100 2 D 192.168.24.2 GigabitEthernet 0/0/1 192.168.20.0/24 RIP 100 1 D 192.168.24.2 GigabitEthernet 0/0/1 192.168.23.0/24 RIP 100 1 D 192.168.24.2 GigabitEthernet 0/0/1 192.168.24.0/24 Direct 0 0 D 192.168.24.4 GigabitEthernet 0/0/1 192.168.24.4/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.24.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.30.0/24 RIP 100 2 D 192.168.24.2 GigabitEthernet 0/0/1 192.168.40.0/24 Direct 0 0 D 192.168.40.1 LoopBack0 192.168.40.1/32 Direct 0 0 D 127.0.0.1 LoopBack0 192.168.40.255/32 Direct 0 0 D 127.0.0.1 LoopBack0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 3 案例3:验证RIP v1和v2 3.1 问题 分别配置RIP v1和v2 查看路由表,验证网络通信是否正常 3.2 方案 使用eNSP搭建实验环境,如图-2所示。

3.3 步骤 实现此案例需要按照如下步骤进行。

步骤一:配置RIP v1

[R1]dis cu [V200R003C00]

snmp-agent local-engineid 800007DB03000000000000 snmp-agent

clock timezone China-Standard-Time minus 08:00:00

portal local-server load portalpage.zip

drop illegal-mac alarm

set cpu-usage threshold 80 restore 75

aaa authentication-scheme default authorization-scheme default accounting-scheme default domain default domain default_admin local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http

firewall zone Local priority 15

interface GigabitEthernet0/0/0 ip address 192.168.1.1 255.255.255.0

interface GigabitEthernet0/0/1

interface GigabitEthernet0/0/2

interface NULL0

interface LoopBack0 ip address 10.1.1.1 255.255.255.0

rip 1 network 192.168.1.0 network 10.0.0.0

user-interface con 0 authentication-mode password user-interface vty 0 4 user-interface vty 16 20

wlan ac

return [R2]dis cu [V200R003C00]

snmp-agent local-engineid 800007DB03000000000000 snmp-agent

clock timezone China-Standard-Time minus 08:00:00

portal local-server load portalpage.zip

drop illegal-mac alarm

set cpu-usage threshold 80 restore 75

aaa authentication-scheme default authorization-scheme default accounting-scheme default domain default domain default_admin local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http

firewall zone Local priority 15

interface GigabitEthernet0/0/0 ip address 192.168.1.2 255.255.255.0

interface GigabitEthernet0/0/1 ip address 192.168.2.2 255.255.255.0

interface GigabitEthernet0/0/2

interface NULL0

rip 1 network 192.168.1.0 network 192.168.2.0

user-interface con 0 authentication-mode password user-interface vty 0 4 user-interface vty 16 20

wlan ac

return [R3]dis cu [V200R003C00]

snmp-agent local-engineid 800007DB03000000000000 snmp-agent

clock timezone China-Standard-Time minus 08:00:00

portal local-server load portalpage.zip

drop illegal-mac alarm

set cpu-usage threshold 80 restore 75

aaa authentication-scheme default authorization-scheme default accounting-scheme default domain default domain default_admin local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http

firewall zone Local priority 15

interface GigabitEthernet0/0/0

interface GigabitEthernet0/0/1 ip address 192.168.2.3 255.255.255.0

interface GigabitEthernet0/0/2

interface NULL0

interface LoopBack0 ip address 10.1.2.1 255.255.255.0

rip 1 network 192.168.2.0 network 10.0.0.0

user-interface con 0 authentication-mode password user-interface vty 0 4 user-interface vty 16 20

wlan ac

return 2)查看路由表,验证网络通信是否正常

[R1]dis ip ro Route Flags: R - relay, D - download to fib

Routing Tables: Public Destinations : 11 Routes : 11
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 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 192.168.1.0/24 Direct 0 0 D 192.168.1.1 GigabitEthernet 0/0/0 192.168.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.2.0/24 RIP 100 1 D 192.168.1.2 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 [R2] dis ip ro Route Flags: R - relay, D - download to fib

Routing Tables: Public Destinations : 11 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface 10.0.0.0/8 RIP 100 1 D 192.168.1.1 GigabitEthernet 0/0/0 RIP 100 1 D 192.168.2.3 GigabitEthernet 0/0/1 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 192.168.1.0/24 Direct 0 0 D 192.168.1.2 GigabitEthernet 0/0/0 192.168.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.2.0/24 Direct 0 0 D 192.168.2.2 GigabitEthernet 0/0/1 192.168.2.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 [R3]dis ip ro Route Flags: R - relay, D - download to fib

Routing Tables: Public Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.2.0/24 Direct 0 0 D 10.1.2.1 LoopBack0 10.1.2.1/32 Direct 0 0 D 127.0.0.1 LoopBack0 10.1.2.255/32 Direct 0 0 D 127.0.0.1 LoopBack0 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 192.168.1.0/24 RIP 100 1 D 192.168.2.2 GigabitEthernet 0/0/1 192.168.2.0/24 Direct 0 0 D 192.168.2.3 GigabitEthernet 0/0/1 192.168.2.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 在R1上ping不通10.1.2.1。

步骤二:配置RIP v2

[R1]rip [R1-rip-1]version 2 R2、R3均做同样配置。

2)查看路由表,验证网络通信是否正常

[R1]dis ip ro Route Flags: R - relay, D - download to fib

Routing Tables: Public Destinations : 12 Routes : 12
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 RIP 100 2 D 192.168.1.2 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 192.168.1.0/24 Direct 0 0 D 192.168.1.1 GigabitEthernet 0/0/0 192.168.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.2.0/24 RIP 100 1 D 192.168.1.2 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 [R2]dis ip ro Route Flags: R - relay, D - download to fib

Routing Tables: Public Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 RIP 100 1 D 192.168.1.1 GigabitEthernet 0/0/0 10.1.2.0/24 RIP 100 1 D 192.168.2.3 GigabitEthernet 0/0/1 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 192.168.1.0/24 Direct 0 0 D 192.168.1.2 GigabitEthernet 0/0/0 192.168.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.2.0/24 Direct 0 0 D 192.168.2.2 GigabitEthernet 0/0/1 192.168.2.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 [R3]dis ip ro Route Flags: R - relay, D - download to fib

Routing Tables: Public Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 RIP 100 2 D 192.168.2.2 GigabitEthernet 0/0/1 10.1.2.0/24 Direct 0 0 D 10.1.2.1 LoopBack0 10.1.2.1/32 Direct 0 0 D 127.0.0.1 LoopBack0 10.1.2.255/32 Direct 0 0 D 127.0.0.1 LoopBack0 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 192.168.1.0/24 RIP 100 1 D 192.168.2.2 GigabitEthernet 0/0/1 192.168.2.0/24 Direct 0 0 D 192.168.2.3 GigabitEthernet 0/0/1 192.168.2.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 在R1上可以ping通10.1.2.1。

4 案例4:Cisco路由器配置RIP v1和v2 4.1 问题 1)分别配置RIP v1和v2

2)查看路由表,验证网络通信是否正常

4.2 方案 使用Cisco Packet Tracer 搭建实验环境,如图-3所示。

4.3 步骤 实现此案例需要按照如下步骤进行。

步骤一:配置RIP v1

R1#sh run Building configuration... Current configuration : 669 bytes ! version 12.4 no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption ! hostname R1 ! ip cef no ipv6 cef ! spanning-tree mode pvst ! interface Loopback0 ip address 10.1.1.1 255.255.255.0 ! interface FastEthernet0/0 ip address 192.168.1.1 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 no ip address duplex auto speed auto shutdown ! interface Vlan1 no ip address shutdown ! router rip network 10.0.0.0 network 192.168.1.0 ! ip classless ! ip flow-export version 9 ! line con 0 ! line aux 0 ! line vty 0 4 login ! end R2#sh run Building configuration... Current configuration : 628 bytes ! version 12.4 no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption ! hostname R2 ! ip cef no ipv6 cef ! spanning-tree mode pvst ! interface FastEthernet0/0 ip address 192.168.1.2 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 ip address 192.168.2.2 255.255.255.0 duplex auto speed auto ! interface Vlan1 no ip address shutdown ! router rip network 192.168.1.0 network 192.168.2.0 ! ip classless ! ip flow-export version 9 ! line con 0 ! line aux 0 ! line vty 0 4 login ! end R3#sh run Building configuration... Current configuration : 669 bytes ! version 12.4 no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption ! hostname R3 ! ip cef no ipv6 cef ! spanning-tree mode pvst ! interface Loopback0 ip address 10.1.2.1 255.255.255.0 ! interface FastEthernet0/0 no ip address duplex auto speed auto shutdown ! interface FastEthernet0/1 ip address 192.168.2.3 255.255.255.0 duplex auto speed auto ! interface Vlan1 no ip address shutdown ! router rip network 10.0.0.0 network 192.168.2.0 ! ip classless ! ip flow-export version 9 ! line con 0 ! line aux 0 ! line vty 0 4 login ! end 2)查看路由表,验证网络通信是否正常

R1#sh ip ro Codes: C - connected, S - static, I - IGRP, 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/24 is subnetted, 1 subnets C 10.1.1.0 is directly connected, Loopback0 C 192.168.1.0/24 is directly connected, FastEthernet0/0 R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:19, FastEthernet0/0 R2#sh ip ro Codes: C - connected, S - static, I - IGRP, 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 192.168.1.1, 00:00:20, FastEthernet0/0 [120/1] via 192.168.2.3, 00:00:09, FastEthernet0/1 C 192.168.1.0/24 is directly connected, FastEthernet0/0 C 192.168.2.0/24 is directly connected, FastEthernet0/1 R3#sh ip ro Codes: C - connected, S - static, I - IGRP, 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/24 is subnetted, 1 subnets C 10.1.2.0 is directly connected, Loopback0 R 192.168.1.0/24 [120/1] via 192.168.2.2, 00:00:26, FastEthernet0/1 C 192.168.2.0/24 is directly connected, FastEthernet0/1 在R1上ping不通10.1.2.1。

步骤二:配置RIP v2

R1(config)#router rip R1(config-router)#version 2 R1(config-router)#no auto-summary R2、R3均做同样配置。

2)查看路由表,验证网络通信是否正常

R1#sh ip ro Codes: C - connected, S - static, I - IGRP, 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/24 is subnetted, 2 subnets C 10.1.1.0 is directly connected, Loopback0 R 10.1.2.0 [120/2] via 192.168.1.2, 00:00:16, FastEthernet0/0 C 192.168.1.0/24 is directly connected, FastEthernet0/0 R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:16, FastEthernet0/0 R2#sh ip ro Codes: C - connected, S - static, I - IGRP, 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, 3 subnets, 2 masks R 10.0.0.0/8 [120/1] via 192.168.1.1, 00:02:03, FastEthernet0/0 [120/1] via 192.168.2.3, 00:01:23, FastEthernet0/1 R 10.1.1.0/24 [120/1] via 192.168.1.1, 00:00:10, FastEthernet0/0 R 10.1.2.0/24 [120/1] via 192.168.2.3, 00:00:27, FastEthernet0/1 C 192.168.1.0/24 is directly connected, FastEthernet0/0 C 192.168.2.0/24 is directly connected, FastEthernet0/1 R3#sh ip ro Codes: C - connected, S - static, I - IGRP, 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/24 is subnetted, 2 subnets R 10.1.1.0 [120/2] via 192.168.2.2, 00:00:21, FastEthernet0/1 C 10.1.2.0 is directly connected, Loopback0 R 192.168.1.0/24 [120/1] via 192.168.2.2, 00:00:21, FastEthernet0/1 C 192.168.2.0/24 is directly connected, FastEthernet0/1 在R1上可以ping通10.1.2.1。