HCIA配置实例(eNSP)

实验要求

  1. 全网可达
  2. 拓扑中所需地址全部基于192.168.0.0/24划分所得
  3. 全部使用静态路由
  4. RB环回需要汇总

在这里插入图片描述

分析

全网所需网段为9段,则向主机位借4位

192.168.0.0/28
192.168.0.16/28
192.168.0.32/28
192.168.0.48/28
192.168.0.64/28
192.168.0.80/28
192.168.0.96/28
192.168.0.112/28
192.168.0.128/28

其中将192.168.0.0/28化为三个环回网段

192.168.0.0/30
192.168.0.4/30
192.168.0.8/30

配置

IP地址配置

R1

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 192.168.0.1 30
[R1-LoopBack0]q
[R1]interface LoopBack 1
[R1-LoopBack1]ip address 192.168.0.5 30 
[R1-LoopBack1]q
[R1]interface LoopBack 2
[R1-LoopBack2]ip address 192.168.0.9 30
[R1-LoopBack2]q
[R1]interface g0/0/0 
[R1-GigabitEthernet0/0/0]ip address 192.168.0.17 28
Jul 17 2022 20:42:39-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]q
[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.0.98 28
Jul 17 2022 20:43:23-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. 

R2

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.0.18 28
Jul 17 2022 20:48:10-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]q
[R2]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.0.33 28
Jul 17 2022 20:48:26-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. 

R3

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.0.34 28
Jul 17 2022 20:50:40-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R3-GigabitEthernet0/0/0]q
[R3]interface g0/0/2
[R3-GigabitEthernet0/0/2]ip address 192.168.0.49 28
Jul 17 2022 20:52:13-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R3-GigabitEthernet0/0/2]q
[R3]interface g4/0/0
[R3-GigabitEthernet4/0/0]ip address 192.168.0.65 28
Jul 17 2022 20:52:50-08:00 R3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP on the interface GigabitEthernet4/0/0 has entered the UP state. 
[R3-GigabitEthernet4/0/0]q
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip address 192.168.0.81 28
Jul 17 2022 20:53:15-08:00 R3 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. 

R5

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R5
[R5]interface g0/0/0
[R5-GigabitEthernet0/0/0]ip address 192.168.0.50 28
Jul 17 2022 20:55:28-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R5-GigabitEthernet0/0/0]q
[R5]interface g0/0/2
[R5-GigabitEthernet0/0/2]ip address 100.1.1.1 24
Jul 19 2022 13:04:25-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R5-GigabitEthernet0/0/2]q
[R5]interface g0/0/1
[R5-GigabitEthernet0/0/1]ip address 192.168.0.66 28
Jul 17 2022 20:55:44-08:00 R5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state.

R6

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname ISP
[ISP]interface g0/0/0
[ISP-GigabitEthernet0/0/0]ip address 100.1.1.2 24

R4及虚拟子接口,dhcp

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R4
[R4]interface g0/0/0
[R4-GigabitEthernet0/0/0]ip address 192.168.0.82 28
Jul 17 2022 20:30:26-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R4-GigabitEthernet0/0/0]q
[R4]interface g0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.0.99 28

//虚拟子接口
[R4]interface g0/0/2.1
[R4-GigabitEthernet0/0/2.1]dot1q termination vid 2
[R4-GigabitEthernet0/0/2.1]ip address 192.168.0.113 28
Jul 17 2022 20:31:16-08:00 R4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP on the interface GigabitEthernet0/0/2.1 has entered the UP state. 
[R4-GigabitEthernet0/0/2.1]arp broadcast enable 
[R4-GigabitEthernet0/0/2.1]q
[R4]int g0/0/2.2
[R4-GigabitEthernet0/0/2.2]dot1q termination vid 3
[R4-GigabitEthernet0/0/2.2]ip address 192.168.0.129 28
Jul 17 2022 20:31:38-08:00 R4 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP on the interface GigabitEthernet0/0/2.2 has entered the UP state. 
[R4-GigabitEthernet0/0/2.2]arp broadcast enable 
[R4-GigabitEthernet0/0/2.2]q

//dhcp池
[R4]ip pool xixi
Info: It is successful to create an IP address pool.
[R4-ip-pool-xixi]network 192.168.0.112 mask 255.255.255.240
[R4-ip-pool-xixi]gateway-list 192.168.0.113
[R4-ip-pool-xixi]dns-list 8.8.8.8
[R4-ip-pool-xixi]q
[R4]ip pool haha
Info: It's successful to create an IP address pool.
[R4-ip-pool-haha]network 192.168.0.128 mask 255.255.255.240
[R4-ip-pool-haha]gateway-list 192.168.0.129
[R4-ip-pool-haha]dns-list 8.8.8.8
[R4-ip-pool-haha]q

//先开启DHCP
[R4]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[R4]interface g0/0/2.1
[R4-GigabitEthernet0/0/2.1]dhcp select global 
[R4-GigabitEthernet0/0/2.1]q
[R4]interface g0/0/2.2
[R4-GigabitEthernet0/0/2.2]dhcp select global

VLAN 划分

