hcia静态实验

时间:2024-03-24 21:45:07

题目:

要求:

1、R6为isp,接口ip均为公有地址,该设备只能配置ip地址,之后不能再对其进行任何其他配置
2、r1到r5为局域网,私有ip地址为192.168.1.0 24,合理分配
3、r1,r2,r4各有两个环回地址,r5r6各有一个环回地址,路由器上所有环回均代表连接用户的接口
4、r3下的两台pc通过dhcp自动获取ip地址
5、选录最佳,路由表尽量少,避免环路
6、r1到r5均可访问r6的环回
7、r6telnetr5的公有ip地址时,实际登录到r1上
8、r4与r5正常通过1000M,故障时通过100M链路

分析:

由图可得知,由6条骨干链路,8条非骨干链路。

192.168.1.0 24

192.168.1.0 27------骨干
   192.168.1.000000 00 1.0/30 r1 r2
   192.168.1.000001 00 1.4/30 r1 r3
   192.168.1.000010 00 1.8/30 r2 r4
   192.168.1.000011 00 1.12/30 r3 r4
   192.168.1.000100 00 1.16/30 r4 r5上
   192.168.1.000101 00 1.20/30 r4 r5下
   192.168.1.000110 00 1.24/30
   192.168.1.000111 00 1.28/30
192.168.1.001 00000 27  1.32/27 r1环回
   192.168.1.001 0 0000 1.32/28
   192.168.1.001 1 0000 1.48/28
192.168.1.010 00000 27  1.64/27 r2环回
   192.168.010 0 0000 1.64/28
   192.168.010 1 0000 1.80/28
192.168.1 011 00000 27  1.96/27 r3
192.168.1.100 00000 27  1.128/27 r4环回
   192.168.1.100 0 0000 1.128/28
   192.168.1.100 1 0000 1.144/28
192.168.1.101 00000 27  1.160/27 r5环回
192.168.1.110 00000 27  1.192/27 保留地址
192.168.1.111 00000 27  1.224/27 保留地址

分配好ip地址后,将地址写在路由器旁边便于观察

随后进行ip地址操作

r1:

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
Mar 21 2024 19:15:13-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]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
[r1-GigabitEthernet0/0/1]
Mar 21 2024 19:15:28-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r1-GigabitEthernet0/0/1]q
[r1]int LoopBack 0
[r1-LoopBack0]ip address 192.168.1.33 28
[r1-LoopBack0]q
[r1]int LoopBack 1
[r1-LoopBack1]ip address 192.168.1.49 28

r2:

[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.1.2 30
Mar 21 2024 19:16:49-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 g0/0/1
[r2-GigabitEthernet0/0/1]ip address 192.168.1.9 30
Mar 21 2024 19:17:05-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]q
[r2]int LoopBack 0
[r2-LoopBack0]ip address 192.168.1.65 28
[r2-LoopBack0]q
[r2]int LoopBack 1
[r2-LoopBack1]ip address 192.168.1.81 28

r3:

[Huawei]sys r3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.1.6 30
Mar 21 2024 19:18:08-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 g0/0/1
[r3-GigabitEthernet0/0/1]ip address
[r3-GigabitEthernet0/0/1]ip address 192.168.1.13 30

r4:

[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.10 30
Mar 21 2024 19:18:54-08:00 r4 %%01IFNET/4/LINK_STATE(l)[4]: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 address 192.168.1.14 30
[r4-GigabitEthernet0/0/1]
Mar 21 2024 19:19:08-08:00 r4 %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]int g0/0/2
[r4-GigabitEthernet0/0/2]ip address 192.168.1.17 30
[r4-GigabitEthernet0/0/2]
Mar 21 2024 19:19:28-08:00 r4 %%01IFNET/4/LINK_STATE(l)[6]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r4-GigabitEthernet0/0/2]int g4/0/0
[r4-GigabitEthernet4/0/0]ip address 192.168.1.21 30

r5:

[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip address 192.168.1.18 30
Mar 21 2024 19:20:25-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 address 192.168.1.22 30
Mar 21 2024 19:20:48-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 address 12.0.0.1 24
[r5-GigabitEthernet0/0/1]
Mar 21 2024 19:21:11-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]q
[r5]int LoopBack 0
[r5-LoopBack0]ip address 192.168.1.160 27
Error: The specified IP address is invalid.
[r5-LoopBack0]ip address 192.168.1.161 27

r6:

[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip address 12.0.0.2 24
Mar 21 2024 19:21:55-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]q
[r6]int LoopBack 0
[r6-LoopBack0]ip address 1.1.1.1 24
 

随后进行dhcp分配地址操作:

[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]net   
[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]q
[r3]int g0/0/2
[r3-GigabitEthernet0/0/2]ip address 192.168.1.97 27
[r3-GigabitEthernet0/0/2]
Mar 21 2024 19:30:22-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r3-GigabitEthernet0/0/2]dhcp select global

此时,dhcp地址分配成功

随后,使用静态使得全网可通

r1:

[r1]ip route-static 192.168.1.8 30 192.168.1.2
[r1]ip route-static 192.168.1.64 27 192.168.1.2
[r1]ip route-static 192.168.1.12 30 192.168.1.
[r1]ip route-static 192.168.1.96 27 192.168.1.6
[r1]ip route-static 192.168.1.128 27 192.168.1.2
[r1]ip route-static 192.168.1.128 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

其中,通往r4的环回可以不写,但是为了拓扑的稳定,我选择写,一共8或6条路由。

