静态路由综合实验

一,实验图表及实验要求如下

注意:R1,R2,R3,R4路由器均有环回,图中未画出来。

环回接口:是设备身上的一个虚拟接口,不是真实存在的,该接口一般用于测试使用(替代PC)

二,分析需求且划分步骤

根据所有的需求我们来分析需求:

  1. 划分网段
  2. 配置IP
  3. 配置DHCP
  4. 配置Telnet
  5. 配路由(包括未知网段/汇总网段)
  6. 缺省路由
  7. 空接口路由
  8. 浮动静态路由

三,分析并实现实验需求

1.划分网段

由拓扑图可知共有15个网段

                        骨干网路:路由器和路由器之间的网路

(1)先判断骨干网路的掩码取值,由于只需要两个ip地址(骨干网路的2个网关ip),掩码为30时出去首尾的ip值正好余下两个ip可以使用,因此得出掩码应设为30。共有六条骨干网路 

  1. 分成6个大网段(至少借三位给网络位)

192.168.1.0/24

192.168.1.000 00000/27 -- 192.168.1.0/27 -- 骨干

192.168.1.001 00000/27 -- 192.168.1.32/27 -- R1环回(两个,借一位给网络位)

         192.168.1.001 0 0000/28 -- 192.168.1.32/28

         192.168.1.001 1 0000/28 -- 192.168.1.48/28

192.168.1.010 00000/27 -- 192.168.1.64/27 -- R2环回

        192.168.1.010 0 0000/28 -- 192.168.1.64/28

         192.168.1.010 1 0000/28 -- 192.168.1.80/28

192.168.1.011 00000/27 -- 192.168.1.96/27 -- R3环回

        192.168.1.011 0 0000/28 -- 192.168.1.96/28

         192.168.1.011 1 0000/28 -- 192.168.1.112/28

192.168.1.100 00000/27 -- 192.168.1.128/27 -- R4环回

        192.168.1.100 0 0000/28 -- 192.168.1.128/28

         192.168.1.100 1 0000/28 -- 192.168.1.144/28

192.168.1.101 00000/27 -- 192.168.1.160/27

192.168.1.110 00000/27

192.168.1.111 00000/27

2.由于骨干网路掩码需要为30,因此还需要借三位给网络位

192.168.1.000 00000/27 -- 192.168.1.0/27 -- 骨干

192.168.1.000 000 00/30 -- 192.168.1.0/30 -- 范围:192.168.1.1~1.2

        192.168.1.000 000 00

        192.168.1.000 000 01 

        192.168.1.000 000 10

        192.168.1.000 000 11

192.168.1.000 001 00/30 -- 192.168.1.4/30

同理如下 -- 192.168.1.5~1.6/30

192.168.1.000 010 00/30 -- 192.168.1.8/30

--192.168.1.9~1.10/30

192.168.1.000 011 00/30 -- 192.168.1.12/30

--192.168.1.13~1.14/30

192.168.1.000 100 00/30 -- 192.168.1.16/30

--192.168.1.17~1.18/30

192.168.1.000 101 00/30 -- 192.168.1.20/30

-- 192.168.1.21~1.22/30

192.168.1.000 110 00/30

192.168.1.000 111 00/30

3.已知这些信息后在图上标明ip地址和环回接口ip

前四个路由器的下面两个IP为环回接口的IP值

2.配置所有设备的IP

AR1

环回接口

其余的AR2,AR3,AR4配置同理

测试是否成功

输入[r1]display ip interface brief 即可

提示:为避免后面出错建议先判断IP是否配置成功!

3.配置DHCP

[r5]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r5]ip pool aa
Info: It's successful to create an IP address pool.
[r5-ip-pool-aa]network 192.168.1.160 mask 27
[r5-ip-pool-aa]gateway-list 192.168.1.161
[r5-ip-pool-aa]dns-list 8.8.8.8
[r5-ip-pool-aa]quit
[r5]interface G	
[r5]interface GigabitEthernet 0/0/1
[r5-GigabitEthernet0/0/1]dhcp select global

在PC1和PC2的实验结果

4,配置Telnet

以AR2为例

[r2]user-interface vty 0 4
[r2-ui-vty0-4]authentication-mode aaa
[r2-ui-vty0-4]quit
[r2]aaa	
[r2-aaa]local-user admin password cipher admin
[r2-aaa]local-user admin password cipher admin pri	
[r2-aaa]local-user admin password cipher admin privilege level 15
[r2-aaa]local-user admin service-type telnet

