HCIP——HCIA回顾及静态实验

HCIP

HCIA

1、七层参考模型及IP讲解
2、TCP三次握手讲解
3、TCP四次挥手讲解及抓包分析
4、DHCP协议讲解及抓包分析
5、静态综合实验讲解
7、静态路由讲解
8、RIP路由信息协议讲解
9、动态路由协议讲解
10、抓包进行分析RIP以及OSPF的包
11、动态路由OSPF配置综合实验讲解
12、Vlan虚拟局域网技术讲解
13、ACL访问控制列表讲解
14、NAT技术讲解
15、网络综合实验讲解

一、知识回顾

1、OSI七层参考模型:

物理层 ------定义电气电压接口规范光学特性
数据链路层

  • MAC媒介访问控制层
  • LLC逻辑链路层(为上层提供FCS校验)

网络层 ------通过IP地址进行逻辑寻址,代表设备路由器。

物理层,数据链路层以及网络层能不能全网可达?可以全网可达。

传输层 ------通过端口号区分不同的服务,数据分段,确认重传排序流控(只针对于TCP)。

  • TCP面向连接的可靠传输协议
    面向连接: 三次握手以及四次挥手(主要体现),
    可靠: 确认,重传,排序以及流控。
    常见的四层协议; TCPUDP
    常见的三层协议: IPICMPARP
  • UDP非面向连接的不可靠传输协议

会话层 ------建立,维持,终止会话进程。
表示层 ------编码解码,加密解密
应用层------实现人机交互的界面

数据封装以及解封装

以太网一类帧二类帧封装------IP------TCP/UDP------data数据包------FCS校验(逻辑链路层提供)
数据分段的标准,MYU最大传输单元1500字节,MSS最大段长度,1480。(原因是报头长度为20字节)

TCP-IP协议栈与OSI模型对比:

  • 相同点:
    1、都是模型化层次
    2、下层对上层提供服务支持
    3、每层协议彼此相互独立
  • 不同点:
    1、TCP-IP协议栈:先有协议后有模型,只是使用于TCP-IP网络。
    2、OSI七层参考模型:先有模型后有协议。
    3、层数不同

滑动窗口就是流控,什么是滑动窗口?其实是吞吐量的问题。

2、重要的三个协议报头格式

IPV4数据包结构:


IPV4数据包格式:

  • 版本(号): 这4比特规定了数据报的IP协议版本。通过查看版本号,路由器能够确定如何解释IP数据报的剩余部分。不同的IP版本使用不同的数据报格式。
  • 首部长度: 因为IPV4数据报可包含一些可变数量的选项(这些选项包括在IPV4数据报首部中),故需要用这4个比特来确定IP数据报中载荷(例如在这个数据报中被封装的运输层报文段)实际开始的地方。大多数IP数据报不包含选项,所以一般的IP数据报具有20字节的首部。
  • 服务类型: 服务类型(TOS)比特包含在IPV4首部中,以便使不同类型的IP数据报能相互与别开来,例如,将实时数据报(如用于IP电话应用)与非实时流量(如FTP)区分开也许是有用的。提供特定等级的服务是一个由网络管理员为路由器确定和配置的策略问题。
  • 数据报长度: 这是IP数据报的总长度(首部加上数据),以字节计。因为该字段长为16比特,所以IP数据报的理论最大长度为65535字节。然而,数据报很少有超过1500字节的。该长度使得IP数据报能容纳最大长度以太网帧的载荷字段。
  • 标识、标志、片偏移: 这三个字段与所谓的IP分片有关:一个大的IP数据报被分解成几个小的IP数据报,然后这些小的IP数据报被独立地转发到目的地,在这里被重新组装,然后其有效载荷数据向上传递到目的主机的运输层。
  • 生存时间TTL: TTL字段用来确保数据报不会永远(如由于长时间的路由选择环路)在网络中循环。每当一台路由器处理数据报时,该字段的值就会减1,若TTL字段减为0,则该数据报必须丢弃。
  • 协议: 该字段通常仅当一个IP数据报到达其最终目的地时才会有用。该字段值指示了IP数据报的数据部分要交给TCP,而值为17表明数据部分交给了UDP。协议号是将网络层和传输层绑定在一起的粘合剂,而端口号则是将传输层与应用层粘合在一起。
  • 首部校验和: 首部校验和用于帮助路由器检测收到的IP数据报中得比特错误。首部校验和是这样计算的:将首部中的每2个字节当作一个数,用反码算术对这些数求和。
  • 源和目的地址: 当某源生成一个数据报时,它在源IP字段中插入它的IP地址。在目的IP地址字段中插入其最终目的地的地址。通常源主机通过DNS查找来决定目的地址。
  • 选项: 选项字段允许IP首部被扩展。首部选项意味着很少使用。因此决定对每个数据报首部不包含选项字段中的信息,能够节约开销。
  • 数据(有效载荷): IP数据报中的数组字段包含要交付给目的地的传输层报文段(TCP或UDP)

注意到一个IP数据报由总长为20字节的首部(假设无选项)。如果数据报承载一个TCP报文段,则每个(无分片的)数据报共承载了总长40字节的首部(20字节的IP首部加上20字节的TCP首部)以及应用层报文。
UDP数据报结构:

TCP数据报结构:

与UDP一样,首部包含了源端口号与目的端口号,它被用于多路复用/分解来自或送到上层应用的数据,另外,同UDP一样,TCP同样有检验和字段。

  • 32比特的序号字段以及32比特的确认号字段: 用来实现可靠数据传输服务。
  • 16比特的接受窗口字段: 用于流量控制。
  • 4比特的首部长度字段: 指示了以32比特的字为单位的TCP首部长度。
    由于TCP选项字段的原因,TCP首部的长度是可变的,通常情况下,选项字段为空,所以TCP首部的典型长度为20字节。
  • 可选与变长的选项字段: 用于发送方与接收方协商最大报文长度(MSS)时,或在高速网络环境下用作窗口调节因子时使用。
  • 6比特的标志字段 ACK比特用于指示确认字段中的值是有效的,即该报文段包括一个对已被成功接收报文段的确认。

二、静态实验

1、实验拓扑图

2、实验要求

  • 1.全网可达
  • 2.拓扑中所需地址全部基于192.168.0.0/24划分所得
  • 3.静态路由(不许使用其他动态)
  • 4.R8环回需要汇总

3、实验思路

拓扑中所需地址基于192.168.0.0/24进行划分这里我们首先数图中需要多少个网段?

  • 骨干链路------6个网段
  • R1的环回上------1个网段
  • 两个vlan------两个网段

所以,我们首先进行划分网段

python 复制代码
192.168.0.0/24需要划分9个网段------也就向后借位,借4位
128-64-32-16-8-4-2-1
这里我们可以看到第四位为16:
那么,9个网段分别为:
192.168.0.0/28------R1环回
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------两个vlan
192.168。0.128/28
剩下的作为保留网段

而这里我们也需要对R1的环回进行划分,由实验要求的拓扑图可知,我们需要给它划分3个环回网段:

python 复制代码
192.168.0.0/28划分为3个网段,我们需要向后借2位
也就成了:
192.168.0.0/30
192.168.0.64/30
192.168.0.128/30
同时剩下的作为保留网段

拓扑图如下:

4、实验步骤

1、给接口划分IP地址以及配置环回地址

R1 实现代码:

bash 复制代码
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]user	
[R1]user-in	
[R1]user-interface con	
[R1]user-interface console 0
[R1-ui-console0]id	
[R1-ui-console0]idle-timeout 0 0
[R1-ui-console0]quit
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip ad	
[R1-GigabitEthernet0/0/0]ip address 192.168.0.17 28
Jul 17 2023 15:58:00-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 ad	
[R1-GigabitEthernet0/0/1]ip address 192.168.0.97 28
Jul 17 2023 15:58:16-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]quit
[R1]int l	
[R1]int LoopBack 0
[R1-LoopBack0]ip ad	
[R1-LoopBack0]ip address 192.168.0.1 30
[R1-LoopBack0]int l 1
[R1-LoopBack1]ip ad	
[R1-LoopBack1]ip address 192.168.0.65 30
[R1-LoopBack1]int l 2
[R1-LoopBack2]ip ad	
[R1-LoopBack2]ip address 192.168.0.129 30
[R1-LoopBack2]quit
[R1]

查看结果:全up

bash 复制代码
[R1]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.0.17/28      up         up        
GigabitEthernet0/0/1              192.168.0.97/28      up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         192.168.0.1/30       up         up(s)     
LoopBack1                         192.168.0.65/30      up         up(s)     
LoopBack2                         192.168.0.129/30     up         up(s)     
NULL0                             unassigned           up         up(s)     
[R1]

R2 实现代码:

bash 复制代码
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]use	
[R2]user-bind
[R2]user-group
[R2]user-interface con	
[R2]user-interface console 0
[R2-ui-console0]id	
[R2-ui-console0]idle-timeout 0 0
[R2-ui-console0]quit
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip ad	
[R2-GigabitEthernet0/0/0]ip address 192.168.0.18 28
Jul 17 2023 16:08:37-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 ad	
[R2-GigabitEthernet0/0/1]ip address 192.168.0.33 28
Jul 17 2023 16:08:54-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]quit
[R2]

查看结果:

bash 复制代码
[R2]dis	
[R2]display ip int	
[R2]display ip interface b	
[R2]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.0.18/28      up         up        
GigabitEthernet0/0/1              192.168.0.33/28      up         up        
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[R2]

R3 实现代码:

bash 复制代码
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]USER	
[R3]user-bind
[R3]user-group
[R3]user-interface CON	
[R3]user-interface console 0
[R3-ui-console0]id	
[R3-ui-console0]idle-timeout 0 0
[R3-ui-console0]int g0/0/0
[R3-GigabitEthernet0/0/0]ip ad	
[R3-GigabitEthernet0/0/0]ip address 192.168.0.34 28
Jul 17 2023 16:11:15-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 ad	
[R3-GigabitEthernet0/0/1]ip address 192.168.0.82 28
Jul 17 2023 16:11:34-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 ad	
[R3-GigabitEthernet0/0/2]ip address 192.168.0.49 28
Jul 17 2023 16:12:05-08:00 R3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R3-GigabitEthernet0/0/2]int g4/0/0
[R3-GigabitEthernet4/0/0]ip ad	
[R3-GigabitEthernet4/0/0]ip address 192.168.0.65 28
[R3-GigabitEthernet4/0/0]
Jul 17 2023 16:12:31-08:00 R3 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
on the interface GigabitEthernet4/0/0 has entered the UP state. 
[R3-GigabitEthernet4/0/0]quit
[R3]

