静态路由综合实验

拓扑图:

实验需求:

1.整张网络使用192.168.1.0/24网段进行划分
2.R1、R2、R3、R4均有两个环回来模拟用户网段
3.R5使用DHCP为PC分配IP网段
4.R2、R3、R4、R5开启Telnet功能;账号密码:admin/admin
5.完成所有路由器的静态路由配置,要求使用最简化路由表的方式
6.全网可达

需求分析:

1.子网划分
2.环回路由
3.DHCP
4.Telnet
5.静态路由
6.全网通

实验配置:

  • 1.子网划分

子网划分:192.168.1.0/24
1.先忽略环回进行划分:--7个网段
192.168.1.000 00000----192.168.1.0/27----192.168.1.31/27
192.168.1.001 00000----192.168.1.32/27---192.168.1.63/27
192.168.1.010 00000----192.168.1.64/27---192.168.1.95/27
192.168.1.011 00000----192.168.1.96/27---192.168.1.127/27
192.168.1.100 00000----192.168.1.128/27--192.168.1.159/27
192.168.1.101 00000----192.168.1.160/27--192.168.1.191/27
192.168.1.110 00000----192.168.1.192/27--192.168.1.223/27
192.168.1.111 00000----192.168.1.224/27--192.168.1.255/27

2.环回路由产生了8个网段,对上面第8个闲置的网段进行拆分:
192.168.1.111 000 00----192.168.1.224/30--192.168.1.227/30
192.168.1.111 001 00----192.168.1.228/30--192.168.1.231/30
192.168.1.111 010 00----192.168.1.232/30--192.168.1.235/30
192.168.1.111 011 00----192.168.1.236/30--192.168.1.239/30
192.168.1.111 100 00----192.168.1.240/30--192.168.1.243/30
192.168.1.111 101 00----192.168.1.244/30--192.168.1.247/30
192.168.1.111 110 00----192.168.1.248/30--192.168.1.251/30
192.168.1.111 111 00----192.168.1.252/30--192.168.1.255/30

设置网关
AR1:
192.168.1.1/27
192.168.1.65/27
AR2:
192.168.1.2/27
192.168.1.33/27
AR3:
192.168.1.66/27
192.168.1.97/27
AR4:
192.168.1.34/27
192.168.1.98/27
192.168.1.129/27
192.168.1.161/27
AR5:
192.168.1.130/27
192.168.1.162/27
192.168.1.193/27

  • 2.环回路由

AR1:
192.168.1.225/30
192.168.1.229/30
AR2:
192.168.1.233/30
192.168.1.237/30
AR3:
192.168.1.241/30
192.168.1.245/30
AR4:
192.168.1.249/30
192.168.1.253/30
  • 3.DHCP配置

[Huawei]dhcp enable
    Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]ip pool A
    Info: It's successful to create an IP address pool.
[Huawei-ip-pool-A]network 192.168.1.192 mask 27
[Huawei-ip-pool-A]gateway-list 192.168.1.193
[Huawei-ip-pool-A]quit
[Huawei]interface g 0/0/2
[Huawei-GigabitEthernet0/0/2]dhcp select global

  • 4.Telnet配置

  • Telnet服务器设置--以AR2为例:
[Huawei]sysname Telnet Server
[Telnet Server]telnet server enable
    Error: TELNET server has been enabled
[Telnet Server]user-interface vty 0 4
[Telnet Server-ui-vty0-4]authentication-mode aaa
[Telnet Server-ui-vty0-4]quit
[Telnet Server]aaa
[Telnet Server-aaa]local-user admin password cipher admin privilege level 15
    这条命令把之前的两条命名合并了
[Telnet Server-aaa]local-user admin service-type telnet

  • Telnet客户端设置--AR1:
<Huawei>telnet 192.168.1.2
  Press CTRL_] to quit telnet mode
  Trying 192.168.1.2 ...
  Connected to 192.168.1.2 ...

Login authentication


Username:admin
Password:
<Telnet Server>

注意:要想连接AR4和AR5的话需要先配置静态路由!

  • 5.静态路由

[Huawei]display this--查看该界面下的操作
AR1:
ip route-static 192.168.1.32 255.255.255.224 192.168.1.2
ip route-static 192.168.1.96 255.255.255.224 192.168.1.66
ip route-static 192.168.1.128 255.255.255.224 192.168.1.2
ip route-static 192.168.1.128 255.255.255.224 192.168.1.66
ip route-static 192.168.1.160 255.255.255.224 192.168.1.2 preference 90
ip route-static 192.168.1.160 255.255.255.224 192.168.1.66 preference 90
ip route-static 192.168.1.192 255.255.255.224 192.168.1.2
ip route-static 192.168.1.192 255.255.255.224 192.168.1.66
ip route-static 192.168.1.232 255.255.255.248 192.168.1.2
ip route-static 192.168.1.240 255.255.255.248 192.168.1.66
ip route-static 192.168.1.248 255.255.255.248 192.168.1.2
ip route-static 192.168.1.248 255.255.255.248 192.168.1.66