其余AR3,AR4,AR5都同理配置

测试(以AR1登录AR2为例)

5.配路由(包括未知网段/汇总网段)

1.先看左边(AR4左边)网段部分

AR1:有三个直连的已知网段,五个未知网段

[r1]ip route-static 192.168.1.8 30 192.168.1.2
/*分别是目的IP 掩码 下一跳   该次是AR2~AR4的网段*/
[r1]ip route-static 192.168.1.12 30 192.168.1.6
/*AR3~AR4的网段*/
[r1]ip route-static 192.168.1.64 27 192.168.1.2
/*AR2自环*/
[r1]ip route-static 192.168.1.96 27 192.168.1.6
/*AR3自环*/
[r1]ip route-static 192.168.1.128 27 192.168.1.12
/*AR4负载均衡*/
[r1]ip route-static 192.168.1.128 27 192.168.1.16
/*AR4负载均衡*/
[r1]display ip routing-table protocol static 
/*查看结果*/
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 5        Routes : 6        Configured Routes : 6

Static routing table status : <Active>
         Destinations : 5        Routes : 5

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.8/30  Static  60   0          RD   192.168.1.2     GigabitEthernet
0/0/0
   192.168.1.12/30  Static  60   0          RD   192.168.1.6     GigabitEthernet
0/0/1
   192.168.1.64/27  Static  60   0          RD   192.168.1.2     GigabitEthernet
0/0/0
   192.168.1.96/27  Static  60   0          RD   192.168.1.6     GigabitEthernet
0/0/1
  192.168.1.128/27  Static  60   0          RD   192.168.1.12    GigabitEthernet
0/0/1

Static routing table status : <Inactive>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

  192.168.1.128/27  Static  60   0               192.168.1.16    Unknown

AR2:三个直连,五个未知

[r2]ip route-static 192.168.1.4 30 192.168.1.1
/*R1~R3*/
[r2]ip route-static 192.168.1.12 30 192.168.1.10
/*R4~R3*/
[r2]ip route-static 192.168.1.96 27 192.168.1.1
[r2]ip route-static 192.168.1.96 27 192.168.1.10
/*R3负载均衡*/
[r2]ip route-static 192.168.1.32 27 192.168.1.1
/*AR1自环网段*/
[r2]ip route-static 192.168.1.128 27 192.168.1.10
/*AR4自环网段*/
[R2]display ip routing-table protocol static 
/*测试*/
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 6        Routes : 6        Configured Routes : 6

Static routing table status : <Active>
         Destinations : 6        Routes : 6

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.4/30  Static  60   0          RD   192.168.1.1     GigabitEthernet
0/0/0
   192.168.1.12/30  Static  60   0          RD   192.168.1.10    GigabitEthernet
0/0/1
   192.168.1.32/27  Static  60   0          RD   192.168.1.1     GigabitEthernet
0/0/0
   192.168.1.64/27  Static  60   0          RD   192.168.1.10    GigabitEthernet
0/0/1
   192.168.1.96/27  Static  60   0          RD   192.168.1.1     GigabitEthernet
0/0/0
  192.168.1.128/27  Static  60   0          RD   192.168.1.10    GigabitEthernet
0/0/1

Static routing table status : <Inactive>
         Destinations : 0        Routes : 0

[R2]

 AR3与AR2对称

[R3]ip route-static 192.168.1.0 30 192.168.1.5
/*AR1~AR2*/
[R3]ip route-static 192.168.1.8 30 192.168.1.14
/*AR4~AR2*/
[R3]ip route-static 192.168.1.64 27 192.168.1.5
[R3]ip route-static 192.168.1.64 27 192.168.1.14
/*AR2负载均衡*/
[R3]ip route-static 192.168.1.32 27 192.168.1.5
/*AR1环回*/
[R3]ip route-static 192.168.1.128 27 192.168.1.14
/*AR4环回*/
[R3]display ip routing-table protocol static 
/*测试*/
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 5        Routes : 6        Configured Routes : 6

Static routing table status : <Active>
         Destinations : 5        Routes : 6

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.0/30  Static  60   0          RD   192.168.1.5     GigabitEthernet
0/0/0
    192.168.1.8/30  Static  60   0          RD   192.168.1.14    GigabitEthernet
0/0/1
   192.168.1.32/27  Static  60   0          RD   192.168.1.5     GigabitEthernet
0/0/0
   192.168.1.64/27  Static  60   0          RD   192.168.1.5     GigabitEthernet
