跟我学交换机配置(四)

跟我学交换机配置(四)

以下内容摘自笔者最新图书
Cisco/H3C交换机配置与管理完全手册》
本书在51CTO上的样章试读地址为:
http://book.51cto.com/art/200908/142118.htm
8.5.4 创建PVLAN

在IOS和CatOS系统交换机中都可以配置PVLAN,所以下面也分别予以介绍。


1. IOS系统交换机的PVLAN创建

在IOS系统交换机中,创建一个PVLAN的步骤如表8-18所示。.

表8-18 配置VLAN作为PVLAN的步骤

命令

用途

Step 1 

Switch(config)# vlan vlan_ID

键入要配置的VLAN的VLAN ID,进入VLAN配置模式

Step 2 

Switch(config-vlan)# private-vlan {
community | isolated | primary}

配置该VLAN为PVLAN

Switch(config-vlan)# no private-vlan {
community | isolated | primary}

清除PVLAN配置。这个命令的配置要到退出VLAN配置模式后才会生效

Step 3 

Switch(config-vlan)# end

退出VLAN配置模式

Step 4 

Switch# show vlan private-vlan [type]

校验以上配置

以下示例显示如何配置VLAN 202作为一个主VLAN(primary VLAN),并校验配置。

Switch# configure terminal

Switch(config)# vlan 202

Switch(config-vlan)# private-vlan primary

Switch(config-vlan)# end

Switch# show vlan private-vlan

Primary Secondary Type Interfaces

——- ——— —————– ——————————————

202 primary

以下示例显示如何配置VLAN 303作为公共VLAN(community VLAN),并校验配置。

Switch# configure terminal

Switch(config)# vlan 303

Switch(config-vlan)# private-vlan community

Switch(config-vlan)# end

Switch# show vlan private-vlan

Primary Secondary Type Interfaces

——- ——— —————– ——————————————

202 primary

303 community

以下示例显示如何配置VLAN 440作为一个隔离VLAN(isolated VLAN),并校验配置。

Switch# configure terminal

Switch(config)# vlan 440

Switch(config-vlan)# private-vlan isolated

Switch(config-vlan)# end

Switch# show vlan private-vlan

Primary Secondary Type Interfaces

——- ——— —————– ——————————————

202 primary

303 community

440 isolated



2. CatOS系统交换机的PVLAN创建

你可以使用“set pvlan primary_vlan_num {
isolated_vlan_num | community_vlan_num}”命令绑定没有与隔离端口(isolated port)或者公共端口(community port)关联的隔离VLAN(isolated VLAN)或者公共VLAN(community VLAN)到主VLAN(private VLAN)中。也可以使用“set pvlan primary_vlan_num {
isolated_vlan_num | community_vlan_num} mod/port”命令改变PVLAN中的隔离或者公共端口,而不用改变隔离或者公共VLAN。

你必须键入“set pvlan”命令来创建PVLAN,具体的步骤如表8-19所示。

表8-19 在CatoS系统交换机上创建PVLAN的步骤

命令

用途说明

Step 1 

Console> (enable) set vlan vlan_num pvlan-type primary

创建主VLAN

Step 2 

Console> (enable) set vlan vlan_num pvlan-type {
isolated | community}

设置隔离或者公共VLAN

Step 3 

Console> (enable)set pvlan primary_vlan_num {
isolated_vlan_num | community_vlan_num}mod/ports

绑定隔离或者公共VLAN到主VLAN中,并把隔离或者公共VLAN与PVLAN进行关联

Step 4 

Console> (enable) set pvlan mapping primary_vlan_num {
isolated_vlan_num | community_vlan_num} mod/ports

在混杂端口上映射隔离、公共VLAN到主VLAN

Step 5 

Console> (enable) show pvlan [vlan_num]

Console> (enable) show pvlan mapping

校验PVLAN配置

