Cisco simulator of virtual local area network

table of Contents

Experiment 1 single-switch configuration VLAN

1.1 experimental content

1.2 Principle

1.3 key command

2 inter-switch VLAN Configuration Lab

2.1 experimental content

2.2 Principle

2.3 experimental results

3 Remote Switch Configuration Lab

3.1 experimental content

3.2 Principle

4 RSPAN Configuration Lab

4.1 experimental content

4.2 Principle

4.3 key command

4.4 environment configuration

5 VTP Configuration Lab

5.1 experimental content

5.2 Principle

5.3 key command


Experiment 1 single-switch configuration VLAN

1.1 experimental content

Mode switch connection terminals and the hub and port assigned to the individual circumstances of Vlan shown below, and the like corresponding to the respective Vlan forwarding table is empty in the initial state, sequentially at 1-6 MAC frame transmission process

1 A-->B

2 B-->A

3 E-->B

4 B-->E

5 B transmits a broadcast frame

6 F-->E

1.2 Principle

By default, all ports of the switch in the Default Vlan 1, so by default all switch ports belong to the same broadcast domain.

To accomplish the above experiments, the switches need to create VlAN Vlan. 3 and 2, and corresponding to the port assigned to the corresponding Vlan

1.3 key command

The switch configuration Vlan two-step process: 1. Create a plurality Vlan on the switch 2. The switch port is assigned to a different Vlan

1. Create Vlan

Global mode

vlan 2 // create a number 2 (Vlan ID = 2) of Vlan, enter the configuration mode of Vlan

name aabb // to define a specific Vlan name aabb

exit // Vlan exit configuration mode and return to global mode

2. The switch port is assigned to Vlan

     1. Allocate access port

Global mode

interface FastEthernet 0/1 // switch port to enter the interface configuration mode 0/1

// Use the interface configuration mode switchport mode access command, the access port is designated as 0/1 port, access port be untagged port, the MAC frame from the input and output ports does not carry a VLAN ID

switchport access vlan 2 // command in the interface configuration mode, port 0/1 as the access port is assigned to the number 2 of Vlan (Vlan ID = 2)

exit // exit interface configuration mode and return to global mode

     2. Assign shared port

interface FastEhternet 0/2 // switch port to enter the interface configuration mode 0/2

switchport mode trunk // use the interface configuration mode command, designated as trunk port 0/2 port, trunk port is the shared port, i.e. port tag. In addition to belonging to a local frame of Vlan Mac, Mac frame carries the other of Vlan Vlan ID belongs Mac frame from the input and output port

switchport trunk allowed vlan 2-4, 6 // command in the interface configuration mode, the command specifies a set of port Vlan 0/2, 2-4, 6 expressed as a set of three Vlan vlan number and number of 2-4 Vlan 6 composition.   The command represents the 0/2 port is shared four Vlan

exit // exit interface configuration mode and return to global mode

2 inter-switch VLAN Configuration Lab

2.1 experimental content

Construction of the network topology as shown below, the physical Ethernet of Vlan divided into three, namely Vlan2, Vlan3, Vlan4. In order to be able to guarantee the communication between each of the terminals belonging to the same Vlan, required: 1. belong switched path between the terminals belonging to the same terminal Vlan Vlan same configuration have the same IP address network number 2. Establish

2.2 Principle

In order to guarantee the existence of a path between the terminals belonging to the same exchange of Vlan switch and to create processes Vlan Vlan assigned ports required following principles:

1. The principle of distribution ports: If only a single path only belongs Vlan exchange through a switch port, the port as the access port allocated to the Vlan

如果有属于不同的Vlan的交换路径经过某个交换机端口,则将交换机端口配置为被这些Vlan共享的共享端口

2. 创建Vlan原则:如果某个交换机直连连接属于某个Vlan的终端,该交换机中需要创建该vlan

如果某个交换机没有直接连接属于某个Vlan的终端,但有属于该Vlan的交换路径经过该交换机的端口,该交换机也要创建该Vlan

故:交换机0 1 2创建的Vlan及Vlan与端口的映射如下表所示

交换机1

Vlan 接入端口 共享端口
Vlan 2 1,2 4
Vlan 4 3 4

 

交换机0

Vlan 接入端口 共享端口
Vlan2 3 1
Vlan3 4 2
Vlan4   1,2

交换机2

Vlan 接入端口 共享端口
Vlan 3 2,3 4
Vlan 4  1 4

 

从接入端口输入输出的MAC帧不携带VlanID 是普通的MAC帧格式

从共享端口输入输出的MAC帧携带MAC帧所属的Vlan的VlanID

MAC帧格式的802.1q标准MAC帧格式

2.3 实验现象

