Home Database Mysql Tutorial 解析Cisco交换机配置Vlan

解析Cisco交换机配置Vlan

Jun 07, 2016 pm 03:30 PM
cisco vlan switch think parse Configuration

* vlan 配置 思路 (access 、Trunk) (1)创建Vlan 在基于IOS的 交换机 上 配置 静态VLAN: switch# vlan database switch(vlan)# vlan vlan-num name vlan-name switch(vlan)# exit switch# configure teriminal switch(config)# interface interface modu

 * vlan 配置思路 (access 、Trunk)

(1)创建Vlan

在基于IOS的交换机配置静态VLAN:

switch# vlan database

switch(vlan)# vlan vlan-num name vlan-name

switch(vlan)# exit

switch# configure teriminal

switch(config)# interface interface module/number

switch(config-if)# switchport mode access // 设置端口模式为access模式

switch(config-if)# switchport access vlan vlan-num // 设置端口所属的VLAN

switch(config-if)# end

核验配置:show vlan

(2)配置干道链路

干道是在两台catalyst交换机端口或catalyst交换机与路由器间的一条点对点链路。 干道链路可以承载多个vlan。

在基于IOS的交换机配置干道链路

switch(config)# interface interface mod/port

switch(config-if)# switchport mode trunk // 设置端口模式为trunk模式

switch(config-if)# switchport trunk encapsulation {isl dotlq} // 设置trunk所封装的帧

switch(config-if)# switchport trunk allowed vlan remove vlan-list // 允许那些VLAN通过干路

( 附:switchport trunk allowed vlan {add   all   except   remove} vlan-list )

* no switchport

no switchport // 把物理端口变成三层口,即把三层口当成路由器上的口,当将一个端口配置成三层端口之后,就可以在此端口上分配IP地址了,当然还是可以连接PC机的,。 路由口:路由口是指某一物理端口在端口配置状态下用no switchport命令生成的端口,所有的三层都需要IP地址以实现路由交换。

配置举例如下:

Switch# configure terminal

Switch(config)# interface gigabitethernet0/2

Switch(config-if)# no switchport

Switch(config-if)# ip address 192.20.135.21 255.255.255.0

Switch(config-if)# no shutdown

Switch(config-if)# end

附:show interfaces [interface-id] switchport // 显示二层端口的状态,可以用来决定此口是否为二层或三层口。 Eg:Switch# show interfaces fastethernet 0/1 switchport

* 三层交换机上VLAN的设置

(1)方法一:一般常规配置

Switch# configure terminal

Switch(config)# vlan 20

Switch(config-vlan)# name test20

Switch(config-vlan)#ip address 1.1.1.1 255.255.255.0

Switch(config-vlan)# end

方法二:也可以在enable状态下,进行VLAN配置:

Switch# vlan database // 进入VLAN配置状态

Switch(vlan)# vlan 20 name test20 // 加入VLAN号及VLAN名

Switch(vlan)# exit 更新VLAN数据库并退出

(2)将端口分配给某个VLAN

Switch# configure terminal

Switch(config)# interface fastethernet0/1

Switch(config-if)# switchport mode access // 定义二层口的工作模式为接入模式

Switch(config-if)# switchport access vlan 2 // 把端口分配给某一VLAN

Switch(config-if)# end

Switch#

 

    (3)配置VLAN Trunks

Switch# configure terminal

Switch(config)# interface fastethernet0/4

Switch(config-if)# switchport mode trunk

Switch(config-if)# switchport trunk encapsulation dot1q

Switch(config-if)# end

附:switchport trunk encapsulation {isl   dot1q   negotiate} // 配置trunk封装ISL 或 802.1Q 或自动协商

switchport mode {dynamic {auto   desirable}   trunk} (一般不用它),配置二层trunk模式。(dynamic auto—自动协商是否成为trunk;dynamic desirable—把端口设置为trunk如果对方端口是trunk, desirable, 或自动模式;trunk—设置端口为强制的trunk方式,而不理会对方端口是否为trunk)

(4)定义trunk允许的VLAN

Switch(config)# interface fastethernet0/1

