ensp之静态路由综合实验

目录

一、实验题目

二、实验思路

2.1 规划IP地址

2.2 缺省路由(默认路由)

2.3 子网汇总

2.4 NAT与ACL

2.5 浮动静态路由

三、实验步骤

3.1 新建拓扑

3.2 配置接口IP

3.3 开启dhcp服务

PC1与PC2自动获取到IP地址

 3.4 空接口防环

 3.5 撰写ACL表

3.6 远程登陆

3.7 修改优先级

四、测试


一、实验题目

本次实验涉及知识点包括但不限于:IP地址配置、环回地址配置、合理进行子网汇总、缺省路由、空路由接口、浮动静态路由、ACL表规则撰写、动态NAT网络地址转换、端口映射、远程登陆等知识点。

二、实验思路

2.1 规划IP地址

根据题目要求,私网以192.168.1.0/24为母网,划分子网,R1、R2、R4、R5各有环回接口,为方便子网汇总,骨干链路需要6个网段,且要留空余网段,2的三次方=8>6,则借三位:

192.168.1.0/27   1.0/30 1.4/30 1.8/30 1.12/30 1.16/30 1.20/30 1.24/30 1.28/30   划分主干道网段

192.168.1.32/27        1.32/28        1.48/28

192.168.1.64/27        1.64/28        1.80/28

192.168.1.96/27        1.96/28        1.112/28

192.168.1.128/27        1.128/28        1.144/28

192.168.1.160/27        1.160/28        1.176/28

192.168.1.192/27       

192.168.1.224/27

2.2 缺省路由(默认路由)

每一台路由器上通过缺省对外网进行流量访问,再补充静态路由实现内网全网可达

2.3 子网汇总

写静态路由时,两个环回直接汇总为一条,减少路由条目,合理利用空路由接口,避免环路

2.4 NAT与ACL

编写ACL规则允许外网流量进入内网,用端口映射将LSP路由登录到R1

2.5 浮动静态路由

R4、R5之间链路通过修改静态路由优先级进行切换

三、实验步骤

3.1 新建拓扑

打开华为模拟器ENSP,根据题目搭建拓扑,分为内网外网

3.2 配置接口IP

R1:

[r1]int lo0
[r1-LoopBack0]ip add 192.168.1.33 28
[r1-LoopBack0]int lo1
[r1-LoopBack1]ip add 192.168.1.49 28
[r1-LoopBack1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 30
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.1.5 30

R2-R6配置与R1类似,不做展示

3.3 开启dhcp服务
<r3>sys
Enter system view, return user view with Ctrl+Z.
[r3]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[r3]ip pool 1
Info: It's successful to create an IP address pool.       
[r3-ip-pool-1]network 192.168.1.96 mask 27
[r3-ip-pool-1]gateway-list 192.168.1.97
[r3-ip-pool-1]dns-list 114.114.114.114 8.8.8.8 
[r3-ip-pool-1]q
[r3]int g0/0/2
[r3-GigabitEthernet0/0/2]dhcp select global 
[r3-GigabitEthernet0/0/2]q
PC1与PC2自动获取到IP地址

 3.4 空接口防环

进行子网汇总的都要进行NULL接口,防止环路产生

[r1]ip route-static 192.168.1.32 27 NULL 0
[r2]ip route-static 192.168.1.64 27 NULL 0
[r4]ip route-static 192.168.1.128 27 NULL 0
[r5]ip route-static 192.168.1.160 27 NULL 0
 3.5 撰写ACL表

通过编写规则让外网流量可以进入192.168.1.0这个私网,从而使全网互通


[r5]acl 2000
[r5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r5-acl-basic-2000]int g0/0/2
[r5-GigabitEthernet0/0/2]nat outbound 2000
3.6 远程登陆

NAT的端口映射让R6可以通过登录边界路由器的端口从而登录到R1

打开R1的telnet服务
<r1>sys
Enter system view, return user view with Ctrl+Z.
[r1]aaa
[r1-aaa]local-user wl privilege level 15 password cipher 123456
Info: Add a new user.    
[r1-aaa]local-user wl service-type telnet 
[r1-aaa]q
[r1]user-interface vty 0 4
[r1-ui-vty0-4]authentication-mode aaa
[r1-ui-vty0-4]q

在R5边界接口上进行端口映射
[r5]int g0/0/2
[r5-GigabitEthernet0/0/2]nat static protocol tcp  global current-interface 23 inside 192.168.1.33 23
Warning:The port 23 is well-known port. If you continue it may cause function failure.
Are you sure to continue?[Y/N]:y
[r5-GigabitEthernet0/0/2]q
3.7 修改优先级
R4路由器上修改
[r4]ip route-static 0.0.0.0 0 192.168.1.18 preference 70
R5路由器上也要修改
[r5]ip route-static 192.168.1.0 255.255.255.252 192.168.1.17 pr 70
[r5]ip route-static 192.168.1.4 255.255.255.252 192.168.1.17 pr 70
[r5]ip route-static 192.168.1.8 255.255.255.252 192.168.1.17 pr 70
[r5]ip route-static 192.168.1.12 255.255.255.252 192.168.1.17 pr 70
[r5]ip route-static 192.168.1.32 255.255.255.224 192.168.1.17 pr 70
[r5]ip route-static 192.168.1.64 255.255.255.224 192.168.1.17 pr 70
[r5]ip route-static 192.168.1.96 255.255.255.224 192.168.1.17 pr 70
[r5]ip route-static 192.168.1.128 255.255.255.224 192.168.1.17 pr 70

 优先级为60的链路关闭后,优先级为70的链路浮动上来,进行使用

四、测试

全网可达:

<r1>ping -a 192.168.1.33 192.168. 1.161
                                  ^
Error:Too many parameters found at '^' position.
<r1>ping -a 192.168.1.33 192.168.1.161 
  PING 192.168.1.161: 56  data bytes, press CTRL_C to break
    Request time out
    Request time out
    Request time out
    Reply from 192.168.1.161: bytes=56 Sequence=4 ttl=253 time=60 ms
    Reply from 192.168.1.161: bytes=56 Sequence=5 ttl=253 time=40 ms

  --- 192.168.1.161 ping statistics ---
    5 packet(s) transmitted
    2 packet(s) received
    60.00% packet loss
    round-trip min/avg/max = 40/50/60 ms

<r1>ping -a 192.168.1.33 192.168.1.126
  PING 192.168.1.126: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 192.168.1.126: bytes=56 Sequence=2 ttl=127 time=50 ms
    Reply from 192.168.1.126: bytes=56 Sequence=3 ttl=127 time=50 ms
    Reply from 192.168.1.126: bytes=56 Sequence=4 ttl=127 time=60 ms
    Reply from 192.168.1.126: bytes=56 Sequence=5 ttl=127 time=40 ms

  --- 192.168.1.126 ping statistics ---
    5 packet(s) transmitted
    4 packet(s) received
    20.00% packet loss
    round-trip min/avg/max = 40/50/60 ms

<r1>ping -a 192.168.1.33 192.168.1.125
  PING 192.168.1.125: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 192.168.1.125: bytes=56 Sequence=2 ttl=127 time=50 ms
    Reply from 192.168.1.125: bytes=56 Sequence=3 ttl=127 time=50 ms
    Reply from 192.168.1.125: bytes=56 Sequence=4 ttl=127 time=60 ms
    Reply from 192.168.1.125: bytes=56 Sequence=5 ttl=127 time=50 ms

  --- 192.168.1.125 ping statistics ---
    5 packet(s) transmitted
    4 packet(s) received
    20.00% packet loss
    round-trip min/avg/max = 50/52/60 ms

<r1>ping -a 192.168.1.33 192.168.1.65 
  PING 192.168.1.65: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.65: bytes=56 Sequence=1 ttl=255 time=60 ms
    Reply from 192.168.1.65: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 192.168.1.65: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 192.168.1.65: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 192.168.1.65: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 192.168.1.65 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/30/60 ms

<r1>ping -a 192.168.1.33 192.168.1.129
  PING 192.168.1.129: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.129: bytes=56 Sequence=1 ttl=254 time=30 ms
    Reply from 192.168.1.129: bytes=56 Sequence=2 ttl=254 time=40 ms
    Reply from 192.168.1.129: bytes=56 Sequence=3 ttl=254 time=30 ms
    Reply from 192.168.1.129: bytes=56 Sequence=4 ttl=254 time=40 ms
    Reply from 192.168.1.129: bytes=56 Sequence=5 ttl=254 time=40 ms

  --- 192.168.1.129 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/36/40 ms

<r1>ssy
    ^
Error: Unrecognized command found at '^' position.
<r1>sys
Enter system view, return user view with Ctrl+Z.
[r1]ip rou
[r1]ip route-
[r1]ip route-static 192.168.1.32 27 n
[r1]ip route-static 192.168.1.32 27 NULL 0
[r1]ping 12.0.0.1
  PING 12.0.0.1: 56  data bytes, press CTRL_C to break
    Reply from 12.0.0.1: bytes=56 Sequence=1 ttl=253 time=40 ms
    Reply from 12.0.0.1: bytes=56 Sequence=2 ttl=253 time=30 ms
    Reply from 12.0.0.1: bytes=56 Sequence=3 ttl=253 time=40 ms
    Reply from 12.0.0.1: bytes=56 Sequence=4 ttl=253 time=40 ms
    Reply from 12.0.0.1: bytes=56 Sequence=5 ttl=253 time=30 ms

  --- 12.0.0.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/36/40 ms

[r1]ping -a 192.168.1.33 1.1.1.1
  PING 1.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=252 time=50 ms
    Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=252 time=70 ms
    Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=252 time=40 ms
    Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=252 time=40 ms
    Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=252 time=40 ms

  --- 1.1.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/48/70 ms

PC端可访问外网:

 R6登录到R1:

故障时切换:

eNSP(Enterprise Network Simulation Platform)是一款由华为开发的网络模拟器,用于模拟真实的网络设备和网络环境,以便于网络工程师进行网络设计、配置和故障排查的练习。配置静态路由是网络管理中的基础操作之一,它允许网络管理员手动设定数据包在不同网络间传输时的路径。 在eNSP中配置静态路由的基本步骤通常如下: 1. 启动eNSP软件并创建一个新的项目。 2. 从设备库中拖拽所需的路由器、交换机或PC等设备到工作区,并按照网络拓扑结构连接好设备。 3. 双击路由器设备,打开命令行界面(CLI)。 4. 进入系统视图,然后进入特定接口的配置模式,为接口分配IP地址。 5. 配置静态路由。通常使用命令 `ip route-static [目的网络] [子网掩码] [下一跳地址或出接口]` 来实现。这告诉路由器如何到达特定的目的网络,其中下一跳地址指的是数据包应该发送到的下一台设备的IP地址,而出接口则是直接连接到下一个网络的本地接口。 6. 保存配置,退出接口配置模式和系统视图。 7. 可以通过ping命令测试静态路由是否配置成功,确保不同网络间可以相互通信。 例如,如果需要配置一条从路由器A到达网络192.168.2.0/24的静态路由,且下一跳地址为路由器B的接口IP地址192.168.1.2,则命令如下: ``` ip route-static 192.168.2.0 255.255.255.0 192.168.1.2 ``` 或者如果下一跳是路由器A的直接相连接口,则可以是: ``` ip route-static 192.168.2.0 255.255.255.0 GigabitEthernet 0/0/1 ``` 这里`GigabitEthernet 0/0/1`代表路由器A的一个接口。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Smiling Mr. Rui

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值