2024年8月23日 18:12:00
This commit is contained in:
parent
f7c6920d98
commit
e8907c2edc
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
# OSI模型
|
||||
|
||||
### 1、物理层
|
||||
@ -60,3 +62,122 @@
|
||||
3. 剪齐
|
||||
4. 装水晶接头(金手指面向自己,将线装到水晶头的顶端)
|
||||
5. 压接
|
||||
|
||||
### 2、数据链路层
|
||||
|
||||
1. **MAC地址概述**
|
||||
|
||||
- MAC地址,即以太网地址,用来标识一个以太网上的某个单独设备或一组设备
|
||||
- 长度:48个bit(6个字节)
|
||||
组成:24个bit的厂商标识+24个bit的网卡编号
|
||||
|
||||
> MAC地址的第8位为0 表示单播地址(每一个物理网卡都有一个全球唯一的MAC地址)
|
||||
>
|
||||
> MAC地址的第8位为1 表示组播地址
|
||||
>
|
||||
> 48位都为1 表示广播地址
|
||||
>
|
||||
> 表示方式:使用12位的16进制数表示的 如:98-FA-9B-EE-AA-04
|
||||
|
||||
2. **帧格式**
|
||||
|
||||
![image-20240823175025852](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/image-20240823175025852.png)
|
||||
|
||||
- 以太网帧的数据长度范围46-1500 字节 (净重)
|
||||
- 以太网帧的长度范围(64-1518)字节 (毛重)
|
||||
|
||||
3. **什么是冲突域**
|
||||
|
||||
1. 在一个网络范围内发送数据时会产生冲突的区域就是冲突域
|
||||
2. 冲突是以太网致命故障,导致信号冲突,数据损坏、丢失、数据传输慢
|
||||
|
||||
4. **接口双工模式**
|
||||
|
||||
1. 单工模式
|
||||
|
||||
> 传输数据的信道只有一个,只能接收数据,不能回复数据(类似BB机)
|
||||
|
||||
2. 半双工模式
|
||||
|
||||
> 传输数据的信道只有一个,可以接收数据,也可以回复数据,但是不能同时进行(类似:对讲机)
|
||||
|
||||
3. 全双工模式
|
||||
|
||||
> 传输数据的信道有两个,接口可以在同一时刻接收数据和发送数据;(类似:电话)
|
||||
|
||||
5. **通过什么设备来分割冲突域**
|
||||
|
||||
- 交换机
|
||||
|
||||
> 把多台电脑连接在一-起的设备,组建局域网的主要设备 交换机的每一个接口有专门的数据信道来为用户转发数据; 交换机分割冲突域,实现全双工。
|
||||
|
||||
6. **交换机工作过程**
|
||||
|
||||
1. `学习`:学习数据帧源MAC地址,生成MAC地址表,并将源MAC地址和对应的接口号写入MAC地址表
|
||||
2. `广播`:向除接收接口之外的所有接口广播未知目标MAC地址
|
||||
3. `转发`:根据MAC地址表转发数据帧
|
||||
4. `更新`:端口对应主机MAC地址发生变化重新学习(MAC地址表中记录生存时间为300秒)
|
||||
|
||||
7. **查看MAC地址表**
|
||||
|
||||
- `display mac-address`
|
||||
|
||||
![image-20240823175337509](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/image-20240823175337509.png)
|
||||
|
||||
```
|
||||
<Huawei>display mac-address
|
||||
MAC address table of slot 0:
|
||||
-------------------------------------------------------------------------------
|
||||
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
|
||||
VSI/SI MAC-Tunnel
|
||||
-------------------------------------------------------------------------------
|
||||
5489-9802-3b6e 1 - - GE0/0/1 dynamic 0/-
|
||||
5489-9886-7447 1 - - GE0/0/2 dynamic 0/-
|
||||
5489-9899-2a4a 1 - - GE0/0/3 dynamic 0/-
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
```
|
||||
|
||||
8. **案例实验**
|
||||
|
||||
PC1访问PC4,MAC地址表学习结果如下:
|
||||
|
||||
![image-20240823175514335](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/image-20240823175514335.png)
|
||||
|
||||
```
|
||||
<SW1>display mac-address
|
||||
MAC address table of slot 0:
|
||||
-------------------------------------------------------------------------------
|
||||
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
|
||||
VSI/SI MAC-Tunnel
|
||||
-------------------------------------------------------------------------------
|
||||
5489-9802-3b6e 1 - - GE0/0/1 dynamic 0/-
|
||||
5489-9875-353e 1 - - GE0/0/3 dynamic 0/-
|
||||
-------------------------------------------------------------------------------
|
||||
```
|
||||
|
||||
```
|
||||
<SW2>display mac-address
|
||||
MAC address table of slot 0:
|
||||
-------------------------------------------------------------------------------
|
||||
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
|
||||
VSI/SI MAC-Tunnel
|
||||
-------------------------------------------------------------------------------
|
||||
5489-9802-3b6e 1 - - GE0/0/3 dynamic 0/-
|
||||
5489-9875-353e 1 - - GE0/0/2 dynamic 0/-
|
||||
-------------------------------------------------------------------------------
|
||||
```
|
||||
|
||||
9. **广播域**
|
||||
|
||||
1. 什么是广播域
|
||||
|
||||
> 能够接收到同样广播消息的网络节点的集合
|
||||
|
||||
2. 广播域过大所带来的问题
|
||||
|
||||
> 当同一个广播域内广播报文过多时,会对局域网造成干扰,导致网络延迟,网络拥塞(上网卡,上网慢),严重情况可以造成广播风暴,导致网络瘫痪,给网络的可靠性和安全性带来了严重挑战。
|
||||
|
||||
3. 如何解决广播域
|
||||
|
||||
> 利用vlan技术可用在交换机中分割广播域,实现广播报文的隔离。
|
92
A. 第一阶段/11_VLAN.md
Normal file
92
A. 第一阶段/11_VLAN.md
Normal file
@ -0,0 +1,92 @@
|
||||
# VLAN
|
||||
|
||||
### 一、VLAN LAN虚拟局域网
|
||||
|
||||
> 虚拟局域网(Virtual LAN,简称VLAN)是一种将物理上互连的网络在逻辑上划分为多个广播域的技术。通过VLAN,可以在一个物理网络上创建多个独立的逻辑网络,每个逻辑网络可以看作是一个单独的局域网。
|
||||
|
||||
### 二、为什么使用VLAN
|
||||
|
||||
- 交换机只能分割冲突域,但是不能分割广播域
|
||||
- 随着交换机接口数量的增多,网络中广播增多,会降低网络的传输效率,可以使用VLAN技术分割这个大的广播域
|
||||
|
||||
### 三、VLAN作用
|
||||
|
||||
- 分割广播域(主要作用)
|
||||
- 带宽利用、降低延迟、提高安全性
|
||||
|
||||
### 四、VLAN划分方式
|
||||
|
||||
1. 基于交换机接口的静态划分
|
||||
2. 基于主机MAC地址的动态划分
|
||||
|
||||
### 五、VLAN的基本配置
|
||||
|
||||
1. 创建vlan
|
||||
|
||||
```
|
||||
[SW1]vlan 2 [2-4094] //创建vlan
|
||||
```
|
||||
|
||||
2. 查看vlan
|
||||
|
||||
```
|
||||
[SW1]display vlan //查看vlan信息
|
||||
```
|
||||
|
||||
3. 删除vlan
|
||||
|
||||
```
|
||||
[SW1]undo vlan 2 //删除vlan2
|
||||
```
|
||||
|
||||
4. 创建多个vlan、删除多个vlan
|
||||
|
||||
```
|
||||
[SW1]vlan batch 10 20 30 //创建多个不连续的vlan
|
||||
[SW1]vlan batch 50 to 60 //创建多个连续的vlan
|
||||
[SW1]display vlan //查看vlan信息
|
||||
[SW1]undo vlan batch 10 20 30 //删除多个不连续vlan
|
||||
[SW1]undo vlan batch 50 to 60 //删除多个连续vlan
|
||||
```
|
||||
|
||||
### 六、端口加入vlan
|
||||
|
||||
1. **PVID**
|
||||
|
||||
- PVID:port default VLAN ID,又称为缺省vlan,表示接口所属的vlan
|
||||
|
||||
每个接口都有一个PVID,缺省情况,交换机所有的接口PVID都是1
|
||||
|
||||
2. **Access接口模式**
|
||||
|
||||
- **工作场景**:通常用于交换机连接终端(主机或服务器)
|
||||
|
||||
- **特点:**
|
||||
|
||||
同时只能属于一个vlan
|
||||
|
||||
接收数据帧时,若该帧不带vlan标签,用接口PVID数值做为标签,给数据帧打标签
|
||||
|
||||
接收数据帧时,若该帧带vlan标签,判断vlan标签和本接口的PVID是否一致,一致接收数据,不一致则丢弃数据。
|
||||
|
||||
> **注:标准以太网帧及带有****vlan** **标签的数据帧**
|
||||
>
|
||||
> 1)Vlan数据帧(标准):目标地址+源地址+类型+数据+帧校验序列
|
||||
>
|
||||
> 2)VLAN数据帧:目的地址+源地址+【Vlan-Tag】+类型+数据+帧校验序列
|
||||
|
||||
3. **端口加入vlan**
|
||||
|
||||
```
|
||||
[SW1]vlan 2 //创建vlan2
|
||||
[SW1]interface GigabitEthernet0/0/1
|
||||
[S1-GigabitEthernet0/0/1]port link-type access //接口模式配置为access模式
|
||||
[S1-GigabitEthernet0/0/1]port default vlan 2 //接口加入vlan2
|
||||
<S1>display vlan
|
||||
```
|
||||
|
||||
|
||||
|
||||
**IP数据包格式**
|
||||
|
||||
![image-20240823181127936](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/image-20240823181127936.png)
|
81
A. 第一阶段/拓扑练习/0823_DHCP+VLAN.md
Normal file
81
A. 第一阶段/拓扑练习/0823_DHCP+VLAN.md
Normal file
@ -0,0 +1,81 @@
|
||||
# DHCP + VLAN
|
||||
|
||||
![image-20240823172337746](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/image-20240823172337746.png)
|
||||
|
||||
### 一、配置二层交换机
|
||||
|
||||
- **SW2**
|
||||
|
||||
```
|
||||
<Huawei>u t m
|
||||
<Huawei>sys
|
||||
[Huawei]sys SW2
|
||||
[SW2]vlan 10
|
||||
[SW2-vlan10]port-group 1
|
||||
[SW2-port-group-1]group-member g0/0/2 g0/0/3
|
||||
[SW2-port-group-1]port link-type access
|
||||
[SW2-port-group-1]port default vlan 10
|
||||
[SW2-port-group-1]quit
|
||||
[SW2]int g0/0/1
|
||||
[SW2-GigabitEthernet0/0/1]port link-type trunk
|
||||
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
|
||||
[SW2-GigabitEthernet0/0/1]return
|
||||
<SW2>save
|
||||
```
|
||||
|
||||
- **SW3**
|
||||
|
||||
```
|
||||
<Huawei>u t m
|
||||
<Huawei>sys
|
||||
[Huawei]sys SW3
|
||||
[SW3]vlan 20
|
||||
[SW3-vlan20]port-group 1
|
||||
[SW3-port-group-1]group-member g0/0/2 g0/0/3
|
||||
[SW3-port-group-1]port link-type access
|
||||
[SW3-port-group-1]port default vlan 20
|
||||
[SW3-port-group-1]quit
|
||||
[SW3]int g0/0/1
|
||||
[SW3-GigabitEthernet0/0/1]port link-type trunk
|
||||
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all
|
||||
[SW3-GigabitEthernet0/0/1]return
|
||||
<SW3>save
|
||||
```
|
||||
|
||||
### 二、配置三层交换机
|
||||
|
||||
- **SW1**
|
||||
|
||||
```
|
||||
<Huawei>u t m
|
||||
<Huawei>sys
|
||||
[Huawei]sys SW1
|
||||
[SW1]port-group 1
|
||||
[SW1-port-group-1]group-member g0/0/1 g0/0/2
|
||||
[SW1-port-group-1]port link-type trunk
|
||||
[SW1-port-group-1]port trunk allow-pass vlan all
|
||||
[SW1-port-group-1]quit
|
||||
[SW1]ip policy-based-route
|
||||
[SW1]ip pool vlan10
|
||||
[SW1-ip-pool-vlan10]network 192.168.10.0 mask 24
|
||||
[SW1-ip-pool-vlan10]gateway-list 192.168.10.254
|
||||
[SW1-ip-pool-vlan10]dns-list 223.5.5.5 223.6.6.6
|
||||
[SW1-ip-pool-vlan10]quit
|
||||
[SW1]ip pool vlan20
|
||||
[SW1-ip-pool-vlan20]network 192.168.20.0 mask 24
|
||||
[SW1-ip-pool-vlan20]gateway-list 192.168.20.254
|
||||
[SW1-ip-pool-vlan20]dns-list 223.5.5.5 223.6.6.6
|
||||
[SW1-ip-pool-vlan20]quit
|
||||
[SW1]dhcp enable
|
||||
[SW1]vlan batch 10 20
|
||||
[SW1]int vlanif 10
|
||||
[SW1-Vlanif10]ip a 192.168.10.254 24
|
||||
[SW1-Vlanif10]dhcp select global
|
||||
[SW1-Vlanif10]int vlanif 20
|
||||
[SW1-Vlanif20]ip a 192.168.20.254 24
|
||||
[SW1-Vlanif20]dhcp select global
|
||||
[SW1-Vlanif20]return
|
||||
<SW1>save
|
||||
```
|
||||
|
||||
|
59
A. 第一阶段/拓扑练习/0823_DHCP中继.md
Normal file
59
A. 第一阶段/拓扑练习/0823_DHCP中继.md
Normal file
@ -0,0 +1,59 @@
|
||||
# DHCP中继
|
||||
|
||||
![image-20240823163005579](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/image-20240823163005579.png)
|
||||
|
||||
### 一、配IP
|
||||
|
||||
### 二、配DHCP
|
||||
|
||||
- **AR2**
|
||||
|
||||
```
|
||||
<Huawei>u t m
|
||||
<Huawei>sys
|
||||
[Huawei]sys AR2-DHCP
|
||||
[AR2-DHCP]int g0/0/0
|
||||
[AR2-DHCP-GigabitEthernet0/0/0]ip a 192.168.20.20 24
|
||||
[AR2-DHCP-GigabitEthernet0/0/0]q
|
||||
[AR2-DHCP]dhcp enable
|
||||
[AR2-DHCP]ip pool ntd
|
||||
[AR2-DHCP-ip-pool-ntd]network 192.168.10.0 mask 24
|
||||
[AR2-DHCP-ip-pool-ntd]gateway-list 192.168.10.254
|
||||
[AR2-DHCP-ip-pool-ntd]dns-list 223.5.5.5 223.6.6.6
|
||||
[AR2-DHCP-ip-pool-ntd]lease day 1
|
||||
[AR2-DHCP-ip-pool-ntd]excluded-ip-address 192.168.10.253
|
||||
[AR2-DHCP-ip-pool-ntd]quit
|
||||
[AR2-DHCP]int g 0/0/0
|
||||
[AR2-DHCP-GigabitEthernet0/0/0]dhcp select global
|
||||
[AR2-DHCP-GigabitEthernet0/0/0]quit
|
||||
[AR2-DHCP]ip route-static 192.168.10.0 24 192.168.20.10
|
||||
[AR2-DHCP]quit
|
||||
<AR2-DHCP>save
|
||||
```
|
||||
|
||||
### 三、配DHCP中继
|
||||
|
||||
- **AR1**
|
||||
|
||||
```
|
||||
<Huawei>u t m
|
||||
<Huawei>sy
|
||||
[Huawei]sy AR1-ZJ
|
||||
[AR1-ZJ]int g0/0/0
|
||||
[AR1-ZJ-GigabitEthernet0/0/0]ip a 192.168.20.10 24
|
||||
[AR1-ZJ-GigabitEthernet0/0/0]int g0/0/1
|
||||
[AR1-ZJ-GigabitEthernet0/0/1]ip a 192.168.10.254 24
|
||||
[AR1-ZJ-GigabitEthernet0/0/1]quit
|
||||
[AR1-ZJ]dhcp enable
|
||||
[AR1-ZJ]int g0/0/1
|
||||
[AR1-ZJ-GigabitEthernet0/0/1]dhcp select relay
|
||||
[AR1-ZJ-GigabitEthernet0/0/1]dhcp relay server-ip 192.168.20.20
|
||||
[AR1-ZJ-GigabitEthernet0/0/1]return
|
||||
<AR1-ZJ>save
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
![DHCP](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/DHCP.png)
|
Loading…
Reference in New Issue
Block a user