启动设备C至设备D的MAC帧传输过程,由于交换机1的0/4端口是被Vlan2和Vlan4共享的共享端口,因此该MAC帧经过交换机1的0/4端口输出时,携带Vlan4对应的VlanID,如下图所示

在这个MAC帧格式中:标记协议字符(Tag Protocol Identified,TPID)字段为16进制0x8100,表示的是802.1q标准的MAC帧,

这里的标记控制信息(Tag Control Informatin ,TCI)字段值就是VlanID,TCI=0x0004表示VLANID=4

注意:802.1q标准MAC帧紧跟TCI字段的是普通MAC帧中的类型字段,因为该MAC帧封装了IP分组,类型字段值应该是16进制0800(0x800),如下图所示

3 交换机远程配置实验

3.1 实验内容

交换机可以定义任何VLAN对应的IP接口,并把该IP接口作为管理接口。为该IP接口配置的IP地址自然作为该交换机的管理地址。

终端实现对交换机远程配置的前提是,存在该终端与交换机管理接口之间的传输通路 

对于该拓扑来说,可以分别为交换机0 1 2定义Vlan 4对应的IP接口,并将该IP接口作为这三个交换机的管理接口。由于只有终端C和终端D属于Vlan4,因此只有终端C和终端能够实现对着三个交换机的远程配置过程。

为三个交换机中Vlan4对应的IP接口分配与终端C和终端D有着相同网络号的IP地址

3.2 实验原理

1 需要为每一个交换机定义管理接口,并为管理接口分配IP地址

2 需要保证允许实施远程配置的终端与每一个交换机的管理接口的连通性

3 需要启动交换机远程登录功能   通常情况下,远程登录过程中,交换机需要鉴别远程登录用户的身份,因此需要在交换机中配置鉴别信息,交换机通过配置的鉴别信息对用户的身份和配置权限进行鉴别

4 通过Vlan划分,限制允许建立与每一个交换机的管理接口之间的传输通路的终端范围。在没有设置路由设备的情况下,只有属于相同Vlan的终端才能建立与该Vlan对应的Ip接口之间的传输通路。即使设置路由设备,只要不为交换机配置默认网关地址,同样只有属于相同的Vlan,且配置与管理接口有着相同网络号的IP地址的终端才能访问到该管理接口

交换机1

交换机0

交换机2

也可以看这篇文章

4 RSPAN配置实验

4.1 实验内容

在如下图所示的网络拓扑中,在交换机2中连接一个嗅探器可以嗅探到终端A发送的ICMP报文,即嗅探器可以复制下所有由终端A发送的ICMP报文

4.2 实验原理

交换机1连接终端A的端口叫做源端口,交换机2连接嗅探器的端口为目的端口,创建一个用于建立交换机1到交换机2传输通路的RSPAN LAN.交换机1接收到终端A发送的MAC帧后,将MAC帧映射到一个反射端口,由反射端口将该MAC帧发送到RSPAN VLAN,该MAC帧通过RSPAN VLAN到达交换机2,由交换机2将该MAC帧映射到目的端口。、

因此实现远程端口映射后,终端A发送的MAC帧存在两种独立的传输路径,一是正常的传输路径,二是通过RSPAN VLAN实现的源端口至目的端口的传输路径

4.3 关键命令

1 创建 RSPAN VLAN

全局模式

vlan 5

remote - span //VLAN配置模式下使用的命令,用于将特定的VLAN(这里是 vlan 5)定义为RSPAN VLAN

name rspan

exit

2 源端口所在交换机配置过程

   需要完成2个配置,1 指定源端口  2将通过源端口接收到的MAC帧映射到一个反射端口,并由反射端口将该MAC帧发送到RSPAN VLAN

全局模式

no monitor all    //清除所有的映射

monitor session 1 source interface FastEthernet 0/1 rx  //1 指定0/1端口为源端口 2 指定需要嗅探的MAC帧,rx表示之嗅探源端口接受到的MAC帧

monitor session 1 destination remote vlan 5 reflector-port FastEthernet 0/17  //1 指定vlan 5 为RSPAN VLAN 2 指定0/17端口为反射端口,任何没有使用的交换机端口都可以作为反射端口 

       相同的会话号1(session 1)将源端口和RSPAN VLAN绑定在一起,上面两条命令的作用:将通过源端口0/1接受到的MAC映射到反射端口0/17 ,并且通过反射端口 0/17 将该MAC帧发送到VLAN 5

3 目的端口所在交换机配置过程

全局模式

no monitor all  

monitor session 1 source remote vlan 5  //指定vlan 5为RSPAN VLAN