Switch(config-if)# switchport trunk allowed vlan remove 2 // 配置trunk允许的VLAN

Switch(config-if)# end

附:switchport trunk allowed vlan {add   all   except   remove} vlan-list

(5)配置Native VLAN(802.1q)

switch(config-if)# switchport trunk native vlan-num // 封装802.1q的trunk端口可以接受带有标签和不带标签的数据流,交换机向native vlan传送不带标签的数据流,缺省情况下native VLAN是VLAN 1

使用no switchport trunk native vlan 端口配置命令回到缺省的状态

(6)配置一组端口

4006# configure terminal

4006(config)# interface range fastethernet2/1 – 5

4006(config-if-range)# no shutdown

// 注意:端口号之间需要加入空格,如:interface range fastethernet 2/1 – 5 是有效的,而interface range fastethernet 2/1-5 是无效的.

以下的例子显示使用逗号来配置不同类型端口的组:

4006# configure terminal

4006(config)# interface range fastethernet2/1 – 3, gigabitethernet3/1 - 2

4006(config-if-range)# no shutdown

(7)其它常用命令

duplex {auto   full   half} // 设置全双工或半双工.

speed {10   100   1000   auto   nonegotiate} 设置端口速率 // 注:1000 只工作在千兆口. GBIC模块只工作在1000 Mbps下. nonegotiate 只能在这些GBIC上用 1000BASE-SX, -LX, and -ZX GBIC.

copy running-config startup-config // 保存设置

(8)配置EtherChannel

以太通道捆绑几个以太端口为一个独立的逻辑链路。如4006交换机,你可以捆绑在4006任何模块上最多8个兼容的具有相同速率的端口。每个以太通道 具有一个port-channel端口号。要捆绑一个以太通道时,会产生一个逻辑port-channel端口,逻辑端口下的配置可影响与之捆绑的物理端 口,但物理端口下的配置不能影响逻辑端口的配置

1) 三层以太通道(逻辑port-channe)的配置

Switch# configure terminal

Switch(config)# interface port-channel 1 // 创建一个逻辑端口

Switch(config-if)# ip address 172.32.52.10 255.255.255.0

Switch(config-if)# end

2) 三层物理端口配置

Switch# configure terminal

Switch(config)# interface range fastethernet 5/4 – 5 (注意: 空格是必需的)

Switch(config-if)# no switchport // 改变该端口为三层接口

Switch(config-if)# no ip address // 确认接口没有配置IP地址

Switch(config-if)# channel-group 1 mode desirable

Switch(config-if)# end

附: Switch(config-if)# channel-group port_channel_number mode {auto   desirable   on} // 将该物理端口加入一个以太通道中,并确定PagP模式。

3) 二层以太通道配置

Switch# configure terminal

Switch(config)# interface range fastethernet 5/6 - 7 (注意: 空格是必需的)

Switch(config-if-range)# channel-group 2 mode desirable

Switch(config-if-range)# end

Switch# show running-config interface port-channel 2

Building configuration...

Current configuration:

!

interface Port-channel2

switchport access vlan 10

switchport mode access

end

Switch#
 
  * 如何作端口聚合

如果要配置二台6509之间的Trunk联接,首先将二6509用千兆光纤相联好,然后分别配置二相联端口的trunk,可以是只用一双光纤,或用二对光纤做port channel,配置如下:

一双光纤相联时,分别在二台65上进行以下的配置

interface GigabitEthernet1/1

no ip address

switchport

switchport trunk encapsulation dot1q

switchport trunk native vlan 1

二对光纤相联时,必须要做port channel,分别在二台65上进行以下的配置

interface port-channe1

no ip address

switchport

switchport trunk encapsulation dot1q

switchport trunk native vlan 1

!

interface GigabitEthernet1/1

no ip address

duplex full

speed 1000

switchport mode trunk

switchport trunk encapsulation dot1q

switchport trunk native vlan 1

channel-group 1 mode on

!

interface GigabitEthernet1/2

no ip address

duplex full

speed 1000

switchport mode trunk

switchport trunk encapsulation dot1q

switchport trunk native vlan 1

channel-group 1 mode on

* VTP裁剪

(1)在基于IOS的交换机配置VTP 模式:

switch# vlan database

switch(vlan)# vtp domain domain-name

switch(vlan)# vtp {sever cilent transparent}

switch(vlan)# vtp password password

在基于CLI的交换机配置VTP 模式:

switch(enable) set vtp [domain domain-name] [mode{ sever cilent transparent }][password password]

(2)在基于IOS的交换机配置VTP版本:

switch# vlan database

switch(vlan)# vtp v2-mode

在基于CLI的交换机配置VTP版本:

switch(enable) set vtp v2 enable

(3)在基于IOS的交换机上启动VTP剪裁:

switch# vlan database

switch(vlan)# vtp pruning

在基于CLI 的交换机上启动VTP剪裁:

switch(enable) set vtp pruning enable
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The working principle and configuration method of GDM in Linux system The working principle and configuration method of GDM in Linux system Mar 01, 2024 pm 06:36 PM

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

Detailed explanation of Oracle error 3114: How to solve it quickly Detailed explanation of Oracle error 3114: How to solve it quickly Mar 08, 2024 pm 02:42 PM

Detailed explanation of Oracle error 3114: How to solve it quickly, specific code examples are needed. During the development and management of Oracle database, we often encounter various errors, among which error 3114 is a relatively common problem. Error 3114 usually indicates a problem with the database connection, which may be caused by network failure, database service stop, or incorrect connection string settings. This article will explain in detail the cause of error 3114 and how to quickly solve this problem, and attach the specific code

Analysis of new features of Win11: How to skip logging in to Microsoft account Analysis of new features of Win11: How to skip logging in to Microsoft account Mar 27, 2024 pm 05:24 PM

Analysis of new features of Win11: How to skip logging in to a Microsoft account. With the release of Windows 11, many users have found that it brings more convenience and new features. However, some users may not like having their system tied to a Microsoft account and wish to skip this step. This article will introduce some methods to help users skip logging in to a Microsoft account in Windows 11 and achieve a more private and autonomous experience. First, let’s understand why some users are reluctant to log in to their Microsoft account. On the one hand, some users worry that they

Analysis of the meaning and usage of midpoint in PHP Analysis of the meaning and usage of midpoint in PHP Mar 27, 2024 pm 08:57 PM

[Analysis of the meaning and usage of midpoint in PHP] In PHP, midpoint (.) is a commonly used operator used to connect two strings or properties or methods of objects. In this article, we’ll take a deep dive into the meaning and usage of midpoints in PHP, illustrating them with concrete code examples. 1. Connect string midpoint operator. The most common usage in PHP is to connect two strings. By placing . between two strings, you can splice them together to form a new string. $string1=&qu

How to configure and install FTPS in Linux system How to configure and install FTPS in Linux system Mar 20, 2024 pm 02:03 PM

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

Apache2 cannot correctly parse PHP files Apache2 cannot correctly parse PHP files Mar 08, 2024 am 11:09 AM

Due to space limitations, the following is a brief article: Apache2 is a commonly used web server software, and PHP is a widely used server-side scripting language. In the process of building a website, sometimes you encounter the problem that Apache2 cannot correctly parse the PHP file, causing the PHP code to fail to execute. This problem is usually caused by Apache2 not configuring the PHP module correctly, or the PHP module being incompatible with the version of Apache2. There are generally two ways to solve this problem, one is

Parsing Wormhole NTT: an open framework for any Token Parsing Wormhole NTT: an open framework for any Token Mar 05, 2024 pm 12:46 PM

Wormhole is a leader in blockchain interoperability, focused on creating resilient, future-proof decentralized systems that prioritize ownership, control, and permissionless innovation. The foundation of this vision is a commitment to technical expertise, ethical principles, and community alignment to redefine the interoperability landscape with simplicity, clarity, and a broad suite of multi-chain solutions. With the rise of zero-knowledge proofs, scaling solutions, and feature-rich token standards, blockchains are becoming more powerful and interoperability is becoming increasingly important. In this innovative application environment, novel governance systems and practical capabilities bring unprecedented opportunities to assets across the network. Protocol builders are now grappling with how to operate in this emerging multi-chain

See all articles