交换机配置于详解——Vlan/Inter-Vlan/Pvlan

分级网络设计(局域网设计方案)

接入层:为终端设备提供访问接口,实现了冲突域的隔离,VLAN的划分,交换机的端口安全

汇聚层:实现Vlan间通信,广播域的划分,并且定义了控制类型通信(路由更新、汇总、vlan间通信、地址聚合、访问控制、路由重分布)的策略。

核心层:快速转发。

交换机配置于详解——Vlan/Inter-Vlan/Pvlan_第1张图片

 

 

 

 

 

 

 

 

 

交换机配置于详解——Vlan/Inter-Vlan/Pvlan_第2张图片

Vlan的类型:

默认vlan:vlan号为1,默认情况下,所有的接口都是 vlan1

本地vlan:是主干端口的特征,当帧标记和本地vlan一样时,清除标记再发送;如果进入时没有帧标记则把本地vlan作为帧标记添加上。注意:主干端口的两端接口的本地vlan要匹配,否则会出错。通过 switchport trunk native vlan vlan-id 命令修改本地vlan。

数据vlan:用户产生的数据。

trunk的定义:

  1. Ethernet trunks carry the traffic of multiple VLANs over a single link
  2. A VLAN trunk allows you to extend the VLANs across an entire network
  3. A VLAN trunk does not belong to a specific VLAN

二层交换端口:

交换端口:access、trunk

聚合端口:应用于交换机之间的多链路捆绑技术。它的基本原理是:将两个设备间多条物理链路捆绑在一起组成一条逻辑链路,从而达到带宽倍增的目的(这条逻辑链路带宽相当于物理链路带宽之和)。除了增加带宽外,端口聚合还可以在多条链路上均衡分配流量,起到负载分担的作用;当一条或多条链路故障时,只要还有链路正常,流量将转移到其它的链路上,整个过程在几毫秒内完成,从而起到冗余的作用,增强了网络的稳定性和安全性。两台交换机之间是否形成EtherChannel也可以用协议自动协商。目前有两个协商协议:PAgP和LACP,PAgP(端口汇聚协议 Port Aggregation Protocol)是Cisco私有的协议,而LACP(链路汇聚控制协议 Link Aggregation Control Protocol)是基于IEEE 802.3ad的国际标准,是一种实现链路动态聚合的协议。

三层交换端口:

交换虚接口:VLAN Switch virtual interface ,SVI 可设置IP地址作为VLAN内主机的网关。

Routed Port:no switchport

L3 Aggregate Ports

 VLAN配置

#Add a VLAN
Switch(config)# vlan vlan-id
Switch(config-vlan)# name vlan-name
#Delete a VLAN
Switch(config)# no vlan vlan-id
#配置access端口
Switch(config)# interface interface-id
Switch(config)# interface range {port-range}
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan vlan-id
#配置trunk端口
Switch(config)# interface interface-id
Switch(config-if)#switchport mode trunk
#配置native-vlan-一般不配置
Switch(config-if)#switchport trunk native vlan vlan-id
#配置trunk的控制列表
Switch(config-if)# switchport trunk allowed vlan { all | [add| remove | except]} vlan-list
All:  allow list includes all vlans
Add: adds the vlan-list  to join permission list.
Remove:  removes the vlan-list VLAN from the permission list.
Except: 除了列出的vlan,其他都同意。
 

VLAN间通信

基于路由子接口的vlan间通信  


交换机配置于详解——Vlan/Inter-Vlan/Pvlan_第3张图片
 
#选择物理接口,注意要将与路由器连接的交换机端口配置为trunk
Router(config)#interface fastEthernet 0/0
Router(config-if)#no ip address
Router(config-if)#exit
#配值路由子接口
Router(config)#interface fastEthernet 0/0.10
#封装dot1q,绑定到vlan 10
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 192.168.10.1 255.255.255.0
Router(config-subif)#exit
Router(config)#interface fastEthernet 0/0.20
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 192.168.20.1 255.255.255.0
Router(config-subif)#exit
Router(config)#interface fastEthernet 0/0.30
Router(config-subif)#encapsulation dot1Q 30
Router(config-subif)#ip address 192.168.30.1 255.255.255.0
Router(config-subif)#end

基于三层交换的vlan间路由

#配置交换虚接口,绑定到vlan-id