0/0/0
                    Static  60   0          RD   192.168.1.14    GigabitEthernet
0/0/1
  192.168.1.128/27  Static  60   0          RD   192.168.1.14    GigabitEthernet
0/0/1

Static routing table status : <Inactive>
         Destinations : 0        Routes : 0

AR4与AR1对称

[AR4]ip route-static 192.168.1.0 30 192.168.1.9
/*AR2~AR1*/
[AR4]ip route-static 192.168.1.4 30 192.168.1.13
/*AR3~AR1*/
[AR4]ip route-static 192.168.1.32 27 192.168.1.9
[AR4]ip route-static 192.168.1.32 27 192.168.1.13
/*AR1负载均衡*/
[AR4]ip route-static 192.168.1.64 27 192.168.1.9
/*AR2环回*/
[AR4]ip route-static 192.168.1.96 27 192.168.1.13
/*AR3环回*/
[AR4]display ip routing-table protocol static 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 5        Routes : 6        Configured Routes : 6

Static routing table status : <Active>
         Destinations : 5        Routes : 6

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.0/30  Static  60   0          RD   192.168.1.9     GigabitEthernet
0/0/0
    192.168.1.4/30  Static  60   0          RD   192.168.1.13    GigabitEthernet
0/0/2
   192.168.1.32/27  Static  60   0          RD   192.168.1.9     GigabitEthernet
0/0/0
                    Static  60   0          RD   192.168.1.13    GigabitEthernet
0/0/2
   192.168.1.64/27  Static  60   0          RD   192.168.1.9     GigabitEthernet
0/0/0
   192.168.1.96/27  Static  60   0          RD   192.168.1.13    GigabitEthernet
0/0/2

Static routing table status : <Inactive>
         Destinations : 0        Routes : 0

[AR4]

6.缺省路由

定义:一条不限定目标的路由信息;特点是目标网段为0.0.0.0/0。为优化网络设计,在保证路由可达的情况下,可以尽量减少路由表的路由条目。

缺省路由是一台路由器的保底措施,因为最长匹配原则的存在,正常情况下,不会使用缺省路由指导 数据转发;只有任何一条路由都没有匹配上目标IP时,才会使用缺省路由进行数据转发

缺省路由一定只能从一个方向开始,不能往回走!

配置由AR1~AR2~AR4~AR5方向的缺省路由

0.0.0.0 0指所有

AR1(AR4对于AR1都为负载均衡)

AR2

AR3

AR4(由于还未配置浮动静态路由,先忽略下面那条路)

抓包后发现数据到达AR5但并未给予回应

所以先配置AR5的路由

结果验证

由测试AR1可以与AR5互通,即缺省路由配置成功

AR4对于所有路由器来讲,由于缺省路由内已经存在,避免重复删除掉AR4的环回。

7.空接口路由

当路由黑洞与缺省路由相遇,将必然出现环路

eg:假设AR2丢失IP信息,通过缺省路由传递到AR4,AR4发现缺失信息又往AR2走,如此反复循环就需要建立一个空接口路由来打破这个循环

空接口类似于垃圾桶,把黑洞数据包丢掉就不会产生回环。

在黑洞路由器上,配置一条到达汇总网段的空接口路由来防止环路;

AR1

[R1]ip route-static 192.168.1.32 27 null 0
/*AR1的环回*/

后面的所有环回同理解决

8.浮动静态路由

相当于一条备份链路,走不通的planB。

由图可知只用设置AR4~AR5之间的链路(有两条,说明一条可以当备份链路)

[AR4]ip route-static 0.0.0.0 0 192.168.1.22 preference 61
/*192.168.1.22为下一跳  通过display ip route-static pro static 可知1.22的下一跳优先级为60,所以设为61*/
[AR4]display ip routing-table protocol static 
/*检测*/
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 7        Routes : 9        Configured Routes : 9

Static routing table status : <Active>
         Destinations : 7        Routes : 8

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       /* 0.0.0.0/0   Static  60   0          RD   192.168.1.18    GigabitEthernet
0/0/1 */
    192.168.1.0/30  Static  60   0          RD   192.168.1.9     GigabitEthernet
0/0/0
    192.168.1.4/30  Static  60   0          RD   192.168.1.13    GigabitEthernet
0/0/2
   192.168.1.32/27  Static  60   0          RD   192.168.1.9     GigabitEthernet
0/0/0
                    Static  60   0          RD   192.168.1.13    GigabitEthernet
