一、网络规划

1、实验目的

  • 掌握静态路由的配置方法
  • 掌握测试静态路由连通性的方法

2、网络拓补

拓补图

3、IP规划

根据上述拓补图,对路由器、PC的IP地址规划如下:

设备名IP地址子网掩码网关
PC1192.4.1.1024192.4.1.1
PC2192.4.4.1024192.4.4.1
子网掩码24即255.255.255.0
设备名接口IP地址子网掩码
AR1G0/0/0192.4.2.124
AR1G0/0/1192.4.1.124
AR2G0/0/0192.4.2.224
AR2G0/0/1192.4.3.224
AR3G0/0/0192.4.3.324
AR3G0/0/1192.4.4.124

4、非直连网段

(1)非直连网段分析

AR1: 192.168.3.0/24   192.168.4.0/24
AR2: 192.168.1.0/24   192.168.4.0/24
AR3: 192.168.1.0/24   192.168.2.0/24

(2)流量处理

设备名网段1下一跳网段2下一跳
AR1192.4.3.0/24192.4.2.2192.4.4.0/24192.4.2.2
AR2192.4.1.0/24192.4.2.1192.4.4.0/24192.4.3.3
AR3192.4.1.0/24192.4.3.2192.4.2.0/24192.4.3.2

二、实验步骤

1、基本配置

以下为AR1路由器配置;
请根据网络拓补及规划,对AR2、AR3路由器进行配置;

## AR1路由器配置示例
[Huawei]sys AR1
[AR1]interface g 0/0/0
[AR1-GigabitEthernet0/0/0]ip add 192.4.2.1 24
[AR1-GigabitEthernet0/0/0]int g 0/0/1
[AR1-GigabitEthernet0/0/1]ip add 192.4.1.1 24
[AR1-GigabitEthernet0/0/1]quit
[AR1]display ip interface brief 

AR1路由器配置

2、测试直连网络的连通性

(1)AR2 ping AR1

在AR2路由器 ping 192.4.2.1

(2)AR2 ping AR3

在AR2路由器ping 192.4.3.3

image.png

3、配置静态路由

(1)分别在AR1/AR2/AR3上配置到达非直连网络的静态路由

[AR1]ip route-static 192.4.3.0 24 192.4.2.2
[AR1]ip route-static 192.4.4.0 24 192.4.2.2
[AR2]ip route-static 192.4.1.0 24 192.4.2.1
[AR2]ip route-static 192.4.4.0 24 192.4.3.3
[AR3]ip route-static 192.4.1.0 24 192.4.3.2
[AR3]ip route-static 192.4.2.0 24 192.4.3.2
注意:使用undo 可用于删除已有的配置
ip route-static 命令 
格式:ip route-static 网段  掩码  下一跳
作用:用于告知路由器去某一网段的数据包要通过下一跳地址送出去

示例:ip route-static 192.4.3.0 24 192.4.2.2
意义:将掩码为24的192.4.3.0网段流量,通过192.4.2.2送出

静态路由配置

路由包括:
    可达目的网络(子网掩码) 
    下一跳/出接口--转发方式
    Proto--路由的来源 direct表示自动生成  static表示手工配置 
    cost--开销值  表示到达目的网络的开销
    pre--优先级,取值范围0~255,值越小越优

(2)查看静态路由的路由信息

使用 display ip routing-table protocol static 命令查看静态路由的路由信息,确认配置的静态路由是否生效

AR1路由器
AR1

AR2路由器
AR2

AR3路由器
AR3

4、测试网络的连通性

使用ping命令测试网络连通性,使用tracert命令
跟踪到达目的站点经过路由器的情况

测试网络连通性及经过路线

5、保存配置

分别在AR1、AR2、AR3路由器上使用save命令保存配置
  <AR2>save
    The current configuration will be written to the device. 
    Are you sure to continue? (y/n)[n]:y
    It will take several minutes to save configuration file, please wait.......
    Configuration file had been saved successfully
    Note: The configuration file will take effect after being activated

保存配置

原文地址:路由交换之静态路由

Last modification:December 13, 2021
分享是对我最大的赞赏