以下示例显示了如何使用VLAN 7作为主VLAN,VLAN 901作为隔离VLAN,VLAN 902和VLAN 903作为公共VLAN来创建一个PLAVN。VLAN 901使用模块4的端口3;VLAN 902使用模块4的端口4~6;VLAN 903使用模块4的端口7~9。路由器是连接到混杂端口3/1上的。

在开始编辑没有分配端口的VLAN 7、901、902、903前,使用“show vlan vlan_num”命令查看各VLAN中端口成员。如果在这些VLAN中,已分配了任何端口,使用“set vlan vlan_num {
mod/port}”命令设置它们到其他适当的VLAN中。

以下示例显示了如何指定VLAN 7作为主LVAN。

Console> (enable) set vlan 7 pvlan-type primary

Vlan 7 configuration successful

Console> (enable)

以下示例显示如何指定VLAN 901作为隔离VLAN,VLAN 902和VLAN 903作为公共VLAN。

Console> (enable) set vlan 901 pvlan-type isolated

Vlan 901 configuration successful

Console> (enable) set vlan 902 pvlan-type community

Vlan 902 configuration successful

Console> (enable) set vlan 903 pvlan-type community

Vlan 903 configuration successful

Console> (enable)

以下示例显示如何绑定VLAN 901到主VLAN 7中,并指定端口4/3作为隔离端口。

Console> (enable) set pvlan 7 901 4/3

Successfully set the following ports to Private Vlan 7,901: 4/3

Console> (enable)

以下示例显示如何绑定VLAN 902到主VLAN 7中,并指定端口4/4~4/6作为隔离端口。

Console> (enable) set pvlan 7 902 4/4-6

Successfully set the following ports to Private Vlan 7,902:4/4-6

Console> (enable)

以下示例显示如何绑定VLAN 903到主VLAN 7中,并指定端口4/7~4/9作为隔离端口。

Console> (enable) set pvlan 7 903

Successfully set association between 7 and 903.

Console> (enable) set pvlan 7 903 4/7-9

Successfully set the following ports to Private Vlan 7,903:4/7-9

Console> (enable)

以下示例显示如何在混杂端口3/1上映射每个隔离和公共VLAN流量到主VLAN。

Console> (enable) set pvlan mapping 7 901 3/1

Successfully set mapping between 7 and 901 on 3/1

Console> (enable) set pvlan mapping 7 902 3/1

Successfully set mapping between 7 and 902 on 3/1

Console> (enable) set pvlan mapping 7 903 3/1

Successfully set mapping between 7 and 903 on 3/1

以下示例显示如何校验PVLAN配置。

Console> (enable) show vlan 7

VLAN Name Status IfIndex Mod/Ports, Vlans

—- ——————————– ——— ——- ————————

7 VLAN0007 active 35 4/4-6

VLAN Type SAID MTU Parent RingNo BrdgNo Stp BrdgMode Trans1 Trans2

—- —– ———- —– —— —— —— —- ——– —— ——

7 enet 100010 1500 – – – – – 0 0

VLAN DynCreated RSPAN

—- ———- ——–

7 static disabled

VLAN AREHops STEHops Backup CRF 1q VLAN

—- ——- ——- ———- ——-

Primary Secondary Secondary-Type Ports

——- ——— —————– —————–

7 901 Isolated 4/3

7 902 Community 4/4-6

7 903 Community 4/7-9

Console> (enable) show vlan 902

VLAN Name Status IfIndex Mod/Ports, Vlans

—- ——————————– ——— ——- ————————

902 VLAN0007 active 38 4/4-6

VLAN Type SAID MTU Parent RingNo BrdgNo Stp BrdgMode Trans1 Trans2

—- —– ———- —– —— —— —— —- ——– —— ——

7 enet 100010 1500 – – – – – 0 0

VLAN DynCreated RSPAN

—- ———- ——–

7 static disabled

VLAN AREHops STEHops Backup CRF 1q VLAN

—- ——- ——- ———- ——-

