mirror of
https://github.com/gnu4cn/ccna60d.git
synced 2024-05-21 04:55:00 +08:00
update
This commit is contained in:
parent
5cb01a8016
commit
fdea3d04af
@ -3,5 +3,5 @@
|
||||
* [简介](README.md)
|
||||
* [第一章, 网络、线缆、OSI及TCP模型](d01-Networks-Cables-OSI-and-TCP-Models.md)
|
||||
* [第二章, CSMA/CD, 交换和虚拟局域网](d02-CSMA-CD-Switching-and-VLANs.md)
|
||||
* [中继、DTP 及 VLAN 间路由](d03-Trunking-DTP-and-Inter-VLAN-Routing.md)
|
||||
* [第三章, 中继、DTP 及 VLAN 间路由](d03-Trunking-DTP-and-Inter-VLAN-Routing.md)
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
|
||||
## 第三天的任务
|
||||
|
||||
+ 阅读今天的课文
|
||||
+ 回顾昨天的课程
|
||||
+ 完成今天的实验
|
||||
+ 阅读 ICND1 记诵指南
|
||||
- 阅读今天的课文
|
||||
- 回顾昨天的课程
|
||||
- 完成今天的实验
|
||||
- 阅读 ICND1 记诵指南
|
||||
|
||||
|
||||
在最小规模的那些办公室里,你才会遇到仅使用一台交换机的情况,但是网络基础设施通常是由多台交换机构成的。多台交换机带来了其配置上的挑战,要求你对中继及其有关的问题有深入理解。思科将多台交换机的安装和故障排除,视为一个 CCNA 级别的基础主题。
|
||||
@ -18,20 +18,20 @@
|
||||
|
||||
今天你将学到。
|
||||
|
||||
+ 中继工作方式,trunking
|
||||
+ 动态中继协议(Dynamic Trunking Protocol, DTP)
|
||||
+ VLAN 间路由
|
||||
- 中继工作方式,trunking
|
||||
- 动态中继协议(Dynamic Trunking Protocol, DTP)
|
||||
- VLAN 间路由
|
||||
|
||||
本单元覆盖 ICND1 考试大纲的以下要求。
|
||||
|
||||
+ 在思科交换机上配置并验证中继
|
||||
+ DTP
|
||||
+ 自动协商
|
||||
- 在思科交换机上配置并验证中继
|
||||
- DTP
|
||||
- 自动协商
|
||||
+ VLAN 间路由的配置和验证(单臂路由,router-on-a-stick)
|
||||
- 子接口,subinterfaces
|
||||
- 上行路由,upstream routing
|
||||
- 封装,encapsulation
|
||||
+ 配置交换机虚拟接口,configure SVI(Switch Virtual Interface) Interfaces
|
||||
- 配置交换机虚拟接口,configure SVI(Switch Virtual Interface) Interfaces
|
||||
|
||||
|
||||
## 配置并验中继链路
|
||||
@ -44,13 +44,13 @@
|
||||
|
||||
接着就是要中继链路所要使用的封装协议。这是通过执行 `switchport trunk encapsulation [option]` 命令完成的。此命令可用的选项有下面这些。
|
||||
|
||||
<pre>
|
||||
```
|
||||
Switch(config)#interface FastEthernet1/1
|
||||
Switch (config-if)#switchport trunk encapsulation ?
|
||||
dot1q - Interface uses only 802.1q trunking encapsulation when trunking
|
||||
isl - Interface uses only ISL trunking encapsulation when trunking
|
||||
negotiate - Device will negotiate trunking encapsulation with peer on interface
|
||||
</pre>
|
||||
```
|
||||
|
||||
关键字 `[dot1q]` 强制该交换机端口使用 IEEE 802.1Q 封装方式。关键字 `[isl]` 强制该交换机端口使用思科 ISL 封装方式。
|
||||
而 `[negotiate]` 关键字则指明说在动态交换机间链路协议(Dynamic Inter-Switch Link Protocol, DISL)及动态中继协议(Dynamic Trunking Protocol, DTP)无法就封装格式达成一致时,ISL 作为备选格式。DISL 简化了两台互联的快速以太网设备间 ISL 中继链路的建立。在 DISL 协议下,只需链路的一端需要配置为中继端口,因此而将 VLAN 中继配置过程大大简化。
|
||||
@ -58,15 +58,15 @@ negotiate - Device will negotiate trunking encapsulation with peer on interface
|
||||
|
||||
DTP 是一个***思科专有的***点对点协议(point-to-protocol), 它在两台交换机间协商建立起某种常见中继模式。DTP 会在稍后专门讲到。下面的输出演示了如何将某交换机端口配置为在建立起一条中继链路是采用 IEEE 802.1Q 封装方式。
|
||||
|
||||
<pre>
|
||||
```
|
||||
Switch (config)#interface FastEthernet1/1
|
||||
Switch (config-if)#switchport
|
||||
Switch (config-if)#switchport trunk encapsulation dot1q
|
||||
</pre>
|
||||
```
|
||||
|
||||
此配置可通过命令 `show interfaces [name] switchport` 进行验证,如下列输出所示。
|
||||
|
||||
<pre>
|
||||
```
|
||||
Switch#show interfaces FastEthernet1/1 switchport
|
||||
Name: Fa0/2
|
||||
Switchport: Enabled
|
||||
@ -79,30 +79,30 @@ Access Mode VLAN: 1 (default)
|
||||
Trunking Native Mode VLAN: 1 (default)
|
||||
...
|
||||
[Truncated Output]
|
||||
</pre>
|
||||
```
|
||||
|
||||
中继端口配置的第三步,就是部署配置,以确保该端口已被指定为中继端口。可以通过两种方式完成。
|
||||
|
||||
+ 手动(静态)地完成中继配置
|
||||
+ 使用动态中继协议(Dynamic Trunking Protocol, DTP)
|
||||
- 手动(静态)地完成中继配置
|
||||
- 使用动态中继协议(Dynamic Trunking Protocol, DTP)
|
||||
|
||||
|
||||
### 手动(静态)中继配置
|
||||
|
||||
手动配置一个中继,是通过在所需要的交换机上,执行接口配置命令 `switchport mode trunk` 完成的。此命令将该端口强制变成永久(静态)中继模式。下面的配置输出演示了如何将一个端口静态地配为中继端口。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server(config)#interface FastEthernet0/1
|
||||
VTP-Server(config-if)#switchport
|
||||
VTP-Server(config-if)#switchport trunk encapsulation dot1q
|
||||
VTP-Server(config-if)#switchport mode trunk
|
||||
VTP-Server(config-if)#exit
|
||||
VTP-Server(config)#
|
||||
</pre>
|
||||
```
|
||||
|
||||
如你使用的是一台低端交换机,就大可以忽略 `switchport` 命令,上面的输出是来自一台 Catalyst 6000 系列交换机。此配置可通过 `show interfaces [name] switchport` 命令予以验,如下面的输出所示。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server#show interfaces FastEthernet0/1 switchport
|
||||
Name: Fa0/1
|
||||
Switchport: Enabled
|
||||
@ -115,11 +115,11 @@ Access Mode VLAN: 1 (default)
|
||||
Trunking Native Mode VLAN: 1 (default)
|
||||
...
|
||||
[Truncated Output]
|
||||
</pre>
|
||||
```
|
||||
|
||||
尽管中继链路的静态配置强制交换机建立一条中继,动态 ISL 和动态中继协议(DTP)数据包仍能从该接口发出。这样做了后,一条静态配置的中继链路就可以与相邻的使用了 DTP 的交换机,建立起中继关系,接着的小节将会讲到。经由 `show interfaces [name] switchport` 命令的输出,便可验证这点。如下面的输出所示。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server#show interfaces FastEthernet0/1 switchport
|
||||
Name: Fa0/1
|
||||
Switchport: Enabled
|
||||
@ -131,12 +131,12 @@ Access Mode VLAN: 1 (default)
|
||||
Trunking Native Mode VLAN: 1 (default)
|
||||
...
|
||||
[Truncated Output]
|
||||
</pre>
|
||||
```
|
||||
|
||||
|
||||
在上面的输出中,粗体文字表明尽管中继链路是静态配置的,端口仍然在发出 DTP 和 DISL 数据包。在一些场合,此特性被看成是不受欢迎的。因此,通过执行接口配置命令 `switchport nonegotiate`,在静态配置作为中继链路的端口上关闭 DISL 及 DTP 数据包发送,被认为是一种良好实践,具体操作如以下的输出。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server(config)#interface FastEthernet0/1
|
||||
VTP-Server(config-if)#switchport
|
||||
VTP-Server(config-if)#switchport trunk encapsulation dot1q
|
||||
@ -144,11 +144,11 @@ VTP-Server(config-if)#switchport mode trunk
|
||||
VTP-Server(config-if)#switchport nonegotiate
|
||||
VTP-Server(config-if)#exit
|
||||
VTP-Server(config)#
|
||||
</pre>
|
||||
```
|
||||
|
||||
再一次,`show interfaces [name] switchport` 命令可被用作验证配置,像下面这样。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server#<b>show interfaces FastEthernet0/1 switchport</b>
|
||||
Name: Fa0/1
|
||||
Switchport: Enabled
|
||||
@ -161,14 +161,14 @@ Access Mode VLAN: 1 (default)
|
||||
Trunking Native Mode VLAN: 1 (default)
|
||||
...
|
||||
[Truncated Output]
|
||||
</pre>
|
||||
```
|
||||
|
||||
### 动态中继协议,Dynamic Trunking Protocol, DTP
|
||||
|
||||
DTP 是一个在两台交换机之间协商出一种常见中继模式的,思科专有的点对点协议(a Cisco proprietary point-to-protocol)。这种动态协商不止于何种中继模式,还包括中继的封装方式。根据其平台的不同,两种交换机端口所能使用的 DTP 模式如下。
|
||||
|
||||
+ 动态我要模式,dynamic desirable
|
||||
+ 动态自动模式,dynamic auto
|
||||
- 动态我要模式,dynamic desirable
|
||||
- 动态自动模式,dynamic auto
|
||||
|
||||
在两台相交换机上使用 DTP 时,如交换机端口默认为动态我要状态,端口就会积极尝试变为中继端口。而如果交换机端口默认为动态自动状态,端口仅会在相邻交换机被设置为动态我要模式时,才反转为中继端口。
|
||||
|
||||
@ -189,17 +189,17 @@ DTP 是一个在两台交换机之间协商出一种常见中继模式的,思
|
||||
|
||||
在交换的局域网中应用 DTP 时,`show dtp [interface <name>]` 命令就可用来显示交换机的全局 DTP 信息以及特定接口的 DTP 信息。下面的输出给出了 `show dtp` 命令打印出的信息。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server#show dtp
|
||||
Global DTP information
|
||||
Sending DTP Hello packets every 30 seconds
|
||||
Dynamic Trunk timeout is 300 seconds
|
||||
4 interfaces using DTP
|
||||
</pre>
|
||||
```
|
||||
|
||||
从上面的输出可以看出,交换机每 30 秒就发出一个 DTP 数据包。而 DTP 超时被设置为 300 秒(5 分钟),当前有 4 个接口正使用着 DTP。命令 `show dtp intferface [name]` 会打印出特定接口的 DTP 信息,这些信息中包括了接口的类型(中继或接入)、端口当前的 DTP 配置情况、中继的封装方式,以及 DTP 数据包统计信息,如下面的输出所示。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server#show dtp interface FastEthernet0/1
|
||||
DTP information for FastEthernet0/1:
|
||||
TOS/TAS/TNS: TRUNK/ON/TRUNK
|
||||
@ -225,7 +225,7 @@ DTP information for FastEthernet0/1:
|
||||
0 trunk timeouts
|
||||
2 link ups, last link up on Mon Mar 01 1993, 00:00:22
|
||||
1 link downs, last link down on Mon Mar 01 1993, 00:00:20
|
||||
</pre>
|
||||
```
|
||||
|
||||
### IEEE 802.1Q 原生 VLAN
|
||||
|
||||
@ -233,7 +233,7 @@ DTP information for FastEthernet0/1:
|
||||
|
||||
默认情况下,802.1Q 中继将 VLAN 1 作为原生 VLAN。执行命令 `show interfaces [name] switchport` 或命令 `show interfaces trunk`,就可查看到默认原生 VLAN 是哪一个,如下面的输出所示。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server#show interfaces FastEthernet0/1 switchport
|
||||
Name: Fa0/1
|
||||
Switchport: EnabledAdministrative Mode: trunk
|
||||
@ -246,26 +246,26 @@ Access Mode VLAN: 1 (default)
|
||||
Voice VLAN: none
|
||||
...
|
||||
[Truncated Output]
|
||||
</pre>
|
||||
```
|
||||
|
||||
交换机使用 VLAN 1 来承载一些特定的协议流量,比如思科发现协议(Cisco Discovery Protocol, CDP)、VLAN 中继协议(VLAN Trunking Protocol, VTP)、端口聚合协议(Port Aggregation Protocol, PAgP), 以及动态中继协议(Dynamic Trunking Protocol, DTP) 等的协议信息。CDP 和 PAgP 将在今天的课程后面部分详细讨论。尽管默认原生 VLAN 总是 VLAN 1, 它是可以手动修改为任何不在**保留 VLANs** 中的任何有效 VLAN 编号的。
|
||||
|
||||
但是,**中继链路两端上的原生 VLAN 必须一致**,记住这点是很重要。如出现了原生 VLAN 不匹配,生成树协议(Spanning Tree Protocol, STP)就把该端口置为端口 VLAN ID (port VLAN ID, PVID) 不一致状态,且不会转发该链路。此外,CDPv2 也会在交换机间传送原生 VLAN 信息,而在出现原生 VLAN 不匹配后,将会在交换机控制台上打印错误消息。通过对所需的 802.1Q 中继链路,执行接口配置命令 `switchport trunk native vlan [number]` 可以修改其默认原生 VLAN。如下面的输出所示。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server(config)#interface FastEthernet0/1
|
||||
VTP-Server(config-if)#switchport trunk native vlan ?
|
||||
<1-4094> VLAN ID of the native VLAN when this port is in trunking mode
|
||||
</pre>
|
||||
```
|
||||
|
||||
|
||||
### VLAN 间路由,Inter-VLAN Routing
|
||||
|
||||
默认情况下,尽管 VLANs 能够跨越整个的二层交换网络,一个 VLAN 中的主机却是不能直接和其它 VLAN 中的主机直接通信的。为实现这个目的,必须对不同 VLANs 间的流量进行路由。这就叫做 VLAN 间路由。交换局域网(switched LANs) 中的 VLAN 间路由有三种实现方式,下面有分别列出,这三种方式及其各自的优势和劣势,接下来的部分会详细介绍。
|
||||
|
||||
+ 采用物理的路由器接口的 VLAN 间路由, Inter-VLAN routing using physical router interfaces
|
||||
+ 采用路由器子接口的 VLAN 间路由, Inter-VLAN routing using router subinterfaces
|
||||
+ 采用交换机虚拟接口的 VLAN 间路由, Inter-VLAN routing using switched virtual interfaces
|
||||
- 采用物理的路由器接口的 VLAN 间路由, Inter-VLAN routing using physical router interfaces
|
||||
- 采用路由器子接口的 VLAN 间路由, Inter-VLAN routing using router subinterfaces
|
||||
- 采用交换机虚拟接口的 VLAN 间路由, Inter-VLAN routing using switched virtual interfaces
|
||||
|
||||
|
||||
**采用物理的路由器接口的 VLAN 间路由**
|
||||
@ -282,7 +282,7 @@ VTP-Server(config-if)#switchport trunk native vlan ?
|
||||
|
||||
在采用多物理路由器接口时,各需要的 VLAN 中到路由器的交换机链路,被配置为接入链路。然后路由器上的物理接口都配置上相应的 IP 地址,而 VLAN 上的网络主机,要么以静态方式配置上相应 VLAN 的 IP 地址,将该路由器物理接口作为默认网关,要么通过 DHCP 完成配置。图 3.3 中交换机的配置,在下面的输出中有演示。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server-1(config)#vlan 10
|
||||
VTP-Server-1(config-vlan)#name Example-VLAN-10
|
||||
VTP-Server-1(config-vlan)#exit
|
||||
@ -299,20 +299,20 @@ VTP-Server-1(config-if-range)#switchport
|
||||
VTP-Server-1(config-if-range)#switchport access vlan 20
|
||||
VTP-Server-1(config-if-range)#switchport mode access
|
||||
VTP-Server-1(config-if-range)#exit
|
||||
</pre>
|
||||
```
|
||||
|
||||
2960 交换机上无需 `switchport` 命令,因为其接口已经运行于二层模式。
|
||||
|
||||
下面的输出又演示了图 3.3 中的路由器的配置。
|
||||
|
||||
<pre>
|
||||
```
|
||||
R1(config)#interface FastEthernet0/0
|
||||
R1(config-if)#ip add 10.10.10.1 255.255.255.0
|
||||
R1(config-if)#exit
|
||||
R1(config)#interface FastEthernet0/1
|
||||
R1(config-if)#ip add 10.20.20.1 255.255.255.0
|
||||
R1(config-if)#exit
|
||||
</pre>
|
||||
```
|
||||
|
||||
**使用路由器子接口的 VLAN 间路由**
|
||||
|
||||
@ -326,7 +326,7 @@ R1(config-if)#exit
|
||||
|
||||
在交换机上,那条连接路由器的单一链路,必须要配置为中继链路,这是因为**路由器不支持 DTP**。假如中继配置成 802.1Q 中继,那么在原生 VLAN 不是默认原生 VLAN 时,此中继的原生 VLAN 一定要定义。而该**原生 VLAN 也要在相应的路由器子接口上予以配置,配置命令为 `encapsulation dot1q [vlan] native` 子接口配置命令**。下面的输出演示了使用单一物理接口的 VLAN 间路由配置(又称作 “单臂路由,router-on-a-stick”)。图 3.4 中绘出的两个 VLANs 在下面的输出中也有显示,同时还有一个额外的 VLAN 用于管理用;该管理 VLAN 将被配置为原生 VLAN。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server-1(config)#vlan 10
|
||||
VTP-Server-1(config-vlan)#name Example-VLAN-10
|
||||
VTP-Server-1(config-vlan)#exit
|
||||
@ -358,12 +358,12 @@ VTP-Server-1(config-if)#ip address 10.30.30.2 255.255.255.0
|
||||
VTP-Server-1(config-if)#no shutdown
|
||||
VTP-Server-1(config-if)#exit
|
||||
VTP-Server-1(config)#ip default-gateway 10.30.30.1
|
||||
</pre>
|
||||
```
|
||||
|
||||
图 3.4 中的路由器之配置如下面的输出所示。
|
||||
|
||||
|
||||
<pre>
|
||||
```
|
||||
R1(config)#interface FastEthernet0/0
|
||||
R1(config-if)#no ip address
|
||||
<b>R1(config-if)#no shut </b> <- 这一步相当重要,否则子接口也会处于 down down 状态
|
||||
@ -383,7 +383,7 @@ R1(config-subitf)#description ‘Subinterface For Management’
|
||||
R1(config-subif)#encapsulation dot1Q 30 native
|
||||
R1(config-subif)#ip add 10.30.30.1 255.255.255.0
|
||||
R1(config-subif)#exit
|
||||
</pre>
|
||||
```
|
||||
|
||||
此方案的主要优在于,路由器上仅需一个物理接口。主要的劣势在于,该物理端口的带宽,是为所配置的多个子接口所公用的。因此,如果存在很多 VLAN 间流量时,路由器就很快会成为网络的性能瓶颈。
|
||||
|
||||
@ -396,7 +396,7 @@ SVIs 是一系列代表了 VLAN 的逻辑接口。尽管某个交换机虚拟接
|
||||
|
||||
以下输出演示了在单一交换机上实现 VLAN 间路由,做出的交换机虚拟接口配置。此输出引用了本小节前面的配置输出所用到的 VLANs。
|
||||
|
||||
<pre>
|
||||
```
|
||||
VTP-Server-1(config)#vlan 10
|
||||
VTP-Server-1(config-vlan)#name Example-VLAN-10
|
||||
VTP-Server-1(config-vlan)#exit
|
||||
@ -423,13 +423,13 @@ VTP-Server-1(config-if)#description ‘SVI for VLAN 10’
|
||||
VTP-Server-1(config-if)#ip address 10.20.20.1 255.255.255.0
|
||||
VTP-Server-1(config-if)#no shutdown
|
||||
VTP-Server-1(config-if)#exit
|
||||
</pre>
|
||||
```
|
||||
|
||||
**在用到多层交换机时,交换机虚拟端口是推荐的配置方法,和实现 VLAN 间路由的首选方案**。
|
||||
|
||||
你可通过使用 `show interface vlan x` 命令,来验证某个交换机虚拟接口是配置恰当的(IP 分址等)。下面的输出与 `show interface x` 命令等同。
|
||||
|
||||
<pre>
|
||||
```
|
||||
Switch#show interfaces vlan 100
|
||||
Vlan100 is up, line protocol is down
|
||||
Hardware is EtherSVI, address is c200.06c8.0000 (bia c200.06c8.0000)
|
||||
@ -438,18 +438,18 @@ Vlan100 is up, line protocol is down
|
||||
reliability 255/255, txload 1/255, rxload 1/255
|
||||
Encapsulation ARPA, loopback not set
|
||||
ARP type: ARPA, ARP Timeout 04:00:00
|
||||
</pre>
|
||||
```
|
||||
|
||||
如你希望使用一台 2960 交换机来路由 IP 数据包,那么就需要对配置进行修改,然后进行重启。这是因为 2960 和更新型号的一些交换机进行了性能调优,实现一种明确的交换机资源分配方式。该资源管理方式叫做交换机数据库管理(Switch Database Managent, SDM)模板。你可以在以下几种 SDM 模板中进行选择。
|
||||
|
||||
+ 默认(default) -- 各项功能的平衡
|
||||
+ IPv4/IPv4 双协议支持(dual IPv4/IPv6) -- 用于双栈环境(dual-stack environments)
|
||||
+ Lanbase-routing -- 支持各种单播路由(Unicast routes)
|
||||
+ 服务质量(Quality of Service, QoS) -- 提供对各种服务质量特性的支持
|
||||
- 默认(default) -- 各项功能的平衡
|
||||
- IPv4/IPv4 双协议支持(dual IPv4/IPv6) -- 用于双栈环境(dual-stack environments)
|
||||
- Lanbase-routing -- 支持各种单播路由(Unicast routes)
|
||||
- 服务质量(Quality of Service, QoS) -- 提供对各种服务质量特性的支持
|
||||
|
||||
下面是在我的 3750 交换机上的输出。这些输出与 2960 上的选项不完全一致,但你明白了这个意思。同时,请记住,**交换机型号及 IOS 对 SDM 配置选项有影响,因此,你要查看你的型号的配置手册**。
|
||||
|
||||
<pre>
|
||||
```
|
||||
Switch(config)#sdm prefer ?
|
||||
access Access bias
|
||||
default Default bias
|
||||
@ -457,11 +457,11 @@ Switch(config)#sdm prefer ?
|
||||
ipe IPe bias
|
||||
lanbase-routing Unicast bias
|
||||
vlan VLAN bias
|
||||
</pre>
|
||||
```
|
||||
|
||||
在你期望在 2960 交换机上配置 VLAN 间路由时,就需要开启 Lanbase-routing SDM 选项。同时在此变更生效前,需要重启交换机。下面是 `show sdm prefer` 命令的输出,该输出告诉你当前的 SDM 配置以及资源分配情况。
|
||||
|
||||
<pre>
|
||||
```
|
||||
Switch#show sdm prefer
|
||||
The current template is “desktop default” template.
|
||||
The selected template optimizes the resources in
|
||||
@ -476,7 +476,7 @@ the switch to support this level of features for
|
||||
number of IPv4/MAC qos aces: 0.5K
|
||||
number of IPv4/MAC security aces: 1K
|
||||
Switch#
|
||||
</pre>
|
||||
```
|
||||
|
||||
## 虚拟局域网中继协议,VTP
|
||||
|
||||
@ -488,16 +488,16 @@ Switch#
|
||||
|
||||
采用 VTP 能够得到以下好处。
|
||||
|
||||
+ VLANs 信息的精确监控和汇报
|
||||
+ 整个网络上 VLANs 的一致性
|
||||
+ 易于添加和移除 VLANs
|
||||
- VLANs 信息的精确监控和汇报
|
||||
- 整个网络上 VLANs 的一致性
|
||||
- 易于添加和移除 VLANs
|
||||
|
||||
|
||||
### 配置 VTP, configuring VTP
|
||||
|
||||
要让交换机进行 VLAN 信息交换,这些交换机就务必要配置在同一个 VTP 域中,如下面的输出这样。
|
||||
|
||||
<pre>
|
||||
```
|
||||
Switch(config)#vtp mode server ←this is on by default
|
||||
Switch(config)#vtp domain in60days
|
||||
Changing VTP domain name from NULL to in60days
|
||||
@ -508,22 +508,22 @@ Maximum VLANs Supported Locally : 255
|
||||
Number of Existing VLANs : 5
|
||||
VTP Operating Mode : Server
|
||||
VTP Domain Name : <b>in60days</b>
|
||||
</pre>
|
||||
```
|
||||
|
||||
如要安全的传输 VTP 更新数据,可以为其加上一个口令,但要求 VTP 域中的每台交换机的口令都要匹配。
|
||||
|
||||
<pre>
|
||||
```
|
||||
Switch(config)#vtp password Cisco321
|
||||
Setting device VLAN database password to Cisco321
|
||||
</pre>
|
||||
```
|
||||
|
||||
### VTP 模式, VTP Modes
|
||||
|
||||
VTP 以下列三种模式允许。
|
||||
|
||||
+ 服务器模式(默认模式), server(default)
|
||||
+ 客户端模式, client
|
||||
+ 透明模式, transparent
|
||||
- 服务器模式(默认模式), server(default)
|
||||
- 客户端模式, client
|
||||
- 透明模式, transparent
|
||||
|
||||
上面的输出中,你可以看到配置中有个服务器模式。
|
||||
|
||||
@ -578,7 +578,7 @@ VLANs 是一种相当直观的交换机特性,它很少需要进行故障排
|
||||
- 接口务必要是 up/up
|
||||
- 中继链路两端的封装方式要匹配
|
||||
|
||||
<pre>
|
||||
```
|
||||
SwitchA#show interface fa1/1 switchport
|
||||
Name: Fa1/1
|
||||
<b>Switchport: Enabled</b>
|
||||
@ -588,7 +588,7 @@ Administrative Trunking Encapsulation: dot1q
|
||||
Operational Trunking Encapsulation: dot1q
|
||||
Negotiation of Trunking: Disabled
|
||||
Access Mode VLAN: 0 ((Inactive))
|
||||
</pre>
|
||||
```
|
||||
|
||||
+ VLAN 信息未有传输
|
||||
- 该 VLAN 在中继链路上阻塞了吗
|
||||
@ -613,8 +613,8 @@ VLAN 间路由故障可以多种形式出现,尤其是考虑在该过程中涉
|
||||
|
||||
从连通性立足点上看,下面这些情事都应该检查一下。
|
||||
|
||||
+ 检查一下终端主机连接了正确的交换机端口
|
||||
+ 检查一下正确的交换机端口连接了正确的路由器端口(如使用了一台路由器做 VLAN 间路由)
|
||||
- 检查一下终端主机连接了正确的交换机端口
|
||||
- 检查一下正确的交换机端口连接了正确的路由器端口(如使用了一台路由器做 VLAN 间路由)
|
||||
+ 检查一下在此过程中所涉及到的每个端口承载的是正确的 VLANs
|
||||
- 连接终端站的那些端口,通常是被分配到一个特定 VLAN 的接入端口
|
||||
- 而将交换机连接至路由器的那些端口,则通常是中继端口
|
||||
@ -623,12 +623,12 @@ VLAN 间路由故障可以多种形式出现,尤其是考虑在该过程中涉
|
||||
|
||||
可用于查看封类型的一些命令有以下这些。
|
||||
|
||||
+ `show interface trunk`
|
||||
+ `show interface <number> switchport`
|
||||
- `show interface trunk`
|
||||
- `show interface <number> switchport`
|
||||
|
||||
这里有个输出示例。
|
||||
|
||||
<pre>
|
||||
```
|
||||
Cat-3550-1#show interfaces trunk
|
||||
Port Mode Encapsulation Status Native vlan
|
||||
Fa0/1 on <b>802.1q</b> trunking 1
|
||||
@ -636,7 +636,7 @@ Fa0/2 on <b>802.1q</b> trunking 1
|
||||
Port Vlans allowed on trunk
|
||||
Fa0/1 1,10,20,30,40,50
|
||||
Fa0/2 1-99,201-4094
|
||||
</pre>
|
||||
```
|
||||
|
||||
命令 `show interface trunk` 提供的另一重要细节是中继状态。从中继状态可以看出中继是否形成,同时在链路两端都要检查中继状态。如果接口未处于“中继”模式,那么接口的运行模式(on, auto, 等)是最重要的检查项,以弄清接口能否允许与链路另一端形成中继态(a trunking state)。
|
||||
|
||||
@ -644,9 +644,9 @@ Fa0/2 1-99,201-4094
|
||||
|
||||
假如在完成二层检查任务后,VLAN 间路由问题仍然存在,你就可以继续进行三层配置检查了。依据用于实现 VLAN 间路由的三层设备,可能会在下列设备上进行配置及配置检查。
|
||||
|
||||
+ 多层交换机,multilayer switch
|
||||
+ 路由器 -- 物理接口, router -- physical interfaces
|
||||
+ 路由器 -- 子接口,router -- subinterfaces
|
||||
- 多层交换机,multilayer switch
|
||||
- 路由器 -- 物理接口, router -- physical interfaces
|
||||
- 路由器 -- 子接口,router -- subinterfaces
|
||||
|
||||
|
||||
三层设备上应该检查一下其各接口(或者交换机虚拟接口,SVI)都有分配的正确的子网,同时如有必要,你还应检查一下路由协议。通常情况下,各个 VLAN 都有分配不同的子网,所以你应确保你未曾错误配置了接口。而为检查此项,你可以对特定物理接口、子接口或是 SVI,使用 `show interface` 命令。
|
||||
@ -700,7 +700,7 @@ Fa0/2 1-99,201-4094
|
||||
2. 在交换机 A 上设置主机名(hostname), 创建 VLAN 2, 并将连接 PC 的那个接口放到 VLAN 2 中。如你愿意,你也可以赋予 VLAN 2 一个名称。
|
||||
|
||||
|
||||
<pre>
|
||||
```
|
||||
Switch>en
|
||||
Switch#conf t
|
||||
Enter configuration commands, one per line. End with CNTL/Z.
|
||||
@ -726,11 +726,11 @@ VLAN Name Status Ports
|
||||
1004 fddinet-default active
|
||||
1005 trnet-default active
|
||||
SwitchA#
|
||||
</pre>
|
||||
```
|
||||
|
||||
3. 将中继链路设置为中继模式。
|
||||
|
||||
<pre>
|
||||
```
|
||||
SwitchA#conf t
|
||||
Enter configuration commands, one per line. End with CNTL/Z.
|
||||
SwitchA(config)#int FastEthernet0/2
|
||||
@ -740,11 +740,11 @@ Port Mode Encapsulation Status Native vlan
|
||||
Fa0/2 on 802.1q trunking 1
|
||||
Port Vlans allowed on trunk
|
||||
<b>Fa0/2 1-1005</b>
|
||||
</pre>
|
||||
```
|
||||
|
||||
4. 如你愿意,设置在该中继链路上仅允许 VLAN 2。
|
||||
|
||||
<pre>
|
||||
```
|
||||
SwitchA(config)#int FastEthernet0/2
|
||||
SwitchA(config-if)#switchport trunk allowed vlan 2
|
||||
SwitchA(config-if)#^Z
|
||||
@ -755,22 +755,22 @@ Port Mode Encapsulation Status Native vlan
|
||||
Fa0/2 on 802.1q trunking 1
|
||||
Port Vlans allowed on trunk
|
||||
<b>Fa0/2 2</b>
|
||||
</pre>
|
||||
```
|
||||
|
||||
5. 此时,如你自其中一台 PC ping 往另一台,将会失败。这是因为一边是在 VLAN 1 中,另一边在 VLAN 2 中。
|
||||
|
||||
<pre>
|
||||
```
|
||||
PC>ping 192.168.1.1
|
||||
Pinging 192.168.1.1 with 32 bytes of data:
|
||||
Request timed out.
|
||||
Ping statistics for 192.168.1.1:
|
||||
Packets: Sent = 2, Received = 0, Lost = 2 (100% loss)
|
||||
</pre>
|
||||
```
|
||||
|
||||
6. 此时在交换机 B 上配置同样的那些命令。创建 VLAN、将交换机 PC 端口放入 VLAN 2,并将该接口设置为接入模式,还要将中继链路设置为 “中继”。
|
||||
7. 现在你就可以从一台 PC 实现跨越中继链路 ping 通另一 PC 了。
|
||||
|
||||
<pre>
|
||||
```
|
||||
PC>ping 192.168.1.1
|
||||
Pinging 192.168.1.1 with 32 bytes of data:
|
||||
Reply from 192.168.1.1: bytes=32 time=188ms TTL=128
|
||||
@ -781,18 +781,18 @@ Ping statistics for 192.168.1.1:
|
||||
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
|
||||
Approximate round trip times in milli-seconds:
|
||||
Minimum = 78ms, Maximum = 188ms, Average = 109ms
|
||||
</pre>
|
||||
```
|
||||
|
||||
|
||||
### VTP 实验
|
||||
|
||||
在一个又两台交换机组成的拓扑中,实验今天所提到的那些 VTP 配置命令。
|
||||
|
||||
+ 将其中一台交换机配置为 VTP 服务器
|
||||
+ 将另一台交换机配置为 VTP 客户端
|
||||
+ 在两台交换机上配置同样的 VTP 域及口令(the same VTP domain and password)
|
||||
+ 在服务器交换机上创建一系列的 VLANs,然后观察它们是如何彼此之间是如何通告的
|
||||
+ 在两台交换机上都配置 VTP 修剪(VTP pruning)
|
||||
+ 在两台交换机上检查(展示) VTP 配置
|
||||
+ 在两台交换机上配置不同的 VTP 域及口令,并重复上述过程;观察结果的不同
|
||||
- 将其中一台交换机配置为 VTP 服务器
|
||||
- 将另一台交换机配置为 VTP 客户端
|
||||
- 在两台交换机上配置同样的 VTP 域及口令(the same VTP domain and password)
|
||||
- 在服务器交换机上创建一系列的 VLANs,然后观察它们是如何彼此之间是如何通告的
|
||||
- 在两台交换机上都配置 VTP 修剪(VTP pruning)
|
||||
- 在两台交换机上检查(展示) VTP 配置
|
||||
- 在两台交换机上配置不同的 VTP 域及口令,并重复上述过程;观察结果的不同
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user