monitor session 1 destination inferface FastEthernet 0/5  //指定0/5为目的端口

          相同的会话号1(session 1)将RSPAN VLAN和目的端口绑定在一起,这两条命令的作用:将通过VLAN 5接受到的MAC帧映射到目的端口0/5

4.4 环境配置

主要完成的配置 1.在三个交换机中创建vlan5 并定义为RSPAN VLAN    2 建立基于VLAN5的交换机1至2的路径 3 在交换机1中建立源端口与Vlan5之间的绑定 4在交换机2中家里目的端口与Vlan5的绑定

交换机1

 交换机0

交换机2

5 VTP配置实验

5.1 实验内容

网络拓扑结构如下图,六个交换机构成的交换式以太网被划分成两个Vlan主干协议(VLAN Trunking Protocol,VTP)域,其中域名为abc的VTP域包含交换机1 2 3,域名为bcd的域包含交换机4 5 6,域名为abc中将交换机2设置为服务器模式,其他两个交换机的VTP模式设置为客户端模式。域名为bcd中将交换机5设置为服务器模式,其他两个交换机的VTP模式设置为客户端模式。

每一个VTP域,只需在VTP模式为服务器的交换机配置VLAN,其他交换机自动创建与该交换机一致的Vlan。因此只需要在交换机2和5中通过手工创建编号为2和3的vlan,其他交换机自动创建编号为2和3的vlan

5.2 实验原理

VTP自动创建vlan的前提是,所有互联交换机的端口都是被所有Vlan共享的共享端口,因此,所有交换机中用于连接交换机的端口必须配置成被所有VLAN共享的共享端口

必须通过手工配置将作为接入端口的交换机端口分配给各个Vlan,如下表所示

VLAN 终端
VLAN 2 A C E G
VLAN 3 B D F H

 VTP域的划分只和交换机自动创建VLAN过程有关,即一旦在某个VTP模式为服务器的交换机上创建编号为X,名为Y的VLAN,所有处于同一VTP域中VTP模式为服务器或者客户端的交换机自动创建编号X 名为Y的VLAN. 通过域名区分不同的VTP域,但VTP模式为服务器的交换机上配置的域名能够自动扩散到同一域中的其他交换机,因此,必须在处于不同域的两个域边界交换机上配置各自的域名,如上图中交换机2和5。VTP域的划分与属于同一VLAN的两个终端之间的通信过程无关,两个属于不同的VTP域但属于编号相同的VLAN的终端之间可以相互通信,如上图的A和G通信。同样两个属于相同的VTP域但属于不同的VLAN的终端之间不能相互通信,如上图的A和B

5.3关键命令

1 配置域名

全局模式

vtp domain abc //为交换机配置域名abc 交换机默认状态下域名为NULL,VTP模式为服务器模式,因此一旦为某个交换机配置域名,如abc,该域名将自动扩散到整个VTP域中。每一个VTP域由域名相同的交换机组成。如果需要将交换式以太网分成多个VTP域,如上图所示的两个域,必须在处于不同域的两个域边界交换机上配置各自的域名,如分别在交换机2和5配置不同的域名abc和bcd

2 配置交换机的VTP模式

全局模式

vtp mode server  //将交换机的模式设置为服务器,功能1 在该交换机上创建某个VLAN,属于同一VTP域的,VTP模式为服务器或者客户端的交换机上自动创建相同的VLAN 2 一旦为该交换机配置域名,该域名将自动扩散到所有没有配置其他域名的交换机中

vtp mode client  //将交换机的VTP模式设置成客户端。只能同步VTP模式为服务器的交换机的VLAN创建过程,不能通过手工创建VLAN

vtp mode transparent   //将交换机的VTP模式设置为透明。只能转发VTP报文,

3 配置VTP版本号

全局模式

vtp versison2  //将VTP的版本号指定为2,Cisco Packet Tracer支持的VTP版本号为1 2。所有逇交换机必须指定相同的版本号

4 配置域管理密码

全局模式

vtp password 123456 //指定VTP密码为123456. VTP密码用于验证发送VTP通告的交换机的身份,某个交换机一旦配置VTP密码X,则该交换机发送的VTP通告中携带MD5(VTP通告首部||密码X)

5 禁止发送DTP协商报文

        两个共享端口(中继端口)之间通过动态中继协议(Dynamic Trunking Protocol,DTP)协商端口属性。如果两个共享端口分属不同的VTP域,那么会使协商的过程出错,因此需要在域边界交换机中用于连接其他域边界交换机的共享端口上禁止DTP协商过程

全局模式

interface FastEthernet 0/3  

switchport nonegotiate   //禁止指定端口0/3进行DTP协商

exit

发布了122 篇原创文章 · 获赞 58 · 访问量 4万+

Guess you like

Origin blog.csdn.net/qq_39112646/article/details/103972314