Primary Secondary Secondary-Type Ports

——- ——— —————– —————–

7 902 Isolated 4/4-6

Console> (enable) show pvlan

Primary Secondary Secondary-Type Ports

——- ——— ————– ————

7 901 isolated 4/3

7 902 community 4/4-6

7 903 community 4/7-9

Console> (enable) show pvlan mapping

Port Primary Secondary

—– ——– ———-

3/1 7 901-903

Console> (enable) show port

Port Name Status Vlan Duplex Speed Type

—– —————— ———- ———- —— —– ————

…truncated output…

4/3 notconnect 7,901 half 100 100BaseFX MM

4/4 notconnect 7,902 half 100 100BaseFX MM

4/5 notconnect 7,902 half 100 100BaseFX MM

4/6 notconnect 7,902 half 100 100BaseFX MM

4/7 notconnect 7,903 half 100 100BaseFX MM

4/8 notconnect 7,903 half 100 100BaseFX MM

4/9 notconnect 7,903 half 100 100BaseFX MM

… truncated output…

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/110872.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Python语言培训_python文件是怎么打开

    Python语言培训_python文件是怎么打开述(最多18字以下试题内容来源由-众课帮-公众号和小程序提供可查询更多的试题答案新鲜尿液有氨臭味变异性心绞痛患者首选药物是A_______ofdependenceonGMOseedsandchemicalfertilizers,pesticides(杀虫剂),andherbicides(除草剂)isthencreatedinordertogrowasinglecrop.如果要对事物发展变化的未来趋势做出描述,例如对五年后技术变革方向进行预测,通常采..

    2022年9月3日
    5
  • Apache Ant安装与配置

    Apache Ant安装与配置下载ApacheAnt1.8.4http://ant.apache.org/bindownload.cgi一、解压ant安装包在D:\SWE下二、环境变量配置ANT_HOMED:\SWE\apache-ant-1.8.4CLASSPATH;%ANT_HOME%lib;PATH  ;%ANT_HOME%bin;三、测试是否安装成功在cm

    2022年7月24日
    6
  • python 元类编程_python定义元组

    python 元类编程_python定义元组前言通常我们创建类都是使用class类名,但是小伙伴们有没有想过,类是由谁来创建的呢,python中常说的万物皆对象,对象是由类创建的,那类本身也可以看做是对象,类可以由元类type创建type

    2022年7月30日
    3
  • CentOS7 yum 安装 maven「建议收藏」

    CentOS7 yum 安装 maven「建议收藏」CentOS-7yum安装mavenCentOS-7设置为阿里云yum源rm-rf/etc/yum.repos.d/*curl-o/etc/yum.repos.d/Centos-7.repohttp://mirrors.aliyun.com/repo/Centos-7.repocurl-o/etc/yum.repos.d/epel-7.repohttp://mirrors.aliyun.com/repo/epel-7.repo安装mavenyum-yinsta.

    2022年5月12日
    28
  • CTFshow——SSTI

    CTFshow——SSTI首先一定要了解有关python类的知识:python__base__等内置方法pythoninspect模块解析#coding=utf-8__author__=”leaves”classBase(object):a=0def__init__(self):self._a=10passclassChild(Base):”测试测试”_b=10def__str__(

    2022年10月20日
    0
  • acwing-190. 字串变换(双向bfs)

    acwing-190. 字串变换(双向bfs)已知有两个字串 A, B 及一组字串变换的规则(至多 6 个规则):A1→B1A2→B2…规则的含义为:在 A 中的子串 A1 可以变换为 B1、A2 可以变换为 B2…。例如:A=abcd B=xyz变换规则为:abc → xu ud → y y → yz则此时,A 可以经过一系列的变换变为 B,其变换的过程为:abcd → xud → xy → xyz共进行了三次变换,使得 A 变换为 B。输入格式输入格式如下:A BA1 B1A2 B2… …第一行是两个给定的字符串

    2022年8月9日
    1

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号