HCIA实验复习
一.拓扑图
二.需求分析
子网划分
一个环回需要配置一个独立网段,R1,R2,R4各自有两个环回,R5,R6各自有一个环回,因为R6已经给定了网段,所以需要7个网段;R3也需要一个独立网段连接交换机,此时需要8个网段;骨干链路也需要独立网段,所以一共需要14个网段。因为题目要求路由表尽量小,所以需要汇总,所以把R1、R2、R4的两个两个环回地址汇总一下,变成一个网段;六个骨干链路,每个骨干链路需要2个地址,所以进行地址分配的时候要本着节约地址的原则,所以借出三个网段,所以,只需要6个网段。
首先将192.168.1.0/24划分为(取其6):
192.168.1.0/27 (骨干) 192.168.1.32/27 192.168.1.64/27 192.168.1.96/27 (R3) 192.168.1.128/27 192.168.1.160/27 (R5环回) 192.168.1.192/27 192.168.1.224/27
将192.168.1.0/27用于骨干网段在此进行划分,避免地址浪费,便于管理直接划分为
(取其6):
192.168.1.0/30 192.168.1.4/30 192.168.1.8/30 192.168.1.12/30 192.168.1.16/30 192.168.1.20/30 192.168.1.24/30 192.168.1.128/30
将R1,R2 , R4的网段二次划分为两个环回地址:
R1:192.168.1.32/27:192.168.1.32/28 192.168.1.48/28
R2:192.168.1.64/27 :192.168.1.64/28 192.168.1.80/28
R4:192.168.1.128/27 :192.168.1.128/28 192.168.1.144/28
三.配置
配ip
[r1]int g 0/0/1
[r1-GigabitEthernet0/0/1]ip add
[r1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
Mar 18 2024 20:14:56-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r1-GigabitEthernet0/0/1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
Mar 18 2024 20:18:55-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]int lo0
[r1-LoopBack0]ip address 192.168.1.33 28
[r1-LoopBack0]int lo1
[r1-LoopBack1]ip address 192.168.1.49 28
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add
[r2-GigabitEthernet0/0/0]ip address 192.168.1.2 30
Mar 18 2024 20:31:32-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]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip add
[r2-GigabitEthernet0/0/1]ip address 192.168.1.9 30
Mar 18 2024 20:33:18-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2-GigabitEthernet0/0/1]int lo0
[r2-LoopBack0]ip address 192.168.1.65 28
[r2-LoopBack0]int lo1
[r2-LoopBack1]ip address 192.168.1.81 28
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.6 30
Mar 18 2024 20:39:02-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]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.13 30
[r3-GigabitEthernet0/0/1]
Mar 18 2024 20:41:25-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]int g0/0/2
[r3-GigabitEthernet0/0/2]ip add 192.168.1.97 27
[r3-GigabitEthernet0/0/2]
Mar 18 2024 20:42:39-08:00 r3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.10 30
Mar 18 2024 20:43:59-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]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.14 30
Mar 18 2024 20:45:04-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]int g 4/0/0
[r4-GigabitEthernet4/0/0]ip add 192.168.1.21 30
[r4-GigabitEthernet4/0/0]
Mar 18 2024 20:49:04-08:00 r4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[r4-GigabitEthernet4/0/0]int g0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.1.17 30
[r4-GigabitEthernet0/0/2]
Mar 18 2024 20:50:41-08:00 r4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r4-GigabitEthernet0/0/2]int lo0
[r4-LoopBack0]int lo1
[r4-LoopBack1]ip add 192.168.1.145 28
[r4-LoopBack1]int lo0
[r4-LoopBack0]ip add 192.168.1.129 28
[Huawei]sys r5
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.18 30
Mar 18 2024 20:57:07-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]int g0/0/2
[r5-GigabitEthernet0/0/2]ip add 192.168.1.22 30
Mar 18 2024 20:58:05-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r5-GigabitEthernet0/0/2]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 12.0.0.1 24
Mar 18 2024 20:59:47-08:00 r5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r5-GigabitEthernet0/0/1]int lo0
[r5-LoopBack0]ip add 192.168.1.161 27
[r5-LoopBack0]
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[r6-GigabitEthernet0/0/0]
Mar 18 2024 21:03:41-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r6-GigabitEthernet0/0/0]int lo0
[r6-LoopBack0]ip add 1.1.1.1 24
[r6-LoopBack0]
开启DHCP
[r3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r3]ip pool a
Info: It's successful to create an IP address pool.
[r3-ip-pool-a]network 192.168.1.96 mask 27
[r3-ip-pool-a]gate
[r3-ip-pool-a]gateway-list 192.168.1.97
[r3-ip-pool-a]dns
[r3-ip-pool-a]dns-list 114.114.114.114 8.8.8.8
[r3-ip-pool-a]int g0/0/2
[r3-GigabitEthernet0/0/2]dhcp
[r3-GigabitEthernet0/0/2]dhcp s
[r3-GigabitEthernet0/0/2]dhcp select g
[r3-GigabitEthernet0/0/2]dhcp select global
关闭百兆接口
[r4]int g4/0/0
[r4-GigabitEthernet4/0/0]shu
[r4-GigabitEthernet4/0/0]shutdown
Mar 18 2024 21:21:15-08:00 r4 %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEthern
et4/0/0 has turned into DOWN state.
[r4-GigabitEthernet4/0/0]
[r4-GigabitEthernet4/0/0]
Mar 18 2024 21:21:15-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the DOWN state.
[r4-GigabitEthernet4/0/0]
写缺省路由
[r1]ip route-static 192.168.1.8 30 192.168.1.2
[r1]ip route-static 192.168.1.12 30 192.168.1.6
[r1]ip route-static 192.168.1.96 27 192.168.1.6
[r1]ip route-static 0.0.0.0 0 192.168.1.2
[r1]ip route-static 0.0.0.0 0 192.168.1.6
[r2]ip route-static 192.168.1.32 27 192.168.1.1
[r2]ip route-static 192.168.1.4 30 192.168.1.1
[r2]ip route-static 192.168.1.96 27 192.168.1.1
[r2]ip route-static 192.168.1.32 27 192.168.1.10
[r2]ip route-static 0.0.0.0 0 192.168.1.10
[r3]ip route-static 192.168.1.32 27 192.168.1.5
[r3]ip route-static 192.168.1.0 30 192.168.1.5
[r3]ip route-static 192.168.1.64 27 192.168.1.5
[r3]ip route-static 192.168.1.64 27 192.168.1.14
[r3]ip route-static 0.0.0.0 0 192.168.1.14
[r4]ip route-static 192.168.1.64 27 192.168.1.9
[r4]ip route-static 192.168.1.64 27 192.168.1.9
[r4]ip route-static 192.168.1.0 30 192.168.1.9
[r4]ip route-static 192.168.1.32 27 192.168.1.9
[r4]ip route-static 192.168.1.32 27 192.168.1.13
[r4]ip route-static 192.168.1.4 30 192.168.1.13
[r4]ip route-static 192.168.1.96 27 192.168.1.13
[r4]ip route-static 0.0.0.0 0 192.168.1.18
[r4]ip route-static 0.0.0.0 0 192.168.1.22
[r5]ip route-static 192.168.1.128 27 192.168.1.17
[r5]ip route-static 192.168.1.96 27 192.168.1.17
[r5]ip route-static 192.168.1.64 27 192.168.1.17
[r5]ip route-static 192.168.1.32 27 192.168.1.17
[r5]ip route-static 192.168.1.8 30 192.168.1.17
[r5]ip route-static 192.168.1.0 30 192.168.1.17
[r5]ip route-static 192.168.1.4 30 192.168.1.17
[r5]ip route-static 192.168.1.12 30 192.168.1.17
[r5]ip route-static 0.0.0.0 0 12.0.0.2
避免环路
[r1]ip tatic 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
NAT(一对多)
[r5]acl 2000
[r5-acl-basic-2000]rule per
[r5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r5-acl-basic-2000]int g 0/0/1
[r5-GigabitEthernet0/0/1]nat outbound 2000
R4与R5正常通过1000M链路,故障时通过100M链路;
[r4]ip route-static 0.0.0.0 0 192.168.1.22 preference 61
[r5]ip route-static 192.168.1.0 255.255.255.252 192.168.1.21 pr 61
[r5]ip route-static 192.168.1.4 255.255.255.252 192.168.1.21 pr 61
[r5]ip route-static 192.168.1.8 255.255.255.252 192.168.1.21 pr 61
[r5]ip route-static 192.168.1.12 255.255.255.252 192.168.1.21 pr 61
[r5]ip route-static 192.168.1.32 255.255.255.224 192.168.1.21 pr 61
[r5]ip route-static 192.168.1.64 255.255.255.224 192.168.1.21 pr 61
[r5]ip route-static 192.168.1.128 255.255.255.224 192.168.1.21 pr 61
R6telnetR5的公有Ip地址时,实际登陆到R1上
[r1]aaa
[r1-aaa]local
[r1-aaa]local-user liuu p
[r1-aaa]local-user liuu password c
[r1-aaa]local-user liuu password cipher 1234
Info: Add a new user.
[r1-aaa]local-user liuu service-type telnet
[r1-aaa]user-i
[r1-aaa]user-i
[r1-aaa]user-interface vty 0 4
[r1-ui-vty0-4]au
[r1-ui-vty0-4]authentication-mode aaa
[r1-ui-vty0-4]q
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 inside 192.168.1.1 23
Warning:The port 23 is well-known port. If you continue it may cause function fa
ilure.
Are you sure to continue?[Y/N]:y
四.测试
R3下的两台Pc通
R1-R5均可以访问R6的环回
R6telnetR5的公有Ip地址时,实际登陆到R1上
``