
# 路由交换-作业8-4.5.2 实施VLAN间路由

> 当前进度 1.0
>
> 更新地址:type.dayiyi.top/index.php/archives/163/
>

更新啦新的博客：https://blog.dayi.ink ，欢迎来体验新的阅读方法。

另外，本文的开头：

![image-20230402190226168](/media/82/82f80cd88e1dbc7e540637d7750d62f59c07898b127f2fd5ee1087d870d6c729.png#vwid=469&vhei=189)

有阅读模式，可能会更好的阅读体验。

## 更新中修改的内容

在试错过程中发现并修改的内容:

```bash
目前没有
```


## 0x00 准备文件

- ~~是不是我的错觉~~，~~感觉这个作业的跟上个作业相似度很高~~。好像还是有不同的
- 文件下载：
	- https://p.dabbit.net/blog/pic_bed/2023/03/97e28883179ca7c2_202303301522838.7z

## 0x01 基本信息

**网络拓扑**

![image-20230330152609725](/media/cd/cd50de21e86610f65be08dee01010f555c21b2b9b7a9b9e72555d6b91a2741e8.png#vwid=759&vhei=310)

**地址分配表**

| 设备 | 接口        | IP 地址       | 子网掩码      | 默认网关     |
| ---- | ----------- | ------------- | ------------- | ------------ |
| R1   | G0/0/1.10   | 192.168.10.1  | 255.255.255.0 | 不适用       |
| R1   | G0/0/1.20   | 192.168.20.1  | 255.255.255.0 | 不适用       |
| R1   | G0/0/1.30   | 192.168.30.1  | 255.255.255.0 | 不适用       |
| R1   | G0/0/1.1000 | 不适用        | 不适用        | 不适用       |
| S1   | VLAN 10     | 192.168.10.11 | 255.255.255.0 | 192.168.10.1 |
| S2   | VLAN 10     | 192.168.10.12 | 255.255.255.0 | 192.168.10.1 |
| PC-A | NIC         | 192.168.20.3  | 255.255.255.0 | 192.168.20.1 |
| PC-B | NIC         | 192.168.30.3  | 255.255.255.0 | 192.168.30.1 |

**VLAN表**

| VLAN | 名称        | 接口分配                        |
| ---- | ----------- | ------------------------------- |
| 10   | Management  | S1: VLAN 10                     |
| 10   | Management  | S2: VLAN 10                     |
| 20   | Sales       | S1: F0/6                        |
| 30   | Operations  | S2: F0/18                       |
| 999  | Parking_Lot | S1: F0/2-4,  F0/7-24, G0/1-2    |
| 999  | Parking_Lot | S2: F0/2- 17,  F0/19-24, G0/1-2 |
| 1000 | Native      | 不适用                          |



## 0x02 一些阐述

**目标**

第 **1** 部分：构建网络并配置设备的基本设置

第 **2** 部分：创建 **VLAN** 并分配交换机端口

第 **3** 部分：在交换机之间配置一条 **802.1** **Q 干道

第 **4** 部分：在路由器上配置 **VLAN** 间路由

第 **5** 部分：验证 **VLAN** 间路由是否正常工作

**背景/场景**

现代交换机使用虚拟局域网 (VLAN) 通过将第 2 层广播域分成更小的域来提高网络性能。 VLAN 也可以把敏感 数据流量与网络的其他部分分隔开来，因此可以充当一种安全措施。通常，利用 VLAN 可更加轻松地设计网络 以支持组织的目标。 VLAN 之间的通信需要一台工作在 OSI 模型第 3 层的设备。增加一台 VLAN 间的路由器， 可以让组织机构隔离出多个广播域， 同时又可以保证它们之间可以相互通信。

VLAN 中继用于跨越多台设备的 VLAN。干道可以让多个 VLAN 中的流量通过一条链路进行通信， 同时保留 VLAN 的标志和分段。有一种特定类型的 VLAN 间路由，称为 “单臂路由器”，即使用路由器到交换机之间的干 道来让所有 VLAN 都能把流量传输给路由器。

在这个实验中， 您需要在拓扑中的两台交换机上创建多个 VLAN，给这些 VLAN 分配交换机接入端口，验证  VLAN 的工作是否正常，在两台交换机之间、以及 S1 和 R1 之间创建 VLAN 干道，然后配置 VLAN 间路由， 让 不同 VLAN 中的主机可以相互通信， 无论这些主机处于哪个子网之中。

注意：CCNA 动手实验所用的路由器是采用 Cisco IOS XE 16.9.4 (universalk9 镜像)的 Cisco 4221。实验中 所用的交换机是采用 Cisco IOS Release 15.2(2) (lanbasek9 镜像)的 Cisco Catalyst 2960 系列。也可使用其 他路由器、交换机以及其他思科 IOS 版本。根据型号以及 Cisco IOS 版本的不同，可用命令和产生的输出可能 与本实验显示的不一样。请参阅本实验末尾的“路由器接口汇总表”了解正确的接口标识符。

注意：确保路由器和交换机上面的配置已经清除， 没有启动配置。如果不确定，请联系教师。

**所需资源**

.   1 台路由器(采用思科 IOS XE 16.9.4 版通用镜像的思科 4221 或同类路由器)

.   2 台交换机(采用思科 IOS 版本 15.2(2) lanbasek9 镜像的思科 2960 或同类交换机)

.   2 台 PC (采用 Windows 系统且支持终端仿真程序，比如 Tera Term)

.   控制台电缆，用以通过控制台端口配置 Cisco IOS 设备

.   以太网线缆如拓扑结构所示



## 0x10 第 **1** 部分： 建立网络并配置设备的基本设置

> 第 **1** 部分： 建立网络并配置设备的基本设置
>
> 在第 1 部分中，您将设置网络拓扑并配置 PC 主机和交换机上的基本设置。

1. 我还是没找到4221，就用的4331

2. 选了一个4221，两个2960，俩PC

   ![image-20230330154224300](/media/44/441aaf4860ce5babf097973045c97c198ada72edb82a315477a9a4aa23e8cbe0.png#vwid=502&vhei=445)

3. 把它们连起来，注意连接的接口

   ![](/media/da/da0d891d73f3de6abc1e342476331335eafcd77775aa6e61eb67bf1dc4dba3de.gif#vwid=1082&vhei=784)

![image-20230402180151355](/media/01/019a6460adfc4b872bb51a9012d033cb237ba8a7ada8d039338ebb976a20e678.png#vwid=676&vhei=549)



## 0x11  第 **1** 部分：步骤 **1** ： 建立如拓扑图所示的网络。

按照拓扑图所示连接设备和电缆。



## 0x12  第 **1** 部分：步骤 **2** ： 配置路由器的基本设置。

>a.  通过控制台连接到路由器并进入特权模式。

*打开配置窗口*

>b.  进入配置模式。
>c.  为路由器分配一个设备名称。
>d.  要防止路由器尝试将错误输入的命令视为主机名， 则禁用 DNS 查找。
>e.  指定 **class** 作为特权 EXEC 加密密码。
>f.   指定 **cisco** 作为控制台密码并启用登录。
>g.  指定 **cisco** 作为 vty 密码并启用登录。
>h.  加密明文密码。
>i.   创建一个向访问设备者发出警告的标语：未经授权，禁止访问。
>j.   将运行配置保存到启动配置文件中。
>k .  设置路由器上的时钟。

*关闭配置窗口*

**跟上次一模一样的内容啦**

```bash
Would you like to enter the initial configuration dialog? [yes/no]: no

#a进入enable
Router>enable

#b 进入config模式
Router#configure terminal

#更新hostname
Router(config)#hostname R1

#d禁用DNS查找
R1(config)#no ip domain-lookup

#e设置enable密码：
R1(config)#enable secret class

#f设置console密码：
R1(config)#line console 0
R1(config-line)#password cisco
R1(config-line)#login

#g设置VTY密码：
R1(config-line)#line vty 0 4
R1(config-line)#password cisco
R1(config-line)#login
R1(config-line)#exit

#h加密明文密码
R1(config)#service password-encryption

#i警告标语
R1(config)#banner motd $ Unauthorized access is prohibited!$
R1(config)#end

#j配置保存到启动文件
R1#copy running-config startup-config
	Destination filename [startup-config]?
	Building configuration...
	[OK]

#k设置时间
R1#clock set 17:50:00 02 April 2023

```




## 0x13  步骤 **3** ：  配置每台交换机的基本设置。
>a.   Assign a device name to the switch.
>b.   要防止路由器尝试将错误输入的命令视为主机名， 则禁用 DNS 查找。
>c.    指定 **class** 作为特权 EXEC 加密密码。
>d.   指定 **cisco** 作为控制台密码并启用登录。
>e.   指定 **cisco** 作为 vty 密码并启用登录。
>f.    加密明文密码。
>g.   创建一个向访问设备者发出警告的标语：未经授权，禁止访问。
>h.   设置交换机上的时钟。
>i.     将运行配置保存到启动配置。


也是，都是之前的作业，直接放命令啦

**S1交换机：**
```bash
#输入命令进入enable模式
Switch>enable

#进入配置模式
Switch#config terminal
	Enter configuration commands, one per line.  End with CNTL/Z.

#更新主机名
Switch(config)#hostname S1

#禁用DNS查找
S1(config)#no ip domain-lookup

#设置enable密码
S1(config)#enable secret class

#配置console密码
S1(config)#line console 0
S1(config-line)#password cisco
S1(config-line)#login

#配置VTY密码
S1(config-line)#line vty 0 15
S1(config-line)#password cisco
S1(config-line)#login

#加密明文密码
S1(config-line)#service password-encryption

#设置登录提示标语
S1(config)#banner motd $ Unauthorized access is prohibited!$
S1(config)#end

#设置时间
S1#clock set 18:05:00 02 April 2023

#将配置保存到启动配置文件中
S1#copy running-config startup-config
	Destination filename [startup-config]? 
	Building configuration...
	[OK]
S1#
```

![image-20230402180426046](/media/a5/a5c903014f2b7f8d10ecba0d55380a605ac907a378d0d29c74eefd4e25fe260f.png#vwid=702&vhei=696)





**S2交换机**，同理啦，这里就注释命令啦

```bash
Switch>enable
Switch#config terminal
Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#hostname S2
S2(config)#no ip domain-lookup
S2(config)#enable secret class

S2(config)#line console 0
S2(config-line)#password cisco
S2(config-line)#login

S2(config-line)#line vty 0 15
S2(config-line)#password cisco
S2(config-line)#login

S2(config-line)#service password-encryption

S2(config)#banner motd $ Unauthorized access is prohibited!$
S2(config)#end
S2#clock set 18:05:00 02 April 2023
S2#copy running-config startup-config
	Destination filename [startup-config]? 
	Building configuration...
	[OK]
S2#
```

![image-20230402180555576](/media/7f/7fd72e0e62c32680ce9f82cb6f7f44d1acfe9700f2a446a98aab225e492a53c0.png#vwid=702&vhei=696)




## 0x14 步骤 **4**：  配置 **PC** 主机。

> 有关 PC 主机地址信息，请参阅地址分配表。

| P    |      | ip           | mask          | gateway      |
| ---- | ---- | ------------ | ------------- | ------------ |
| PC-A | NIC  | 192.168.20.3 | 255.255.255.0 | 192.168.20.1 |
| PC-B | NIC  | 192.168.30.3 | 255.255.255.0 | 192.168.30.1 |

![image-20230402180717477](/media/e5/e508ad187bb19d6dc7999537545213efa974414335be991e8810846337f86b48.png#vwid=523&vhei=358)

![image-20230402180741342](/media/93/93489131668e3197584a45430280d50d9ab57ec7b29cc4625738269e0e11a9f0.png#vwid=519&vhei=370)

## 0x20 第 **2** 部分：  创建 **VLAN** 并分配交换机端口

>在第 2 部分中，您需要根据上表中表示的信息，在两台交换机上创建 VLAN。然后，您需要把 VLAN 分配到相 应的接口并验证您所作的配置。在各台交换机上完成下面的任务。

## 0x21 步骤 **1** ：  在两台交换机上创建 **VLAN**。

>a.   在各台交换机上按照上表的内容进行命名并创建所需的 VLAN。
>b.   使用地址分配表中包含的 IP 地址信息配置管理接口和默认网关。
>c.   将交换机上所有未使用的端口划分到 Parking_Lot VLAN，将其配置为静态访问模式，并从管理上停用这些 端口。
 注意: interface range 命令可以帮助我们用尽可能少的命令来完成这个任务。

**VLAN表**

| VLAN | 名称        | 接口分配                        |
| ---- | ----------- | ------------------------------- |
| 10   | Management  | S1: VLAN 10                     |
| 10   | Management  | S2: VLAN 10                     |
| 20   | Sales       | S1: F0/6                        |
| 30   | Operations  | S2: F0/18                       |
| 999  | Parking_Lot | S1: F0/2-4,  F0/7-24, G0/1-2    |
| 999  | Parking_Lot | S2: F0/2- 17,  F0/19-24, G0/1-2 |
| 1000 | Native      | 不适用                          |

还是一样的过程

登录

```bash
Password: [cisco]

S1>enable
Password: [class]
S1#conf t
```







S1交换机

```bash
S1(config)# vlan 10
S1(config-vlan)# name Management
S1(config-vlan)# vlan 20
S1(config-vlan)# name Sales
S1(config-vlan)# vlan 30
S1(config-vlan)# name Operations
S1(config-vlan)# vlan 999
S1(config-vlan)# name Parking_Lot
S1(config-vlan)# vlan 1000
S1(config-vlan)# name Native
S1(config-vlan)# exit

#b
S1(config)# interface vlan 10
S1(config-if)# ip address 192.168.10.11 255.255.255.0
S1(config-if)# no shutdown
S1(config-if)# exit
S1(config)# ip default-gateway 192.168.10.1

#c
S1(config)# interface range fa0/2-4,fa0/7-24,g0/1-2
S1(config-if-range)# switchport mode access
S1(config-if-range)# switchport access vlan 999
S1(config-if-range)# shutdown
```



S2交换机

```bash
S2(config)# vlan 10
S2(config-vlan)# name Management
S2(config-vlan)# vlan 20
S2(config-vlan)# name Sales
S2(config-vlan)# vlan 30
S2(config-vlan)# name Operations
S2(config-vlan)# vlan 999
S2(config-vlan)# name Parking_Lot
S2(config-vlan)# vlan 1000
S2(config-vlan)# name Native
S2(config-vlan)# exit

#b
S2(config)# interface vlan 10
	[%LINK-5-CHANGED: Interface Vlan10, changed state to up]
S2(config-if)# ip address 192.168.10.12 255.255.255.0
S2(config-if)# no shutdown
S2(config-if)# exit
S2(config)# ip default-gateway 192.168.10.1

#c
S2(config)# interface range fa0/2-17,fa0/19-24,g0/1-2
S2(config-if-range)# switchport mode access
S2(config-if-range)# switchport access vlan 999
S2(config-if-range)# shutdown
```





![image-20230402182414277](/media/65/659bc7fecd07fb219c3f4628fdb7bf980fb3e4b5e797af5b81bd495ba603ee62.png#vwid=1371&vhei=729)





## 0x22 步骤 **2** ：  将 **VLAN** 分配到正确的交换机接口。

>a.   把使用的端口划分到(上面的 VLAN 表中指定的) 正确 VLAN ，并且配置为静态接入模式。
>b. 验证 VLAN 是否已分配给了正确的接口。



S1

```bash
S1(config-if-range)#interface f0/6
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan 20
```

S2

```bash
S2(config-if-range)#int f0/18
S2(config-if)#switchport mode access
S2(config-if)#switchport access vlan 30
```





过程B：

```bash
S1(config-if)#end
S1#
%SYS-5-CONFIG_I: Configured from console by console
show vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/5
10   Management                       active    
20   Sales                            active    Fa0/6
30   Operations                       active    
999  Parking_Lot                      active    Fa0/2, Fa0/3, Fa0/4, Fa0/7
                                                Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                                Fa0/12, Fa0/13, Fa0/14, Fa0/15
                                                Fa0/16, Fa0/17, Fa0/18, Fa0/19
                                                Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                                Fa0/24, Gig0/1, Gig0/2
1000 Native                           active    
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
S1#

===========================================================



S2#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1
10   Management                       active    
20   Sales                            active    
30   Operations                       active    Fa0/18
999  Parking_Lot                      active    Fa0/2, Fa0/3, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24, Gig0/1, Gig0/2
1000 Native                           active    
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
S2#
```



![image-20230402182708861](/media/6e/6ebf571ca6a6a5212fb7110292a7e844c1d7c9b1626aa3d224859f9c55e61270.png#vwid=2097&vhei=763)



# 0x30第 **3** 部分：  在交换机之间配置 **802.1****Q** 中继

>在第 3 部分中，您需要手动把接口 F0/1 配置为一个中继接口。

## 0x31 步骤 **1** ：  在交换机 **S1** 和 **S2** 上手动配置中继接口 **F****0/1**。

>a.   在接口 F0/1 上给两个交换机配置静态中继。
>b.   在两台交换机上把本征 VLAN 设置为 1000。
>c.    通过设置，允许 VLAN 10 、20 、30 和 1000 穿过这条干道。d.   验证中继端口、本征 VLAN 以及干道上允许的 VLAN。
>
>d.  验证中继端口、本征 VLAN 以及干道上允许的 VLAN。



S1

```bash
S1#conf t
	[Enter configuration commands, one per line.  End with CNTL/Z.]
S1(config)#

#a
S1(config)#int f0/1
S1(config-if)#switchport mode trunk

#b
S1(config-if)#switchport trunk native vlan 1000

#c
S1(config-if)#switchport trunk allowed vlan 10,20,30,1000
```



S2

```bash
#a
S2(config)#int f0/1
S2(config-if)#switchport mode trunk

#b
S2(config-if)#switchport trunk native vlan 1000

#c
S2(config-if)#switchport trunk allowed vlan 10,20,30,1000
```

​	



步骤d输出

```bash
S1(config-if)#end
S1#
%SYS-5-CONFIG_I: Configured from console by console
show interfaces trunk
Port        Mode         Encapsulation  Status        Native vlan
Fa0/1       on           802.1q         trunking      1000

Port        Vlans allowed on trunk
Fa0/1       10,20,30,1000

Port        Vlans allowed and active in management domain
Fa0/1       10,20,30,1000

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       10,20,30,1000



========================
S2(config-if)#end
S2#
%SYS-5-CONFIG_I: Configured from console by console
show int trunk
Port        Mode         Encapsulation  Status        Native vlan
Fa0/1       on           802.1q         trunking      1000

Port        Vlans allowed on trunk
Fa0/1       10,20,30,1000

Port        Vlans allowed and active in management domain
Fa0/1       10,20,30,1000

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       10,20,30,1000

S2#
```









## 0x32 步骤 **2** ：  手动配置 **S1** 上的中继接口 **F****0/5**。

>a.   给 S1 的 F0/5 接口上配置与 F0/1 相同的参数。这是连接路由器的干道。
>b.   将运行配置保存到启动配置文件中。
>c.   验证中继。



S1

```bash
S1#conf t
	[Enter configuration commands, one per line.  End with CNTL/Z.]
S1(config)#int f0/5
S1(config-if)#switchport mode trunk

# 配置本征 VLAN 和允许的 VLAN
S1(config-if)#switchport trunk native vlan 1000
S1(config-if)#switchport trunk allowed vlan 10,20,30,1000
S1(config-if)#end

S1#copy running-config startup-config
```



S2

```bash
S2#copy running-config startup-config
```





步骤c

```bash
S1#show interfaces trunk
Port        Mode         Encapsulation  Status        Native vlan
Fa0/1       on           802.1q         trunking      1000

Port        Vlans allowed on trunk
Fa0/1       10,20,30,1000

Port        Vlans allowed and active in management domain
Fa0/1       10,20,30,1000

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       10,20,30,1000

===========================
S2#show interfaces trunk
Port        Mode         Encapsulation  Status        Native vlan
Fa0/1       on           802.1q         trunking      1000

Port        Vlans allowed on trunk
Fa0/1       10,20,30,1000

Port        Vlans allowed and active in management domain
Fa0/1       10,20,30,1000

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       10,20,30,1000
```



![image-20230402184218992](/media/ee/eedd3b36c398e2403738388229c2744f5cdf0c1c33a8a18c930e6c95b8a8db19.png#vwid=2021&vhei=737)





### Q.0x32 如果 R1 上的 G0/0/1 出现故障，会发生什么情况？

根据上图也可以得出结论，S1交换机中不会显示R1中的接口状态。





## 0x40 第 **4** 部分：  **Configure** **Inter-VLAN** **Routing** **on** **the** **Router**

## 0x41 步骤 **1** ：  配置路由器。

_打开__配置窗口_

>a.   根据需要在路由器上激活接口 G0/1。
>b.   按照 IP 地址分配表给每个 VLAN 配置子接口。所有子接口都要使用 802. 1Q 封装。确保本征 VLAN 对应的 子接口没有分配 IP 地址。给每个子接口添加一段描述信息。
>c.   验证子接口是否工作正常 关闭配置窗口



```bash
#登录
Password: [cisco]

R1>enable
Password: [class]
R1#

#a
R1#conf t
	[Enter configuration commands, one per line.  End with CNTL/Z.]
R1(config)#int g0/0/1
R1(config-if)#no shut
	[%LINK-5-CHANGED: Interface GigabitEthernet0/0/1, changed state to up]
	[%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0/1, changed state to up]
R1(config-if)#exit

#b

R1(config)#int g0/0/1.10

#输出
[    %LINK-5-CHANGED: Interface Gt0/0/1.10, changed state to up
    %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0/1.10, changed state to up]
    
R1(config-subif)#description Management
R1(config-subif)#encapsulation dot1q 10
R1(config-subif)#ip address 192.168.10.1 255.255.255.0
R1(config-subif)#int g0/0/1.20


[%LINK-5-CHANGED: Interface GigabitEthernet0/0/1.20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0/1.20, changed state to up]

R1(config-subif)#encapsulation dot1q 20
R1(config-subif)#description Sales
R1(config-subif)#ip address 192.168.20.1 255.255.255.0
R1(config-subif)#int g0/0/1.30
[忽略输出]
R1(config-subif)#encapsulation dot1q 30
R1(config-subif)#description Operations
R1(config-subif)#ip address 192.168.30.1 255.255.255.0
R1(config-subif)#int g0/0/1.1000
[忽略输出]
R1(config-subif)#encapsulation dot1q 1000 native
R1(config-subif)#description Native
R1(config-subif)#end

	[输出：%SYS-5-CONFIG_I: Configured from console by console]

#c过程 验证子接口是否工作正常 关闭配置窗口
R1#show ip interface brief
Interface               IP-Address      OK? Method Status                Protocol 
GigabitEthernet0/0/0    unassigned      YES unset  administratively down down 
GigabitEthernet0/0/1    unassigned      YES unset  up                    up 
GigabitEthernet0/0/1.10 192.168.10.1    YES manual up                    up 
GigabitEthernet0/0/1.20 192.168.20.1    YES manual up                    up 
GigabitEthernet0/0/1.30 192.168.30.1    YES manual up                    up 
GigabitEthernet0/0/1.1000 unassigned      YES unset  up                    up 
Vlan1                   unassigned      YES unset  administratively down down
R1#


```





## 0x50 第 **5** 部分：  验证 **VLAN** 间路由是否正常工作

## 0x51 步骤 **1** ：  从 **PC-A** 发起下列的测试。这些测试都应该成功。

>注意：  您可能需要禁用 PC 防火墙， ping 测试才能成功
>a.   从 PC-A 对默认网关执行 ping 操作

  

### 0x51.a

在PC-A上执行

```bash
Cisco Packet Tracer PC Command Line 1.0
C:\>ipconfig

FastEthernet0 Connection:(default port)

   Connection-specific DNS Suffix..: 
   Link-local IPv6 Address.........: FE80::260:2FFF:FE34:1AA5
   IPv6 Address....................: ::
   IPv4 Address....................: 192.168.20.3
   Subnet Mask.....................: 255.255.255.0
   Default Gateway.................: ::
                                     192.168.20.1

Bluetooth Connection:

   Connection-specific DNS Suffix..: 
   Link-local IPv6 Address.........: ::
   IPv6 Address....................: ::
   IPv4 Address....................: 0.0.0.0
   Subnet Mask.....................: 0.0.0.0
   Default Gateway.................: ::
                                     0.0.0.0

C:\>ping 192.168.20.1

Pinging 192.168.20.1 with 32 bytes of data:

Reply from 192.168.20.1: bytes=32 time<1ms TTL=255
Reply from 192.168.20.1: bytes=32 time=5ms TTL=255
```

![image-20230402185415339](/media/d3/d3b4db2e6e1b742004a84a62ff7325f3d43e783fc509419d46a4a337ed0f8049.png#vwid=678&vhei=786)



### 0x52.b

> b.   从 PC-A 对 PC-B 执行 ping 操作

在PC-A上继续操作：

```bash
C:\>ping 192.168.30.3

Pinging 192.168.30.3 with 32 bytes of data:

Request timed out.
Reply from 192.168.30.3: bytes=32 time<1ms TTL=127
Reply from 192.168.30.3: bytes=32 time<1ms TTL=127
Reply from 192.168.30.3: bytes=32 time<1ms TTL=127

Ping statistics for 192.168.30.3:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
```

![image-20230402185528085](/media/38/385e4faad7cde64dd76ec36dd0dcdf292a94bba0d8ed889d438fc7126b407e86.png#vwid=1498&vhei=723)



## 0x51.c 

> c.    从 PC-A 向 S2 发起 Ping 测试。

还是在PC-A上进行操作：

（time out 两次吓死我了，以为配错了）

```bash
C:\>ping 192.168.10.12

Pinging 192.168.10.12 with 32 bytes of data:

Request timed out.
Request timed out.
Reply from 192.168.10.12: bytes=32 time=5ms TTL=254
Reply from 192.168.10.12: bytes=32 time<1ms TTL=254

Ping statistics for 192.168.10.12:
    Packets: Sent = 4, Received = 2, Lost = 2 (50% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 5ms, Average = 2ms

C:\>
```

![image-20230402185759489](/media/a3/a30332150bcb03ce77dc06a48bd8c623aac7a1c2eadaa9302c32a2a92196767b.png#vwid=1520&vhei=1157)



## 0x52 步骤 **2** ：  从 **PC-B** 发起下列的测试。

> 从 PC-B 上的命令提示符窗口中，向 PC **-****A** 的地址执行 **tracert** 命令。



在PC-B上进行操作：

```bash

C:\>tracert 192.168.20.3

Tracing route to 192.168.20.3 over a maximum of 30 hops: 

  1   0 ms      0 ms      0 ms      192.168.30.1
  2   0 ms      0 ms      0 ms      192.168.20.3

Trace complete.
```





![image-20230402185841375](/media/19/199a3524172e27113c3f1e3a46fe8a6062f2417be1bf891f311ec4dc18cfef6b.png#vwid=702&vhei=696)

### Q.0x52 结果中会显示哪些中间 IP 地址？

```bash
Tracing route to 192.168.20.3 over a maximum of 30 hops: 

  1   0 ms      0 ms      0 ms      192.168.30.1
  2   0 ms      0 ms      0 ms      192.168.20.3
```

192.168.30.1 和 192.168.20.3



## 0x60 文件下载

PKT已经打包：

![image-20230402190058138](/media/86/863660091221ba800ff9bc3501cd988599df334ed7f4b1e015ee15463f058a99.png#vwid=1031&vhei=485)

https://p.dabbit.net/blog/pic_bed/2023/04/6e1140346d0c081f_202304021901406.zip