Switch(config)# interface vlan vlan-id

#配置vlan的ip
Switch(config-if)# ip address ip-address mask

上图实例解析:

S3750(config)#interface vlan 10

S3750(config-if)#ip address 192.168.10.1 255.255.255.0
S3750(config-if)#exit
 
S3750(config)#interface vlan 20
S3750(config-if)#ip address 192.168.20.1 255.255.255.0
S3750(config-if)#exit
 
S3750(config)#interface vlan 30
S3750(config-if)#ip address 192.168.30.1 255.255.255.0
S3750(config-if)#end
 

Private VLAN

  在Private VLAN的概念中, 交换机端口有三种类型:Isolated port,Community port, Promiscuous port;它们分别对应不同的VLAN类型:Isolated port属于Isolated PVLAN,Community port属于Community PVLAN,而代表一个Private VLAN整体的是Primary VLAN,前面两类VLAN需要和它绑定在一起,同时它还包括Promiscuous port。在Isolated PVLAN中,Isolated port只能和Promiscuous port通信,彼此不能交换流量;在Community PVLAN中,Community port不仅可以和Promiscuous port通信,而且彼此也可以交换流量。Promiscuous port 与 路由器或第3层 交换机接口相连,它收到的流量可以发往Isolated port和Community port。PVLAN的应用对于保证接入网络的数据通信的安全性是非常有效的,用户只需与自己的 默认网关连接,一个PVLAN不需要多个VLAN和IP 子网就提供了具备第2层数据通信安全性的连接,所有的用户都接入PVLAN,从而实现了所有用户与默认网关的连接,而与PVLAN内的其他用户没有任何访问。PVLAN功能可以保证同一个VLAN中的各个端口相互之间不能通信,但可以穿过Trunk端口。这样即使同一VLAN中的用户,相互之间也不会受到广播的影响。

PVLAN类型

每个pVLAN 包含2种VLAN :主VLAN(primary VLAN)和辅助VLAN(Secondary VLAN)。
辅助VLAN(Secondary VLAN)包含两种类型:隔离VLAN(isolated VLAN)和团体VLAN(community VLAN)。

接口类型

pVLAN中的两种接口类型:处在pVLAN中的 交换机物理端口,有两种接口类型。
①混杂端口(Promiscuous Port)
②主机端口(Host Port)
其中“混杂端口”是隶属于“Primary VLAN”的;“主机端口”是隶属于“Secondary VLAN”的。因为“Secondary VLAN”是具有两种属性的,那么,处于“Secondary VLAN”当中的“主机端口”依“Secondary VLAN”属性的不同而不同,也就是说“主机端口”会继承“Secondary VLAN”的属性。那么由此可知,“主机端口”也分为两类——“isolated端口”和“community端口”。
处于pVLAN中 交换机上的一个物理端口要么是“混杂端口”要么是“isolated”端口,要么就是“community”端口。

通信范围

  1. primary VLAN:可以和所有他所关联的isolated VLAN,community VLAN通信。
  2. community VLAN:可以同那些处于相同community VLAN内的community port通信,也可以与pVLAN中的promiscuous端口通信。 (每个pVLAN可以有多个community VLAN)
  3. isolated VLAN:不可以和处于相同isolated VLAN内的其它isolated port通信,只可以与promiscuous端口通信。 (每个pVLAN中只能有一个isolated VLAN)

pVLAN当中使用的一些规则:

  1. 一个“Primary VLAN”当中至少有1个“Secondary VLAN”,没有上限。
  2. 一个“Primary VLAN”当中只能有1个“Isolated VLAN”,可以有多个“Community VLAN”。
  3. 不同“Primary VLAN”之间的任何端口都不能互相通信(这里“互相通信”是指二层连通性)。
  4. “Isolated端口”只能与“混杂端口”通信,除此之外不能与任何其他端口通信。
  5. “Community端口”可以和“混杂端口”通信,也可以和同一“Community VLAN”当中的其它物理端口进行通信,除此之外不能和其他端口通信。

通用的LAN的troubleshooting方法

交换机配置于详解——Vlan/Inter-Vlan/Pvlan_第4张图片

 

转载于:https://www.cnblogs.com/mhzhou-whyj/p/9170273.html

你可能感兴趣的:(交换机配置于详解——Vlan/Inter-Vlan/Pvlan)