0/0/2
   192.168.1.64/27  Static  60   0          RD   192.168.1.9     GigabitEthernet
0/0/0
   192.168.1.96/27  Static  60   0          RD   192.168.1.13    GigabitEthernet
0/0/2
  192.168.1.128/27  Static  60   0           D   0.0.0.0         NULL0

Static routing table status : <Inactive>/*备用,目前不活跃*/
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  61   0          R    192.168.1.22    GigabitEthernet
4/0/0 /*浮动静态路由*/

把每个路由器都设置浮动静态路由

验证

[AR5]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 8        Routes : 16       Configured Routes : 16

Static routing table status : <Active>
         Destinations : 8        Routes : 8

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.0/30  Static  60   0          RD   192.168.1.17    GigabitEthernet
0/0/0
    192.168.1.4/30  Static  60   0          RD   192.168.1.17    GigabitEthernet
0/0/0
    192.168.1.8/30  Static  60   0          RD   192.168.1.17    GigabitEthernet
0/0/0
   192.168.1.12/30  Static  60   0          RD   192.168.1.17    GigabitEthernet
0/0/0
   192.168.1.32/27  Static  60   0          RD   192.168.1.17    GigabitEthernet
0/0/0
   192.168.1.64/27  Static  60   0          RD   192.168.1.17    GigabitEthernet
0/0/0
   192.168.1.96/27  Static  60   0          RD   192.168.1.17    GigabitEthernet
0/0/0
  192.168.1.128/27  Static  60   0          RD   192.168.1.17    GigabitEthernet
0/0/0

Static routing table status : <Inactive>
         Destinations : 8        Routes : 8

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.0/30  Static  61   0          R    192.168.1.21    GigabitEthernet
0/0/2
    192.168.1.4/30  Static  61   0          R    192.168.1.21    GigabitEthernet
0/0/2
    192.168.1.8/30  Static  61   0          R    192.168.1.21    GigabitEthernet
0/0/2
   192.168.1.12/30  Static  61   0          R    192.168.1.21    GigabitEthernet
0/0/2
   192.168.1.32/27  Static  61   0          R    192.168.1.21    GigabitEthernet
0/0/2
   192.168.1.64/27  Static  61   0          R    192.168.1.21    GigabitEthernet
0/0/2
   192.168.1.96/27  Static  61   0          R    192.168.1.21    GigabitEthernet
0/0/2
  192.168.1.128/27  Static  61   0          R    192.168.1.21    GigabitEthernet
0/0/2

[AR5]

我们把AR5处的0/0/0接口关闭测试是否能连通

由图,已经成功启用

所有需求完成,实验成功。

  • 20
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OSPF路由综合实验是一个实验,旨在综合运用OSPF协议和相关配置,实现路由的建立和通信。 在实验中,可以手动指定Router ID,也可以使用随机生成的Router ID。当指定Router ID时,可以优先选择具有Loopback口的Router ID,或选择网段较大的Router ID。 [1] 在OSPF中,有五种报文用于实现邻居发现和路由更新:hello报文(用于打招呼),dd报文(用于本地概要),lsr报文(用于请求更新),lsu报文(用于向对方发送对方需要的LSA),lsack报文(用于确认)。在与邻居建立初始连接时,邻居的状态为"int",之后会变为"two-way"或"full"。 [1] 在进行OSPF协议配置时,可以通过命令行配置路由器的Router ID,如[R1ospf 1 router-id 1.1.1.1。同时,可以将路由器划分到指定的区域(area),如[R1-ospf-1area 1。可以通过配置网络地址来告知OSPF协议管理的网络范围,如[R1-ospf-1-area-0.0.0.1network 172.16.0.0 0.0.255.255。 [2] 在OSPF路由建立后,可以进行通信测试。在测试中,可能会发现可以PING通某些目标地址(如4.4.4.4),但无法PING通其他目标地址(如192.168.0.0和34.0.0.3),这是因为缺少返回的路由。解决这个问题的方法有多种:可以配置静态路由,也可以在R4上注入直连路由,还可以通过动态发布缺省路由。其中,后两种方法的实现原理相同,都是通过OSPF协议来传递路由信息。具体的配置命令可以是ospf 1 import-route direct或ospf 1 default-route-advertise。 [3] 综合实验的目的是通过综合运用OSPF协议和相关配置,实现路由的建立和通信。通过不断实践和调试,可以提高对OSPF协议和网络路由的理解和应用能力。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值