VLAN中继协议

简介: 交换机不能隔离广播域,因此有了VLAN(虚拟局域网)

交换机不能隔离广播域,因此有了VLAN(虚拟局域网)

VLAN中继协议

使用trunk 中继技术 实现不同交换机相同VLAN之间的通信

解决不同地区的相同VLAN之间的通信

网络配置:配置trunk中继链路

Switch(config)#interface f0/1

Switch(config-if)#switch mode trunk #配置该接口为中继模式

Switch(config-if)#sw trunk encapsulation dot1q #中继协议配置为802.1q

Switch(config-if)#speed 100 #接口速率配置

Switch(config-if)#duplex full   #接口配置为q

Switch(config-if)#

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

Switch(config-if)#no shut

Switch(config-if)#end

Switch#

%SYS-5-CONFIG_I: Configured from console by console

Switch#copy run star

Destination filename [startup-config]?

Building configuration...

[OK]

Switch#

思科Cisco

0. 模式

hostname>               用户模式;使用enable|en进入特权模式

hostname#               特权模式;使用config terminal|conf t进入全局配置模式

hostname(config)#       全局配置模式;使用interface f0/1|in f0/1进入接口配置模式

hostname(config-if)#    接口或者vlan多个接口配置模式;使用exit回退到上个全局配置模式,使用end回退到特权模式

hostname(vlan)#         vlan配置模式。在特权模式下使用vlan database进入VLAN配置模式

1. 基本配置命令

Switch >enable    进入特权模式

Switch #config terminal     进入全局配置模式

Switch (config)#hostname XXX   设置交换机主机名为XXX

Switch(config)#enable password      进入特权模式的密码(明文形式保存)

Switch(config)#enable secret        加密密码(加密形式保存,优先)

Switch(config)#ip default-gateway     配置交换机网关

Switch(config)#show mac-address-table   查看MAC地址

Switch(config)logging synchronous     阻止控制台信息覆盖命令行上的输入

Switch(config)no ip domain-lookup     关闭DNS查找功能

Switch(config)exec-timeout 0 0      阻止会话退出            


2. 使用Telnet远程管理

Switch (config)#line vty 0 4  进入虚拟终端

Switch (config-line)# password   设置登录口令

Switch (config-line)# login  要求口令验证


3. 控制台口令

switch(config)#line console 0  进入控制台口

switch(config-line)# password  xxx  设置登录口令

switch(config-line)# login  允许登录


4. Cisco发现协议(CDP)

Switch(config)#show cdp             显示Cisco设备全局配置信息

Switch(config)#show cdp interface 端口      查看CDP配置下端口信息

Switch(config)#show cdp neighbors        显示直连Cisco设备信息

Switch(config)#show cdp neighbors detail      查看邻居详细信息



5. 恢复出厂配置

Switch(config)#erase startup-config

Switch(config)delete vlan.dat


6. 配置接口标识, 用于区分交换机,路由器的各个接口

switch(config)#interface fastethernet 0/1    以0/1 接口为例

switch(config)# description toMill2      端口描述为“到二厂”



7. Vtp配置

switch(config)#vtp domain    设置vtp域名

switch(config)#vtp password    设置vtp密码

switch(config)#vtp mode server /client/transparent 设置vtp服务器模式

switch(config)#vtp version     设置vtp版本

switch(config)#vtp pruning     启用vtp修剪

注:要想从vtp中减少一台交换机,只需将该交换机vtp 域名更改即可。


8. Vlan基本配置

Switch#vlan database             进入vlan配置模式

Switch(vlan)#vlan 号码 name 名称       创建vlan及vlan名(name可以不写,系统有默认值)

Switch(vlan)#vlan号码 mtu数值        修改MTU大小

switch(vlan)#apply

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

Switch#show vlan               查看验证

Switch#copy running-config startup-config    保存配置


9. VLAN 中添加 删除端口

Switch#config terminal            进入全局配置

