HCIA配置实例(eNSP)

HCIA配置实例(eNSP)

Itachi

实验要求

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

img

分析

全网所需网段为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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<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

1
2
3
4
5
6
7
8
9
10
<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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<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

1
2
3
4
5
<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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<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 划分

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//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

静态路由

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//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上的汇总

1
2
3
4
5
6
7
8
9
10
11
12
//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

指向公网的缺省

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//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

1
2
3
4
5
6
7
8
9
10
11
12
13
[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
img

  • 标题: HCIA配置实例(eNSP)
  • 作者: Itachi
  • 创建于 : 2022-07-19 13:37:49
  • 更新于 : 2022-07-19 16:51:04
  • 链接: https://blog.tarchi.top/hcia/HCIA配置实例(eNSP)/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
 评论
此页目录
HCIA配置实例(eNSP)