查看结果:

bash 复制代码
[R3]dis	
[R3]display ip in	
[R3]display ip interface b	
[R3]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 3

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.0.34/28      up         up        
GigabitEthernet0/0/1              192.168.0.82/28      up         up        
GigabitEthernet0/0/2              192.168.0.49/28      up         up        
GigabitEthernet4/0/0              192.168.0.65/28      up         up        
GigabitEthernet4/0/1              unassigned           down       down      
GigabitEthernet4/0/2              unassigned           down       down      
GigabitEthernet4/0/3              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[R3]

R4 实现代码:

bash 复制代码
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]us	
[R4]user-bind
[R4]user-group
[R4]user-interface con	
[R4]user-interface console 0
[R4-ui-console0]id	
[R4-ui-console0]idle-timeout 0 0
[R4-ui-console0]quit
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip ad	
[R4-GigabitEthernet0/0/0]ip address 192.168.0.81 28
Jul 17 2023 16:24:09-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 ad	
[R4-GigabitEthernet0/0/1]ip address 192.168.0.98 28
Jul 17 2023 16:24:27-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 g0/0/2.1
[R4-GigabitEthernet0/0/2.1]ip ad	
[R4-GigabitEthernet0/0/2.1]ip address 192.168.0.113 28
[R4-GigabitEthernet0/0/2.1]int g0/0/2.2
[R4-GigabitEthernet0/0/2.2]ip ad	
[R4-GigabitEthernet0/0/2.2]ip address 192.168.0.129 28
[R4-GigabitEthernet0/0/2.2]quit
[R4]

查看结果:

bash 复制代码
[R4]dis	
[R4]display ip in	
[R4]display ip interface b	
[R4]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 3

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.0.81/28      up         up        
GigabitEthernet0/0/1              192.168.0.98/28      up         up        
GigabitEthernet0/0/2              unassigned           up         down      
GigabitEthernet0/0/2.1            192.168.0.113/28     up         down      
GigabitEthernet0/0/2.2            192.168.0.129/28     up         down      
NULL0                             unassigned           up         up(s)     
[R4]

R5 实现代码:

bash 复制代码
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R5
[R5]user	
[R5]user-bind
[R5]user-group
[R5]user-interface con	
[R5]user-interface console 0
[R5-ui-console0]i	
[R5-ui-console0]idle-timeout 0 0
[R5-ui-console0]int g0/0/1
[R5-GigabitEthernet0/0/1]ip ad	
[R5-GigabitEthernet0/0/1]ip address 192.168.0.66 28
Jul 17 2023 16:27:58-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R5-GigabitEthernet0/0/1]int g0/0/0
[R5-GigabitEthernet0/0/0]ip ad	
[R5-GigabitEthernet0/0/0]ip address 192.168.0.50 28
Jul 17 2023 16:28:22-08:00 R5 %%01IFNET/4/LINK_STATE(l)[1]: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 ad	
[R5-GigabitEthernet0/0/2]ip address 100.1.1.2 24
[R5-GigabitEthernet0/0/2]
Jul 17 2023 16:28:39-08:00 R5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R5-GigabitEthernet0/0/2]quit
[R5]

查看结果:

bash 复制代码
[R5]dis		
[R5]display ip in	
[R5]display ip interface b	
[R5]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.0.50/28      up         up        
GigabitEthernet0/0/1              192.168.0.66/28      up         up        
GigabitEthernet0/0/2              100.1.1.2/24         up         up        
NULL0                             unassigned           up         up(s)     
[R5]

R6 实现代码:

bash 复制代码
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R6
[R6]user	
[R6]user-bind
[R6]user-group
[R6]user-interface
[R6]user-interface con	
[R6]user-interface console 0
[R6-ui-console0]i	
[R6-ui-console0]idle-timeout 0 0
[R6-ui-console0]int g0/0/0
[R6-GigabitEthernet0/0/0]ip ad	
[R6-GigabitEthernet0/0/0]ip address 100.1.1.1 24
Jul 17 2023 16:30:48-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]quit
[R6]dis	

查看结果:

bash 复制代码
[R6]dis	
[R6]display ip in	
[R6]display ip interface b	
[R6]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 2
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              100.1.1.1/24         up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[R6]

2、交换机配置划分VLAN

SW1 实现代码:

bash 复制代码
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW	
[Huawei]sys SW1
[SW1]vlan b	
[SW1]vlan batch 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]int g0
Jul 17 2023 16:35:23-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095./0/1
[SW1-GigabitEthernet0/0/1]p	
[SW1-GigabitEthernet0/0/1]port l	
[SW1-GigabitEthernet0/0/1]port link-t	
[SW1-GigabitEthernet0/0/1]port link-type a	
[SW1-GigabitEthernet0/0/1]port link-type access 
[SW1-GigabitEthernet0/0/1]p	
[SW1-GigabitEthernet0/0/1]port de	
[SW1-GigabitEthernet0/0/1]port default vlan 2
[SW1-GigabitEthernet0/0/1]int g0/0
Jul 17 2023 16:35:43-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095./2
[SW1-GigabitEthernet0/0/2]p	
[SW1-GigabitEthernet0/0/2]port l	
[SW1-GigabitEthernet0/0/2]port link-t	
[SW1-GigabitEthernet0/0/2]port link-type a	
[SW1-GigabitEthernet0/0/2]port link-type access 
[SW1-GigabitEthernet0/0/2]p	
[SW1-GigabitEthernet0/0/2]port de	
[SW1-GigabitEthernet0/0/2]port default vlan 3
[SW1-GigabitEthernet0/0/2]
Jul 17 2023 16:36:03-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 9, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW1-GigabitEthernet0/0/2]int g0/0/3
[SW1-GigabitEthernet0/0/3]p	
[SW1-GigabitEthernet0/0/3]port l	
[SW1-GigabitEthernet0/0/3]port link-t	
[SW1-GigabitEthernet0/0/3]port link-type t	
[SW1-GigabitEthernet0/0/3]port link-type trunk 
[SW1-GigabitEthernet0/0/3]p	
[SW1-GigabitEthernet0/0/3]port t	
[SW1-GigabitEthernet0/0/3]port trunk a	
[SW1-GigabitEthernet0/0/3]port trunk allow-pass 
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3
[SW1-GigabitEthernet0/0/3]quit
[SW1]

输出结果:

bash 复制代码
[SW1]dis	
[SW1]display vlan	
[SW1]display vlan 
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:GE0/0/3(U)      GE0/0/4(U)      GE0/0/5(D)      GE0/0/6(D)      
                GE0/0/7(D)      GE0/0/8(D)      GE0/0/9(D)      GE0/0/10(D)     
                GE0/0/11(D)     GE0/0/12(D)     GE0/0/13(D)     GE0/0/14(D)     
                GE0/0/15(D)     GE0/0/16(D)     GE0/0/17(D)     GE0/0/18(D)     
                GE0/0/19(D)     GE0/0/20(D)     GE0/0/21(D)     GE0/0/22(D)     
                GE0/0/23(D)     GE0/0/24(D)                                     

2    common  UT:GE0/0/1(U)                                                      
             TG:GE0/0/3(U)                                                      

3    common  UT:GE0/0/2(U)                                                      

             TG:GE0/0/3(U)                                                      


VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
2    enable  default       enable  disable    VLAN 0002                         
3    enable  default       enable  disable    VLAN 0003                         
[SW1]

SW2 实现代码:

bash 复制代码
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW2
[SW2]int g0/0/
Jul 17 2023 16:38:55-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.1
[SW2-GigabitEthernet0/0/1]p	
[SW2-GigabitEthernet0/0/1]quit
[SW2]vlan b	
[SW2]vlan batch 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]p	
[SW2-GigabitEthernet0/0/1]port l	
[SW2-GigabitEthernet0/0/1]port link-
Jul 17 2023 16:39:15-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.t	
[SW2-GigabitEthernet0/0/1]port link-type t	
[SW2-GigabitEthernet0/0/1]port link-type trunk 
[SW2-GigabitEthernet0/0/1]p	
[SW2-GigabitEthernet0/0/1]port t	
[SW2-GigabitEthernet0/0/1]port trunk a	
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
Jul 17 2023 16:39:25-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW2-GigabitEthernet0/0/1]int g0/0/2
[SW2-GigabitEthernet0/0/2]p	
[SW2-GigabitEthernet0/0/2]port l	
[SW2-GigabitEthernet0/0/2]port link-t	
[SW2-GigabitEthernet0/0/2]port link-type a	
[SW2-GigabitEthernet0/0/2]port link-type access 
Jul 17 2023 16:39:35-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW2-GigabitEthernet0/0/2]p	
[SW2-GigabitEthernet0/0/2]port de	
[SW2-GigabitEthernet0/0/2]port default vlan 2
[SW2-GigabitEthernet0/0/2]int g0/0
Jul 17 2023 16:39:45-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 9, the c
hange loop count is 0, and the maximum number of records is 4095./2
[SW2-GigabitEthernet0/0/2]int g0/0/3
[SW2-GigabitEthernet0/0/3]p	
[SW2-GigabitEthernet0/0/3]port l	
[SW2-GigabitEthernet0/0/3]port link-t	
[SW2-GigabitEthernet0/0/3]port link-type a	
[SW2-GigabitEthernet0/0/3]port link-type access 
[SW2-GigabitEthernet0/0/3]p	
[SW2-GigabitEthernet0/0/3]port	
[SW2-GigabitEthernet0/0/3]portsw
Jul 17 2023 16:39:55-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 10, the 
change loop count is 0, and the maximum number of records is 40
Error: The interface is already a L2 interface.
[SW2-GigabitEthernet0/0/3]p	
[SW2-GigabitEthernet0/0/3]port de	
[SW2-GigabitEthernet0/0/3]port default v	
[SW2-GigabitEthernet0/0/3]port default vlan 3
[SW2-GigabitEthernet0/0/3]quit
[SW2]

查看结果:

bash 复制代码
[SW2]dis	
[SW2]display vlan
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:GE0/0/1(U)      GE0/0/4(D)      GE0/0/5(D)      GE0/0/6(D)      
                GE0/0/7(D)      GE0/0/8(D)      GE0/0/9(D)      GE0/0/10(D)     
                GE0/0/11(D)     GE0/0/12(D)     GE0/0/13(D)     GE0/0/14(D)     
                GE0/0/15(D)     GE0/0/16(D)     GE0/0/17(D)     GE0/0/18(D)     
                GE0/0/19(D)     GE0/0/20(D)     GE0/0/21(D)     GE0/0/22(D)     
                GE0/0/23(D)     GE0/0/24(D)                                     

2    common  UT:GE0/0/2(U)                                                      
             TG:GE0/0/1(U)                                                      

3    common  UT:GE0/0/3(U)                                                      

             TG:GE0/0/1(U)                                                      


VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
2    enable  default       enable  disable    VLAN 0002                         
3    enable  default       enable  disable    VLAN 0003                         
[SW2]

3、配置静态路由

R1 实现代码:

bash 复制代码
[R1]ip ro	
[R1]ip route
[R1]ip route-static 192.168.0.32 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.48 28 192.168.0.18
[R1]ip route-static 100.1.1.0 24 192.168.0.18
[R1]ip route-static 100.1.1.0 24 192.168.0.98
[R1]ip route-static 192.168.0.48 28 192.168.0.98
[R1]ip route-static 192.168.0.64 28 192.168.0.98
[R1]ip route-static 192.168.0.80 28 192.168.0.98
[R1]ip route-static 192.168.0.112 28 192.168.0.98
[R1]ip route-static 192.168.0.128 28 192.168.0.98
[R1]

R2 实现代码:

bash 复制代码
[R2]ip ro	
[R2]ip route
[R2]ip route-static 192.168.0.0 28 192.168.0.17
[R2]ip route-static 192.168.0.96 28 192.168.0.17
[R2]ip route-static 192.168.0.112 28 192.168.0.17
[R2]ip route-static 192.168.0.128 28 192.168.0.17
[R2]ip route-static 192.168.0.128 28 192.168.0.34
[R2]ip route-static 192.168.0.112 28 192.168.0.34
[R2]ip route-static 192.168.0.80 28 192.168.0.34
[R2]ip route-static 192.168.0.64 28 192.168.0.34
[R2]ip route-static 192.168.0.48 28 192.168.0.34
[R2]ip route-static 100.1.1.0 24 192.168.0.34
[R2]

R3 实现代码:

bash 复制代码
[R3]ip ro	
[R3]ip route
[R3]ip route-static 192.168.0.16 28 192.168.0.33
[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.81
[R3]ip route-static 192.168.0.96 28 192.168.0.81
[R3]ip route-static 192.168.0.112 28 192.168.0.81
[R3]ip route-static 192.168.0.128 28 192.168.0.81
[R3]ip route-static 100.1.1.0 24 192.168.0.66
[R3]ip route-static 100.1.1.0 24 192.168.0.50
[R3]

R4实现代码:

bash 复制代码
[R4]ip ro	
[R4]ip route
[R4]ip route-static 192.168.0.0 28 192.168.0.97
[R4]ip route-static 192.168.0.16 28 192.168.0.97
[R4]ip route-static 192.168.0.32 28 192.168.0.82
[R4]ip route-static 192.168.0.64 28 192.168.0.82         	
[R4]ip route-static 100.1.1.0 24 192.168.0.82
[R4]

R5 实现代码:

bash 复制代码
[R5]ip ro	
[R5]ip route
[R5]ip route-static 192.168.0.32 28 192.168.0.65
[R5]ip route-static 192.168.0.32 28 192.168.0.49
[R5]ip route-static 192.168.0.80 28 192.168.0.49
[R5]ip route-static 192.168.0.80 28 192.168.0.65
[R5]ip route-static 192.168.0.16 28 192.168.0.65
[R5]ip route-static 192.168.0.16 28 192.168.0.49
[R5]ip route-static 192.168.0.96 28 192.168.0.49
[R5]ip route-static 192.168.0.96 28 192.168.0.65
[R5]ip route-static 192.168.0.0 28 192.168.0.65
[R5]ip route-static 192.168.0.0 28 192.168.0.49
[R5]ip route-static 192.168.0.112 28 192.168.0.49
[R5]ip route-static 192.168.0.112 28 192.168.0.65
[R5]ip route-static 192.168.0.128 28 192.168.0.65
[R5]ip route-static 192.168.0.128 28 192.168.0.49
[R5]

R6实现代码:

bash 复制代码
[R6]ip ro	
[R6]ip route
[R6]ip route-static 192.168.0.64 28 100.1.1.2
[R6]ip route-static 192.168.0.48 28 100.1.1.2
[R6]ip route-static 192.168.0.32 28 100.1.1.2
[R6]ip route-static 192.168.0.80 28 100.1.1.2
[R6]ip route-static 192.168.0.96 28 100.1.1.2
[R6]ip route-static 192.168.0.16 28 100.1.1.2
[R6]ip route-static 192.168.0.0 28 100.1.1.2
[R6]ip route-static 192.168.0.112 28 100.1.1.2
[R6]ip route-static 192.168.0.128 28 100.1.1.2
[R6]

查看结果:
R1路由表:

bash 复制代码
[R1]dis	
[R1]display ip ro	
[R1]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 26       Routes : 29       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      100.1.1.0/24  Static  60   0          RD   192.168.0.18    GigabitEthernet 0/0/0
                    Static  60   0          RD   192.168.0.98    GigabitEthernet 0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.0.0/30  Direct  0    0           D   192.168.0.1     LoopBack0
    192.168.0.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
    192.168.0.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
   192.168.0.16/28  Direct  0    0           D   192.168.0.17    GigabitEthernet 0/0/0
   192.168.0.17/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
   192.168.0.31/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
   192.168.0.32/28  Static  60   0          RD   192.168.0.18    GigabitEthernet 0/0/0
   192.168.0.48/28  Static  60   0          RD   192.168.0.18    GigabitEthernet 0/0/0
                    Static  60   0          RD   192.168.0.98    GigabitEthernet 0/0/1
   192.168.0.64/28  Static  60   0          RD   192.168.0.18    GigabitEthernet 0/0/0
                    Static  60   0          RD   192.168.0.98    GigabitEthernet 0/0/1
   192.168.0.64/30  Direct  0    0           D   192.168.0.65    LoopBack1
   192.168.0.65/32  Direct  0    0           D   127.0.0.1       LoopBack1
   192.168.0.67/32  Direct  0    0           D   127.0.0.1       LoopBack1
   192.168.0.80/28  Static  60   0          RD   192.168.0.98    GigabitEthernet 0/0/1
   192.168.0.96/28  Direct  0    0           D   192.168.0.97    GigabitEthernet 0/0/1
   192.168.0.97/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/1
  192.168.0.111/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/1
  192.168.0.112/28  Static  60   0          RD   192.168.0.98    GigabitEthernet 0/0/1
  192.168.0.128/28  Static  60   0          RD   192.168.0.98    GigabitEthernet 0/0/1
  192.168.0.128/30  Direct  0    0           D   192.168.0.129   LoopBack2
  192.168.0.129/32  Direct  0    0           D   127.0.0.1       LoopBack2
  192.168.0.131/32  Direct  0    0           D   127.0.0.1       LoopBack2
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R1]