AR2:
ip route-static 192.168.1.64 255.255.255.224 192.168.1.1
ip route-static 192.168.1.128 255.255.255.224 192.168.1.34
ip route-static 192.168.1.160 255.255.255.224 192.168.1.34 preference 90
ip route-static 192.168.1.192 255.255.255.224 192.168.1.34
ip route-static 192.168.1.224 255.255.255.248 192.168.1.1
ip route-static 192.168.1.240 255.255.255.248 192.168.1.1
ip route-static 192.168.1.248 255.255.255.248 192.168.1.34
AR3:
ip route-static 192.168.1.0 255.255.255.224 192.168.1.65
ip route-static 192.168.1.128 255.255.255.224 192.168.1.98
ip route-static 192.168.1.160 255.255.255.224 192.168.1.98 preference 90
ip route-static 192.168.1.192 255.255.255.224 192.168.1.98
ip route-static 192.168.1.224 255.255.255.248 192.168.1.65
ip route-static 192.168.1.232 255.255.255.248 192.168.1.65
ip route-static 192.168.1.248 255.255.255.248 192.168.1.98
AR4:
ip route-static 192.168.1.0 255.255.255.224 192.168.1.33
ip route-static 192.168.1.64 255.255.255.224 192.168.1.97
ip route-static 192.168.1.192 255.255.255.224 192.168.1.130
ip route-static 192.168.1.192 255.255.255.224 192.168.1.162
ip route-static 192.168.1.224 255.255.255.248 192.168.1.33
ip route-static 192.168.1.224 255.255.255.248 192.168.1.97
ip route-static 192.168.1.232 255.255.255.248 192.168.1.33
ip route-static 192.168.1.240 255.255.255.248 192.168.1.97
AR5:
ip route-static 192.168.1.0 255.255.255.224 192.168.1.129
ip route-static 192.168.1.0 255.255.255.224 192.168.1.161
ip route-static 192.168.1.32 255.255.255.224 192.168.1.129
ip route-static 192.168.1.32 255.255.255.224 192.168.1.161
ip route-static 192.168.1.64 255.255.255.224 192.168.1.129
ip route-static 192.168.1.64 255.255.255.224 192.168.1.161
ip route-static 192.168.1.96 255.255.255.224 192.168.1.129
ip route-static 192.168.1.96 255.255.255.224 192.168.1.161
ip route-static 192.168.1.224 255.255.255.248 192.168.1.129
ip route-static 192.168.1.224 255.255.255.248 192.168.1.161
ip route-static 192.168.1.232 255.255.255.248 192.168.1.129
ip route-static 192.168.1.232 255.255.255.248 192.168.1.161
ip route-static 192.168.1.240 255.255.255.248 192.168.1.161
ip route-static 192.168.1.240 255.255.255.248 192.168.1.129
ip route-static 192.168.1.248 255.255.255.248 192.168.1.129
  • 6.全网通

以AR2为例:
[Huawei]ping -a 192.168.1.233 192.168.1.225
  PING 192.168.1.225: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.225: bytes=56 Sequence=1 ttl=255 time=40 ms
    Reply from 192.168.1.225: bytes=56 Sequence=2 ttl=255 time=20 ms

[Huawei]ping -a 192.168.1.233 192.168.1.241
  PING 192.168.1.241: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.241: bytes=56 Sequence=1 ttl=254 time=110 ms
    Reply from 192.168.1.241: bytes=56 Sequence=2 ttl=254 time=90 ms

[Huawei]ping -a 192.168.1.233 192.168.1.249
  PING 192.168.1.249: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.249: bytes=56 Sequence=1 ttl=255 time=20 ms
    Reply from 192.168.1.249: bytes=56 Sequence=2 ttl=255 time=30 ms

[Huawei]ping -a 192.168.1.233 192.168.1.221
  PING 192.168.1.221: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.221: bytes=56 Sequence=1 ttl=126 time=70 ms
    Reply from 192.168.1.221: bytes=56 Sequence=2 ttl=126 time=60 ms
### 静态路由实验报告及相关资料 静态路由是一种手动配置的路由方式,通常在网络管理员了解网络拓扑的情况下使用。它不需要复杂的协议支持,也不消耗额外带宽来维护路由表,因此适用于小型或稳定的网络环境[^1]。 以下是关于静态路由的一些关键点以及其实验配置方法: #### 1. 静态路由的基本概念 静态路由是由网络管理员手动定义的一组规则,用于指定数据包如何从源地址传输到目标地址。其主要特点是没有自动调整能力,在网络拓扑发生变化时需要重新配置。 #### 2. 配置命令示例 在实际操作中,可以通过以下命令实现静态路由的配置: ```bash [r4]ip route-static 192.168.1.32 255.255.255.240 192.168.1.13 [r4]ip route-static 192.168.1.48 255.255.255.240 192.168.1.13 ``` 上述命令表示将子网 `192.168.1.32/28` 和 `192.168.1.48/28` 的流量转发至下一跳地址 `192.168.1.13`[^2]。 对于其他设备,也可以采用类似的配置形式: ```bash [R1]ip route-static 0.0.0.0 0.0.0.0 192.169.1.5 [R1]ip route-static 0.0.0.0 0.0.0.0 192.169.1.18 ``` 这里设置了两条默认路由,分别指向不同的下一跳地址[^3]。 #### 3. 路由优先级与匹配原则 路由器在选择路径时会遵循最长前缀匹配的原则,并考虑优先级参数(如 `preference`)。例如: ```bash [R5]ip route-static 192.168.1.0 255.255.255.252 192.168.1.2 preference 61 [R5]ip route-static 192.168.1.4 255.255.255.252 192.168.1.21 preference 61 ``` 以上配置表明,针对特定目的地址的数据流会选择具有更高优先级 (`preference`) 的路由条目[^4]。 #### 4. 实验验证过程 为了测试静态路由的有效性,可以利用抓包工具或者 ping 命令观察数据流向是否符合预期。例如,在 eNSP 平台上完成如下配置后,应能成功访问远程主机: ```bash ip route 192.168.1.0 255.255.255.0 192.168.1.6 metric 20 ``` 此语句指定了通往 `192.168.1.0/24` 子网的最佳路径及其代价值 (metric)[^5]。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值