r2:

[r2]display this
ip route-static 0.0.0.0 0.0.0.0 192.168.1.10
ip route-static 192.168.1.4 255.255.255.252 192.168.1.1
ip route-static 192.168.1.32 255.255.255.224 192.168.1.1
ip route-static 192.168.1.96 255.255.255.224 192.168.1.10
ip route-static 192.168.1.96 255.255.255.224 192.168.1.1

一共5条路由

r3:

[r3]display this
 
ip route-static 0.0.0.0 0.0.0.0 192.168.1.14
ip route-static 192.168.1.0 255.255.255.252 192.168.1.5
ip route-static 192.168.1.32 255.255.255.224 192.168.1.5
ip route-static 192.168.1.64 255.255.255.224 192.168.1.5
ip route-static 192.168.1.64 255.255.255.224 192.168.1.14

一共5条路由

r4:

[r4]display this
 
ip route-static 0.0.0.0 0.0.0.0 192.168.1.18
ip route-static 0.0.0.0 0.0.0.0 192.168.1.22 preference 90
ip route-static 192.168.1.0 255.255.255.252 192.168.1.9
ip route-static 192.168.1.4 255.255.255.252 192.168.1.13
ip route-static 192.168.1.32 255.255.255.224 192.168.1.9
ip route-static 192.168.1.32 255.255.255.224 192.168.1.13
ip route-static 192.168.1.64 255.255.255.224 192.168.1.9

一共7条路由

r5:

[r5]display this
 
ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
ip route-static 192.168.1.0 255.255.255.0 192.168.1.17
ip route-static 192.168.1.0 255.255.255.0 192.168.1.21 preference 90

r5写路由可以对前面的进行汇总减少工作量

至此,局域网全网可达

通达检验:

PC>ping 192.168.1.18

Ping 192.168.1.18: 32 data bytes, Press Ctrl_C to break
From 192.168.1.18: bytes=32 seq=1 ttl=253 time=31 ms
From 192.168.1.18: bytes=32 seq=2 ttl=253 time=62 ms
From 192.168.1.18: bytes=32 seq=3 ttl=253 time=47 ms
From 192.168.1.18: bytes=32 seq=4 ttl=253 time=32 ms
From 192.168.1.18: bytes=32 seq=5 ttl=253 time=46 ms

--- 192.168.1.18 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 31/43/62 ms

PC>ping 12.0.0.1

Ping 12.0.0.1: 32 data bytes, Press Ctrl_C to break
From 12.0.0.1: bytes=32 seq=1 ttl=253 time=47 ms
From 12.0.0.1: bytes=32 seq=2 ttl=253 time=15 ms
From 12.0.0.1: bytes=32 seq=3 ttl=253 time=31 ms
From 12.0.0.1: bytes=32 seq=4 ttl=253 time=47 ms
From 12.0.0.1: bytes=32 seq=5 ttl=253 time=62 ms

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

随后,进行防环操作,其中,r5不仅要对自己的环进行防环操作,还要对保留ip进行放环操作,

[r1]ip route-static 192.168.1.32 27 NULL 0
[r2]ip route-static 192.168.1.64 27 NULL 0

[r3]ip route-static 192.168.1.96 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

[r5]ip route-static 192.168.1.192 27 NULL 0  
[r5]ip route-static 192.168.1.224 27 NULL 0

此时,pc  ping通检验,

pc1:

PC>ping 1.1.1.1

Ping 1.1.1.1: 32 data bytes, Press Ctrl_C to break
From 1.1.1.1: bytes=32 seq=1 ttl=252 time=78 ms
From 1.1.1.1: bytes=32 seq=2 ttl=252 time=63 ms
From 1.1.1.1: bytes=32 seq=3 ttl=252 time=46 ms
From 1.1.1.1: bytes=32 seq=4 ttl=252 time=47 ms
From 1.1.1.1: bytes=32 seq=5 ttl=252 time=47 ms

--- 1.1.1.1 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 46/56/78 ms

随后,在r5上做nat,

[r5]acl 2000
[r5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r5-acl-basic-2000]q
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]nat outbound 2000
[r5-GigabitEthernet0/0/1]q
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]nat server protocol tcp global current-interface telnet
 inside 192.168.1.1 telnet
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

随后,在r1上做telnet服务,

[r1]user-interface vty 0 4
[r1-ui-vty0-4]authentication-mode aaa
[r1-ui-vty0-4]q
[r1]aaa
[r1-aaa]local-user huawei password cipher 123456
Info: Add a new user.
[r1-aaa]local-user huawei privilege level 15
[r1-aaa]local-user huawei service-type telnet

随后,先在局域网内进行telnet测试,

<r2>tel    
<r2>telnet 192.168.1.1
  Press CTRL_] to quit telnet mode
  Trying 192.168.1.1 ...
  Connected to 192.168.1.1 ...

Login authentication


Username:huawei
Password:
<r1>

随后,在r6上进行telnet测试,

<r6>telnet 12.0.0.1
  Press CTRL_] to quit telnet mode
  Trying 12.0.0.1 ...
  Connected to 12.0.0.1 ...

Login authentication


Username:
  Username timeout expired
Username:huawei
Password:
  -----------------------------------------------------------------------------
    
  User last login information:     
  -----------------------------------------------------------------------------
  Access Type: Telnet      
  IP-Address : 192.168.1.2     
  Time       : 2024-03-21 21:13:48-08:00     
  -----------------------------------------------------------------------------
<r1>

至此,实验完成。