//SW1
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
[SW1]vlan batch 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]interface g0/0/4
[SW1-GigabitEthernet0/0/4]port link-type trunk
[SW1-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/4]q
[SW1]int
[SW1]interface g0/0/3
[SW1-GigabitEthernet0/0/3]port link-type trunk
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/3]q
[SW1]interface g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 2
[SW1-GigabitEthernet0/0/1]q
[SW1]interface g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 3
//SW2
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW2
[SW2]vlan batch 2 3 
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]interface g0/0/3
[SW2-GigabitEthernet0/0/3]port link-type trunk
[SW2-GigabitEthernet0/0/3]port trunk allow-pass vlan all 
[SW2-GigabitEthernet0/0/3]q
[SW2]interface g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type access
[SW2-GigabitEthernet0/0/1]port default vlan 2
[SW2-GigabitEthernet0/0/1]q
[SW2]interface g0/0/2
[SW2-GigabitEthernet0/0/2]port link-type access
[SW2-GigabitEthernet0/0/2]port default vlan 3

静态路由

//R1
[R1]ip route-static 192.168.0.32 28 192.168.0.18
[R1]ip route-static 192.168.0.48 28 192.168.0.18
[R1]ip route-static 192.168.0.64 28 192.168.0.18
[R1]ip route-static 192.168.0.80 28 192.168.0.99
[R1]ip route-static 192.168.0.112 28 192.168.0.99
[R1]ip route-static 192.168.0.128 28 192.168.0.99
//R2
[R2]ip route-static 192.168.0.96 255.255.255.240 192.168.0.17
[R2]ip route-static 192.168.0.48 255.255.255.240 192.168.0.34
[R2]ip route-static 192.168.0.64 255.255.255.240 192.168.0.34
[R2]ip route-static 192.168.0.80 255.255.255.240 192.168.0.34
[R2]ip route-static 192.168.0.112 255.255.255.240 192.168.0.34
[R2]ip route-static 192.168.0.128 255.255.255.240 192.168.0.34
//R3
[R3]ip route-static 192.168.0.96 255.255.255.240 192.168.0.82
[R3]ip route-static 192.168.0.16 255.255.255.240 192.168.0.33
[R3]ip route-static 192.168.0.112 255.255.255.240 192.168.0.82
[R3]ip route-static 192.168.0.128 255.255.255.240 192.168.0.82
//R4
[R4]ip route-static 192.168.0.32 255.255.255.240 192.168.0.81
[R4]ip route-static 192.168.0.16 255.255.255.240 192.168.0.98
[R4]ip route-static 192.168.0.48 255.255.255.240 192.168.0.81
[R4]ip route-static 192.168.0.64 255.255.255.240 192.168.0.81
//R5
[R5]ip route-static 192.168.0.96 255.255.255.240 192.168.0.49
[R5]ip route-static 192.168.0.16 255.255.255.240 192.168.0.49
[R5]ip route-static 192.168.0.32 255.255.255.240 192.168.0.49
[R5]ip route-static 192.168.0.80 255.255.255.240 192.168.0.49
[R5]ip route-static 192.168.0.112 255.255.255.240 192.168.0.49
[R5]ip route-static 192.168.0.128 255.255.255.240 192.168.0.49

R1上的汇总

//R1(空接口防环路由)
[R1]ip route-static 192.168.0.0 28 NULL 0
//R2
[R2]ip route-static 192.168.0.0 28 192.168.0.17
//R3
[R3]ip route-static 192.168.0.0 28 192.168.0.33
[R3]ip route-static 192.168.0.0 28 192.168.0.82
//R4
[R4]ip route-static 192.168.0.0 28 192.168.0.98
//R5
[R5]ip route-static 192.168.0.0 28 192.168.0.49
[R5]ip route-static 192.168.0.0 28 192.168.0.65

指向公网的缺省

//R1
[R1]ip route-static 0.0.0.0 0 192.168.0.18
[R1]ip route-static 0.0.0.0 0 192.168.0.99
//R2
[R2]ip route-static 0.0.0.0 0 192.168.0.34
//R3
[R3]ip route-static 0.0.0.0 0 192.168.0.50
[R3]ip route-static 0.0.0.0 0 192.168.0.66 preference 80	//浮动静态路由
Jul 19 2022 13:31:39-08:00 R3 %%01RM/4/IPV4_DEFT_RT_CHG(l)[0]:IPV4 default Route is changed. (ChangeType=Delete, InstanceId=0, Protocol=Static, ExitIf=GigabitEthernet4/0/0, Nexthop=192.168.0.66, Neighbour=0.0.0.0, Preference=1342177280, Label=NULL, Metric=0) 
Info: Succeeded in modifying route.
//R4
[R4]ip route-static 0.0.0.0 0 192.168.0.81
//R5
[R5]ip route-static 0.0.0.0 0 100.1.1.2

NAT

[R5]acl 2000
[R5-acl-basic-2000]r
[R5-acl-basic-2000]ru    
[R5-acl-basic-2000]rule 1 p
[R5-acl-basic-2000]rule 1 permit s
[R5-acl-basic-2000]rule 1 permit source a
[R5-acl-basic-2000]rule 1 permit source any 
[R5-acl-basic-2000]q
[R5]int
[R5]interface g0/0/2
[R5-GigabitEthernet0/0/2]n
[R5-GigabitEthernet0/0/2]nat o
[R5-GigabitEthernet0/0/2]nat outbound 2000

连通性测试:PC3 --> ISP
在这里插入图片描述

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

1ta-chi

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

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

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

打赏作者

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

抵扣说明:

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

余额充值