Switch(config)#interface fastethernet0/1     进入要分配的端口

Switch(config-if)#Switchport mode access    定义access端口,也就是二层端口

Switch(config-if)#Switchport acces vlan 号    把端口分给一个vlan

Switch(config-if)#switchport mode trunk     设置端口为trunk口(干线)

Switch(config-if)#switchport trunk encapsulation dot1q  设置vlan 中继协议(cisco 2960系列默认使用802.1q协议封装)

Switch(config-if)#no switchport mode 或 ( switchport mode access)  禁用干线

Switch(config-if)#switchport trunk allowed vlan add 1,2    从Trunk中添加vlan

Switch(config-if)#switchport trunk allowed vlan remove 1,2   从Trunk中删除vlan

Switch(config-if)#switchport trunk pruning vlan remove 1,2 ; 从Trunk中关闭局部修剪

Switch#show vlan brief       查看所有vlan信息

Switch#show vlan id         查看某个vlan的信息


Switch#config terminal

Switch(config)#interface range fastEthernet 0/1-3 批量配置交换机的端口

Switch(config-if-range)#switchport mode access

Switch(config-if-range)#switchport access vlan 2

Switch(config-if-range)#end

Switch#


10. 查看trunk协议

Switch#show int trunk         查看trunk端口


 Trunk

开启(no)     ——将端口设置为永久中继模式

关闭(off)     ——将端口设置为永久非中继模式, 并且将链路转变为非中继链路

企望(desirable)——让端口主动试图将链路转换成中继链路

自动(auto)    ——使该端口愿意将链路变成中继链路


注:可以使用default interface interface-id 还原接口到默认配置状态


配置接口为动态协商模式:

Switch(config)#interface 接口号

Switch(config)#switchport mode dynamic desirable/auto



11. 以太网通道配置

switch(config)#interface range fasternet0/1 - 2  将fasternet0/1和0/2 口捆绑

switch(config-if)#channel-group 1 mode on  配置以太通道模式

switch(config-if)#port-channel load-balance {dst-mac | src-mac}在链路间实现负载均衡

switch#show etherchannel 1 summary  查看通道信息

switch#show etherchannel load-balance  查看通道信息


12. 交换机显示命令

switch#show vtp status  查看vtp配置信息

switch#show running-config  查看当前配置信息

switch#show vlan  查看vlan配置信息

switch#show interface  查看端口信息

switch#show int f0/0  查看指定端口信息

switch#dir flash:  查看闪存

switch#show version  查看当前版本信息

switch#show cdp  cisco设备发现协议

switch#show cdp traffic  杳看接收和发送的cdp包统计信息

switch#show cdp neighbors  查看与该设备相邻的cisco设备

switch#show interface f0/1 switchport      查看有关switchport的配置

switch#show cdp neighbors           查看与该设备相邻的cisco设备

 


13. 生成树协议spanning-tree protocol

Switch(config-if)#spanning-tree portfast  配置速端口(连接终端设备的端口状态)如pc机

Switch#show spanning-tree summary  检测vlan生成树配置

Switch#show spanning-tree vlan <vlan-id> detail  浏览详细生成树配置信息

Switch#show spanning-tree interface <int-id> detail  浏览详细生成树端口配置信息


目录
相关文章
|
11月前
|
负载均衡 网络协议 网络虚拟化
【网络】· VTP虚拟局域网中继
【网络】· VTP虚拟局域网中继
|
12月前
|
网络虚拟化 iOS开发
VLAN中继协议(VTP)(知识点总结)
VLAN中继协议(VTP)(知识点总结)
225 0
|
网络协议 网络架构
什么是DHCP(中继模式)
什么是DHCP(中继模式)
226 0
什么是DHCP(中继模式)
|
数据库 数据安全/隐私保护 网络虚拟化
|
网络虚拟化 数据安全/隐私保护
|
数据库 网络虚拟化
|
网络虚拟化 数据安全/隐私保护
|
Linux 网络安全 Windows