R2路由表:

bash 复制代码
[R2]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 18       Routes : 20       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      100.1.1.0/24  Static  60   0          RD   192.168.0.34    GigabitEthernet 0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.0.0/28  Static  60   0          RD   192.168.0.17    GigabitEthernet 0/0/0
   192.168.0.16/28  Direct  0    0           D   192.168.0.18    GigabitEthernet 0/0/0
   192.168.0.18/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
   192.168.0.31/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
   192.168.0.32/28  Direct  0    0           D   192.168.0.33    GigabitEthernet 0/0/1
   192.168.0.33/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/1
   192.168.0.47/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/1
   192.168.0.48/28  Static  60   0          RD   192.168.0.34    GigabitEthernet 0/0/1
   192.168.0.64/28  Static  60   0          RD   192.168.0.34    GigabitEthernet 0/0/1
   192.168.0.80/28  Static  60   0          RD   192.168.0.34    GigabitEthernet 0/0/1
   192.168.0.96/28  Static  60   0          RD   192.168.0.17    GigabitEthernet 0/0/0
  192.168.0.112/28  Static  60   0          RD   192.168.0.17    GigabitEthernet 0/0/0
                    Static  60   0          RD   192.168.0.34    GigabitEthernet 0/0/1
  192.168.0.128/28  Static  60   0          RD   192.168.0.17    GigabitEthernet 0/0/0
                    Static  60   0          RD   192.168.0.34    GigabitEthernet 0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R2]

R3路由表:

bash 复制代码
[R3]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 22       Routes : 24       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      100.1.1.0/24  Static  60   0          RD   192.168.0.66    GigabitEthernet 4/0/0
                    Static  60   0          RD   192.168.0.50    GigabitEthernet 0/0/2
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.0.0/28  Static  60   0          RD   192.168.0.33    GigabitEthernet 0/0/0
                    Static  60   0          RD   192.168.0.81    GigabitEthernet 0/0/1
   192.168.0.16/28  Static  60   0          RD   192.168.0.33    GigabitEthernet 0/0/0
   192.168.0.32/28  Direct  0    0           D   192.168.0.34    GigabitEthernet 0/0/0
   192.168.0.34/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
   192.168.0.47/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
   192.168.0.48/28  Direct  0    0           D   192.168.0.49    GigabitEthernet 0/0/2
   192.168.0.49/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/2
   192.168.0.63/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/2
   192.168.0.64/28  Direct  0    0           D   192.168.0.65    GigabitEthernet 4/0/0
   192.168.0.65/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 4/0/0
   192.168.0.79/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 4/0/0
   192.168.0.80/28  Direct  0    0           D   192.168.0.82    GigabitEthernet 0/0/1
   192.168.0.82/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/1
   192.168.0.95/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/1
   192.168.0.96/28  Static  60   0          RD   192.168.0.81    GigabitEthernet 0/0/1
  192.168.0.112/28  Static  60   0          RD   192.168.0.81    GigabitEthernet 0/0/1
  192.168.0.128/28  Static  60   0          RD   192.168.0.81    GigabitEthernet 0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R3]

R4路由表:

bash 复制代码
[R4]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 16       Routes : 16       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      100.1.1.0/24  Static  60   0          RD   192.168.0.82    GigabitEthernet 0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.0.0/28  Static  60   0          RD   192.168.0.97    GigabitEthernet 0/0/1
   192.168.0.16/28  Static  60   0          RD   192.168.0.97    GigabitEthernet 0/0/1
   192.168.0.32/28  Static  60   0          RD   192.168.0.82    GigabitEthernet 0/0/0
   192.168.0.48/28  Static  60   0          RD   192.168.0.82    GigabitEthernet 0/0/0
   192.168.0.64/28  Static  60   0          RD   192.168.0.82    GigabitEthernet 0/0/0
   192.168.0.80/28  Direct  0    0           D   192.168.0.81    GigabitEthernet 0/0/0
   192.168.0.81/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
   192.168.0.95/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
   192.168.0.96/28  Direct  0    0           D   192.168.0.98    GigabitEthernet 0/0/1
   192.168.0.98/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/1
  192.168.0.111/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R4]

R5路由表:

bash 复制代码
[R5]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 20       Routes : 27       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      100.1.1.0/24  Direct  0    0           D   100.1.1.2       GigabitEthernet 0/0/2
      100.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/2
    100.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/2
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.0.0/28  Static  60   0          RD   192.168.0.65    GigabitEthernet 0/0/1
                    Static  60   0          RD   192.168.0.49    GigabitEthernet 0/0/0
   192.168.0.16/28  Static  60   0          RD   192.168.0.65    GigabitEthernet 0/0/1
                    Static  60   0          RD   192.168.0.49    GigabitEthernet 0/0/0
   192.168.0.32/28  Static  60   0          RD   192.168.0.65    GigabitEthernet 0/0/1
                    Static  60   0          RD   192.168.0.49    GigabitEthernet 0/0/0
   192.168.0.48/28  Direct  0    0           D   192.168.0.50    GigabitEthernet 0/0/0
   192.168.0.50/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
   192.168.0.63/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
   192.168.0.64/28  Direct  0    0           D   192.168.0.66    GigabitEthernet 0/0/1
   192.168.0.66/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/1
   192.168.0.79/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/1
   192.168.0.80/28  Static  60   0          RD   192.168.0.49    GigabitEthernet 0/0/0
                    Static  60   0          RD   192.168.0.65    GigabitEthernet 0/0/1
   192.168.0.96/28  Static  60   0          RD   192.168.0.49    GigabitEthernet 0/0/0
                    Static  60   0          RD   192.168.0.65    GigabitEthernet 0/0/1
  192.168.0.112/28  Static  60   0          RD   192.168.0.49    GigabitEthernet 0/0/0
                    Static  60   0          RD   192.168.0.65    GigabitEthernet 0/0/1
  192.168.0.128/28  Static  60   0          RD   192.168.0.65    GigabitEthernet 0/0/1
                    Static  60   0          RD   192.168.0.49    GigabitEthernet 0/0/0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R5]

R6路由表:

bash 复制代码
[R6]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 16       Routes : 16       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      100.1.1.0/24  Direct  0    0           D   100.1.1.1       GigabitEthernet 0/0/0
      100.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
    100.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet 0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.0.0/28  Static  60   0          RD   100.1.1.2       GigabitEthernet 0/0/0
   192.168.0.16/28  Static  60   0          RD   100.1.1.2       GigabitEthernet 0/0/0
   192.168.0.32/28  Static  60   0          RD   100.1.1.2       GigabitEthernet 0/0/0
   192.168.0.48/28  Static  60   0          RD   100.1.1.2       GigabitEthernet 0/0/0
   192.168.0.64/28  Static  60   0          RD   100.1.1.2       GigabitEthernet 0/0/0
   192.168.0.80/28  Static  60   0          RD   100.1.1.2       GigabitEthernet 0/0/0
   192.168.0.96/28  Static  60   0          RD   100.1.1.2       GigabitEthernet 0/0/0
  192.168.0.112/28  Static  60   0          RD   100.1.1.2       GigabitEthernet 0/0/0
  192.168.0.128/28  Static  60   0          RD   100.1.1.2       GigabitEthernet 0/0/0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R6]

其实这里已经可以检测上面路由器之间是否通没通,用R1去pingR6:

bash 复制代码
[R1]ping 100.1.1.1
  PING 100.1.1.1: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 100.1.1.1: bytes=56 Sequence=2 ttl=252 time=80 ms
    Reply from 100.1.1.1: bytes=56 Sequence=3 ttl=252 time=40 ms
    Reply from 100.1.1.1: bytes=56 Sequence=4 ttl=252 time=30 ms
    Reply from 100.1.1.1: bytes=56 Sequence=5 ttl=252 time=40 ms

  --- 100.1.1.1 ping statistics ---
    5 packet(s) transmitted
    4 packet(s) received
    20.00% packet loss
    round-trip min/avg/max = 30/47/80 ms

[R1]

4、配置DHCP服务

R4实现代码:

bash 复制代码
[R4]dh	
[R4]dhcp en	
[R4]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[R4]ip p	
[R4]ip policy-based-route
[R4]ip pool 1
#Info: It's successful to create an IP address pool.
[R4-ip-pool-1]net	
[R4-ip-pool-1]netbios-type
[R4-ip-pool-1]network 192.168.0.112 m	
[R4-ip-pool-1]network 192.168.0.112 mask 28
[R4-ip-pool-1]g	
[R4-ip-pool-1]gateway-list 192.168.0.113
[R4-ip-pool-1]dn	
[R4-ip-pool-1]dns-list 8.8.8.8
[R4-ip-pool-1]quit
[R4]ip p	
[R4]ip policy-based-route
[R4]ip pool 2
Info: It's successful to create an IP address pool.
[R4-ip-pool-2]n	
[R4-ip-pool-2]nbns-list
[R4-ip-pool-2]netbios-type
[R4-ip-pool-2]network 192.168.0.128 m	
[R4-ip-pool-2]network 192.168.0.128 mask 28
[R4-ip-pool-2]g	
[R4-ip-pool-2]gateway-list 192.168.0.129
[R4-ip-pool-2]dn	
[R4-ip-pool-2]dns-list 8.8.8.8
[R4-ip-pool-2]quit
[R4]int g0/0/2.1
[R4-GigabitEthernet0/0/2.1]dh	
[R4-GigabitEthernet0/0/2.1]dhcp s	
[R4-GigabitEthernet0/0/2.1]dhcp select g	
[R4-GigabitEthernet0/0/2.1]dhcp select global 
[R4-GigabitEthernet0/0/2.1]int g0/0/2.2
[R4-GigabitEthernet0/0/2.2]dhcp select global 
[R4-GigabitEthernet0/0/2.2]quit
[R4]int g0/0/2.1
[R4-GigabitEthernet0/0/2.1]do	
[R4-GigabitEthernet0/0/2.1]dot1q t	
[R4-GigabitEthernet0/0/2.1]dot1q termination v	
[R4-GigabitEthernet0/0/2.1]dot1q termination vid 2
Jul 17 2023 17:47:36-08:00 R4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2.1 has entered the UP state. 
[R4-GigabitEthernet0/0/2.1]int g0/0/2.2
[R4-GigabitEthernet0/0/2.2]do	
[R4-GigabitEthernet0/0/2.2]dot1q t	
[R4-GigabitEthernet0/0/2.2]dot1q termination v	
[R4-GigabitEthernet0/0/2.2]dot1q termination vid 3
Jul 17 2023 17:48:04-08:00 R4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
on the interface GigabitEthernet0/0/2.2 has entered the UP state. 
[R4-GigabitEthernet0/0/2.2]quit
[R4]int g0/0/2.1
[R4-GigabitEthernet0/0/2.1]arp t	
[R4-GigabitEthernet0/0/2.1]arp b	
[R4-GigabitEthernet0/0/2.1]arp broadcast en	
[R4-GigabitEthernet0/0/2.1]arp broadcast enable 
[R4-GigabitEthernet0/0/2.1]int g0/0/2.2
[R4-GigabitEthernet0/0/2.2]arp b	
[R4-GigabitEthernet0/0/2.2]arp broadcast en	
[R4-GigabitEthernet0/0/2.2]arp broadcast enable 
[R4-GigabitEthernet0/0/2.2]quit
[R4]

5、测试

6、优化

1、配置缺省路由
R1实现代码:

bash 复制代码
[R1]ip ro	
[R1]ip route
[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.98
[R1]

R2实现代码:

bash 复制代码
[R2]ip ro	
[R2]ip route
[R2]ip route-static 0.0.0.0 0 192.168.0.34
[R2]

R3实现代码:

bash 复制代码
[R3]ip ro	
[R3]ip route
[R3]ip route-static 0.0.0.0 0 192.168.0.66
[R3]ip route-static 0.0.0.0 0 192.168.0.50
[R3]

R4实现代码:

bash 复制代码
[R4]ip ro	
[R4]ip route
[R4]ip route-static 0.0.0.0 0 192.168.0.82
[R4]

R5实现代码:

bash 复制代码
[R5]
[R5]ip ro	
[R5]ip route
[R5]ip route-static 0.0.0.0 0 100.1.1.1
[R5]

2、配置空接口防环
R1实现代码:

bash 复制代码
[R1]ip ro	
[R1]ip route
[R1]ip route-static 192.168.0.0 28 NU	
[R1]ip route-static 192.168.0.0 28 NULL 0
[R1]
相关推荐
乙己4073 小时前
计算机网络——网络层
运维·服务器·计算机网络
幽兰的天空5 小时前
介绍 HTTP 请求如何实现跨域
网络·网络协议·http
lisenustc5 小时前
HTTP post请求工具类
网络·网络协议·http
心平气和️5 小时前
HTTP 配置与应用(不同网段)
网络·网络协议·计算机网络·http
心平气和️5 小时前
HTTP 配置与应用(局域网)
网络·计算机网络·http·智能路由器
联蔚盘云6 小时前
2024.1.22 安全周报
经验分享
Mbblovey6 小时前
Picsart美易照片编辑器和视频编辑器
网络·windows·软件构建·需求分析·软件需求
北顾南栀倾寒7 小时前
[Qt]系统相关-网络编程-TCP、UDP、HTTP协议
开发语言·网络·c++·qt·tcp/ip·http·udp
GZ_TOGOGO7 小时前
PIM原理与配置
网络·华为·智能路由器
7ACE7 小时前
Wireshark TS | 虚假的 TCP Spurious Retransmission
网络·网络协议·tcp/ip·wireshark·tcpdump