
配置如下:
C3550配置:
3550b#vlan database
3550b(vlan)#vtp
client Set the device to client mode
domain Set the name of the VTP administrative domain
password Set the password for the VTP administrative domain
pruning Set the administrative domain to permit pruning
server Set the device to server mode
transparent Set the device to transparent mode
v2-mode Set the administrative domain to V2 mode
3550b(vlan)#vtp server //将C3550设为VTP服务器,由它控制VLAN信息
Setting device to VTP SERVER
3550b(vlan)#vtp domain ccnp //VTP域名,和C2960一致
Change vtp domain name to ccnp
3550b(vlan)#exit
APPLY completed
Exiting
3550b#show vtp status //查询VTP状态
。。。
3550b#config t
3550b(config)#int g0/1
3550b(config-if)#switchport mode trunk //将3550和2960连接的端口设置为trunk模式
C2960配置:
2960#vlan database
2960(vlan)#vtp client //将C3550设为VTP服务器,由它控制VLAN信息
Setting device to VTP client
2960(vlan)#vtp domain ccnp //VTP域名,和C3550一致
Change vtp domain name to ccnp
2960(vlan)#exit
APPLY completed
Exiting
2960#show vtp status //查询VTP状态
。。。
2960#config t
2960(config)#int g0/1 //假设2960端口g0/1与3550相连
2960(config-if)#switchport mode trunk //将3550和2960连接的端口设置为trunk模式
2960(config-if)#exit
2960(config)#exit
2960#show vlan //查看3550的vlan信息是否传递到2960
将2960上的相应端口划入相应VLAN
以上 供参考,有问题M我。分类: 电脑/网络 >> *** 作系统/系统故障
解析:
如何在1个交换性的网络里,分割广播域呢答案是创建VLANVLAN是连接到定义好了的switch的端口的网络用户和资源的逻辑分组给不同的子网分配不同的端口,就可以创建更小的广播域默认情况下,在某个VLAN中的主机是不可以与其他VLAN通信的,除非你使用router来创建VLAN间的通信
VLAN的一些特点:
1网络的增加,移动和改变,只需要在适当的VLAN中配置合适的端口
2安全,因为不同VLAN的用户不能互相通信,除非依靠router来做VLAN间的通信
3因为VLAN可以被认为是按功能划分的逻辑分组,所以VLAN和物理位置,地理位置无关
4VLAN增加安全性
5VLAN增加广播域的数量,而减小广播域的大小
Broadcast Control
每种协议都会有广播的现象发生,至于发生不频率,次数,一般由以下几点决定:
1协议类型
2在网络上运行的应用程序
3这些服务如何的被使用
Security
安全性是VLAN的1大特点,不同VLAN的用户不能互相通信,除非依靠router来做VLAN间的通信
Flexibility and Scalability
VLAN的灵活性和可扩展性:
1可以不管物理位置如何,把适当的端口分配到适当的 VLAN中就可以了可以把VLAN理解正下面的样字,如图:
2当VLAN增加的太大以后,你可以划分更多的VLAN,来减少广播消耗掉更多带宽的影响,在VLAN中的用户越少,被广播影响的就越少
来比较下下面2个图,明显可以发现,图2,即VLAN的具有更高的灵活性和可扩展性,如下:
VLAN Memberships
手动由管理员分配端口划分的VLAN叫静态VLAN(static VLAN);使用智能管理软件,动态划分VLAN的叫动态VLAN(dynamic VLAN)
Static VLANs
静态VLAN:静态VLAN安全性较高,手动划分端口给VLAN,和设备的物理位置没什么关系而且,每个VLAN中的主机必须拥有正确的IP地址信息,如VLAN2配置为17216200/24
Dynamic VLANs
动态VLAN:使用智能管理软件,可以基于MAC地址,协议,甚至应用程序来动态创建VLANCisco设备管理员可以使用VLAN管理策略服务器(VLAN Management Policy Server,VMPS)的服务来建立个MAC地址数据库,来根据这个动态创建VLAN,VMPS数据库把MAC地址映射VLAN上
Identifying VLANs
当帧在网络中被交换,switches根据类型对其跟踪,加上根据硬件地址来判断如何对它们进行 *** 作有1点要记住的是:在不同类型的连接中,帧被处理的方式也不一样
交换环境中的2种连接类型:
1access links:指的是只属于一个VLAN,且仅向该VLAN转发数据帧的端口,也叫做native VLANswitches把帧发送到access-link设备之前,移去任何的VLAN信息而且access-link设备不能与VLAN外通信,除非数据包被路由
2trunk links:指的是能够转发多个不同VLAN的通信的端口trunk link必须使用100Mbps以上的端口来进行点对点连接,1次最多可以携带1005个VLAN信息trunk link使你的单独的1个端口同时成为数个VLAN的端口,这样可以不需要层3设备当你在switches之间使用了trunk link,多个VLAN的信息将从这个连接上通过;如果在你switches之间没有使用trunk link而使用一般的连接,那么只有VLAN1的信息通过这个连接被互相传递VLAN1默认作为管理VLAN
Frame Tagging
frame tagging:帧的鉴别方法当帧到达每个switch,首先先检查VLAN ID,然后决定如何对帧进行处理当帧到达和VLAN ID所匹配的access link的时候,switch移去VLAN标识符
VLAN Identification Method
VLAN标识符:在交换机的trunk link上,可以通过对数据帧附加VLAN信息,构建跨越多台交换机的VLAN附加VLAN信息的方法,最具有代表性的有:
1Inter-Switch Link(ISL):属于Cisco私有,只能在快速和千兆以太网连接中使用,ISL路由可以使用在switch的断端口,router的接口和服务器接口卡等
2IEEE 8021Q:俗称dot 1 Q由IEEE创建,所以在Cisco和非Cisco设备之间,就不能使用ISL必须使用8021Q8021Q所附加的VLAN识别信息,位于数据帧中的源MAC地址与类型字段之间基于IEEE8021Q附加的VLAN信息,就像在传递物品时附加的标签
当然ISL和8021Q的主要目的是提供VLAN间通信
Inter-Switch Link(ISL) Protocol
ISL:ISL运作在层2,ISL是1种外部标签处理过程,所以原始的数据帧不被改变,ISL在数据帧头部加上26字节长的ISL头部信息,在数据帧尾部加上4字节的FCS字段进行CRC运算,所以只有支持ISL的设备才能对它进行读取,最大程度1522字节当帧被传送到access link时,ISL封装信息将被移去
使用trunk link在多个VLAN中行走,比使用router连接的好处是:减少延时间
VLAN Trunking Protocol(VTP)
VTP也是Cisco创建的,但是现在已经不为Cisco所私有VTP的主要目的是在1个交换性的环境中管理所有配置好的VLAN使所有的VLAN保持一致性VTP允许增加,删除和重命名VLAN,然后这些修改后的信息传播到整个VTP域里的所有switches上
VTP的一些优点:
1保持VLAN信息的连续性
2精确跟踪和监视VLAN
3动态报告增加了的VLAN信息给VTP域中所有switch
4可以使用即插即用(plug-and-play)的方法增加VLAN
5可以在混合型网络中进行trunk link,比如以太网到ATM LANE,FDDI等
在你使用VTP管理VLAN之前,必须先创建个VTP服务器(VTP server),所有要共享VLAN信息的服务器必须使用相同的域名而且,假如你把某个switch和其他的switch配置在1个VTP域里,这个switch就只能和这个VTP域里的switch共享VLAN信息其实,如果你只有1个VLAN,就不需要使用VTP了VTP信息通过trunk端口进行发送和接收可以给VTP配置密码,但是要记住的是,所有的switch必须配置相同的密码
switch通告VTP管理域信息,加上版本号和已知VLAN配置参数信息还有种叫做透明VTP模式(transparent VTP mode),在这种模式里,你可以给switch配置成通过trunk端口转发VTP信息,但是不接受VTP更新信息来更新它自己的VTP数据库
switch通过VTP通告检测到增加的VLAN,然后把新增加的VLAN和已有的联结在一起共享信息新的更新信息在之前的版本号上加1
VTP Modes of Operation
在VTP域里 *** 作的3种模式:
1服务器模式(server mode):所有Catalyst switches的默认设置,1个VTP域里必须至少要有1个服务器用来传播VLAN信息,对VTP信息的改变必须在服务器模式下 *** 作配置保存在NVRAM里
2客户机模式(client mode):在这种模式下,switches从VTP服务器接受信息,而且它们也发送和接收更新,但是它们不能做任何改变在VTP服务器通知客户switches说增加了新的VLAN之前,你不能在客户switch的端口上增加新的VLAN配置不保存在NVRAM里
3透明模式(transparent mode):该模式下的switch不能增加和删除VLAN,因为它们保持的有自己的数据库,不和其他的共享配置保存在NVRAM里
VTP Pruning
VTP pruning:减少广播,组播,单播,保留带宽VTP pruning只在trunk link上发送广播默认情况,VTP pruning在所有的switches上是没有启用的当你在VTP服务器上启用了VTP pruning,整个VTP域就启用了VTP pruning,默认只能在VLAN2到VLAN1005,VLAN1是管理VLAN
Routing beeen VLANs
可以使用支持ISL路由的router来连接VLAN,支持ISL路由的最低型号是2600系列,1600,1700和2500系列都不支持如下图,就是router和每个VLAN之间的关联,每个router的接口都插入1个access link,这个同时也说明了router的每个接口的IP地址都是每个VLAN的默认网关:
假如你有太多的VLAN,数量超过了router接口数量,明显上面的方法就不适用了你可以使用Cisco的3层switch Cisco3550,或者使用router的快速以太网接口来做ISL或者8021Q的 trunk link,这样的方法叫做单臂路由(router on a stick)如下图:
Configuring VLANs
创建VLAN:
1900下,使用vlan [vlan#] name [name] [vlan#]命令, 如下:
>en
#config t
(config)#hostname 1900
1900(config)#vlan 2 name sales
1900(config)#vlan 3 name marketing
1900(config)#vlan 4 name mis
1900(config)#exit
验证,使用show vlan命令,记住在你没给VLAN分配端口之前,之前做的VLAN是不会起作用的而且所有的端口默认是处在VLAN1的,VLAN1是管理VLAN如下:
1900#sh vlan
VLAN Name Status Ports
----------------------------------------------------------------------------
1 default Enable 1-12, AUI, A, B
2 sales Enable
3 marketing Enable
(略)
在2950下创建VLAN,在特权模式下使用vlan database命令,创建命令和1900下的类似,注意结尾使用apply命令如下:
2950#vlan database
2950(vlan)#vlan 2 name Marketing
VLAN 2 modified:
Name: Marketing
2950(vlan)#vlan 3 name Accounting
VLAN 3 added:
Name: Accounting
2950(vlan)#apply
APPLY plete
2950(vlan)#Ctrl+C
2950#
使用show vlan或者show vlan brief命令验证下:
2950#sh vlan brief
VLAN Name Status Ports
----------------------------------------------------------------------------
1 default active Fa0/1Fa0/12
2 Marketing active
3 Accounting active
(略)
Assigning Switch Ports to VLANs
创建了VLAN,接下来要做的就是给VLAN分配端口1900下,使用vlan-membership命令1次只能分配1个,可以static或dynamic作为参数,如下:
1900(config)#int e0/2
1900(config-if)#vlan-membership static 2
1900(config)#int e0/4
1900(config-if)#vlan-membership static 3
1900(config)#int e0/5
1900(config-if)#vlan-membership static 4
1900(config-if)#exit
1900(config)#exit
1900#
验证,如下:
1900#sh vlan
VLAN Name Status Ports
----------------------------------------------------------------------------
1 default Enable 1-12, AUI, A, B
2 sales Enable 2
3 marketing Enable 4
(略)
2950下的配置,使用switchport access vlan [vlan#]命令,如下:
2950(config-if)#int f0/2
2950(config-if)#switchport access vlan 2
2950(config-if)#int f0/3
2950(config-if)#switchport access vlan 3
2950(config-if)#int f0/4
2950(config-if)#switchport access vlan 4
2950(config-if)#exit
2950(config)#exit
2950#
验证配置信息,如下:
2950#sh vlan brief
VLAN Name Status Ports
----------------------------------------------------------------------------
1 default active Fa0/1 Fa0/5Fa0/12
2 Marketing active Fa0/2
3 Accounting active Fa0/3
(略)
Configuring Trunk Ports
1900只使用动态ISL(DISL)封装方式,在快速以太网配置trunk,在接口配置模式下使用trunk [参数]的命令,如下,将26接口设置为trunk端口:
1900(config)#int f0/26
1900(config-if)#trunk
auto Set DISL state to AUTO
desirable Set DISL state to DESIRABLE
nonegotiate Set DISL state to NONEGOTIATE
off Set DISL state to OFF
on Set DISL state to ON
1900(config-if)#trunk on
设置参数为on即接口将作为永久ISL的trunk端口,可以和和相连的设备协商,并且把连接转换成trunk link
2950下在接口配置模式,使用switchport命令,如下:
2950(config)#int f0/12
2950(config-if)#switchport mode trunk
2950(config-if)#^Z
2950#
验证配置信息:
2950#sh run
(略)
!
interface FastEther0/12
switchport mode trunk
no ip address
!
(略)
Configuring Inter-VLAN Routing
使VLAN间互相通信,就必须使用router或者3层switch来连接要在router的快速以太网接口支持ISL和8021Q,要把接口划分成许多逻辑接口(非物理),1个接口对应1个VLAN这些接口就叫子接口(subinterfaces)还有要必须知道的是,默认你不可能在1900和2950之间做trunk连接,因为1900只支持ISL路由而2950只支持8021Q路由,2种相互不兼容
给连接1900的trunk端口配置,使用encapsulation isl [vlan#]命令,如下:
2600Router(config)#int f0/01
2600Router(config-subif)#encapsulation isl [vlan#]
给连接2950的这样配置,如下:
2600Router(config)#int f0/01
2600Router(config-subif)#encapsulation dot1q [vlan#]
Configuring VTP
默认下,1900和2950都被配置成VTP服务器模式,配置VTP,先配置VTP域名,还有密码,是否pruning等
1900下,在全局配置模式下使用vtp命令,如下:
1900(config)#vtp
client VTP client
domain Set VTP domain name
password Set VTP password
pruning VTP pruning
server VTP server
transparent VTP transparent
trap VTP trap
1900(config)#vtp server
1900(config)#vtp domain noco
1900(config)#vtp password noko
在特权模式下使用show vtp命令验证,如下:
1900#sh vtp
VTP version: 1
Configuration revision: 0
Maximum VLANs supported locally: 1005
Number of existing VLANs: 5
VTP domain name: noco
VTP password: noko
VTP operating mode: Server
(略)
2950如下:
2950(config)#vtp mode server
2950(config)#vtp domain noco
验证信息,如下:
2950#sh vtp
counters VTP statistics
status VTP domain status
2950#sh vtp status
(略)
Configuring Switching in Our Sample Interneork
配置实例:
先配置2950C,如下
2950C(config)#enable secret noko
2950C(config)#line con 0
2950C(config-line)#login
2950C(config-line)#password noco
2950C(config-line)#line vty 0 15
2950C(config-line)#login
2950C(config-line)#password noco
2950C(config-line)#banner motd #
2950C
#
2950C(config-line)#exit
2950C(config)#int vlan1
2950C(config-if)#ip address 17216102 2552552550
2950C(config-if)#no shut
2950C(config-if)#exit
2950C(config)#up default-gateway 17216101
2950C(config)#^Z
2950C#copy run start
配置2950B,如下:
2950B(config)#enable secret noko
2950B(config)#line con 0
2950B(config-line)#login
2950B(config-line)#password noco
2950B(config-line)#line vty 0 15
2950B(config-line)#login
2950B(config-line)#password noco
2950B(config-line)#banner motd #
2950B
#
2950B(config-line)#exit
2950B(config)#int vlan1
2950B(config-if)#ip address 17216103 2552552550
2950B(config-if)#no shut
2950B(config-if)#exit
2950B(config)#up default-gateway 17216101
2950B(config)#^Z
2950B#copy run start
配置trunk,2950B如下:
2950B(config)#int f0/1
2950B(config-if)#switchport mode trunk
2950B(config-if)#int f0/4
2950B(config-if)#switchport mode trunk
2950B(config-if)#int f0/5
2950B(confgi-if)#switchport mode trunk
配置trunk,2950C如下:
2950C(config)#int f0/4
2950C(confgi-if)#switchport mode trunk
2950C(config-if)#int f0/5
2950C(config-if)#switchport mode trunk
验证trunk信息,使用show interface trunk命令如下:
2950B#sh int trunk
Port Mode Encapsulation Status Native vlan
Fa0/1 on 8021q trunking 1
Fa0/4 on 8021q trunking 1
Fa0/5 on 8021q trunking 1
(略)
之前我们已经对2950B和2950C做了基本配置和trunk端口的配置,接下来应该设置VTP和创建VLAN,并且进行验证2950C如下:
2950C(config)#vtp mode server
2950C(config)#vtp domain Cisco
2950C(config)#^Z
2950C#vlan database
2950C(vlan)#vlan 2 name sales
2950C(vlan)#vlan 3 name marketing
2950C(vlan)#apply
2950C(vlan)#^C
2950C#sh vlan brief
(略)
接下来分配端口,把Fa0/2分配给VLAN2,Fa0/3分配给VLAN3,默认所有的端口都处在VLAN1下,配置如下:
2950C(config)#int fa0/2
2950C(config-if)#switchport access vlan2
2950C(config)#int fa0/3
2950C(config-if)#switchport access vlan3
验证信息,注意VLAN1里的Ports栏,如下:
2950C#sh vlan brief
VLAN Name Status Ports
----------------------------------------------------------------------------
1 default active Fa0/1 Fa0/5Fa0/10
2 sales active Fa0/2
3 marketing active Fa0/3
配置2950B,把它设置成客户模式,2950B从2950C接收VLAN信息,如下:
2950B(config)#vtp mode client
2950B(config)#vtp domain Cisco
2950B(config)#^Z
验证,注意2950B已经从2950C知道了VLAN的信息,如下:
2950B#sh vlan brief
VLAN Name Status Ports
----------------------------------------------------------------------------
1 default active Fa0/1Fa0/12
2 sales active
3 marketing active
但是仍然要给2950B分配端口,如下:
2950B(config)#int fa0/2
2950B(config-if)#switchport access vlan2
2950B(config)#int fa0/3
2950B(config-if)#switchport access vlan3
验证信息,如下:
VLAN Name Status Ports
----------------------------------------------------------------------------
1 default active Fa0/1 Fa0/5Fa0/12
2 sales active Fa0/2
3 marketing active Fa0/3
到现在,2950C和2950B的配置就算是完成了,经过验证,我们也没发现什么问题,接下来该配置什么呢当然是配置VLAN间的通信,根据上面的拓扑图,可以知道需要在RouterB上进行配置,如下:
RouterB(config)#hostname Trunkrouter
Trunkrouter(config)#int f0/0
Trunkrouter(config-if)#no ip address
Trunkrouter(config-if)#no shut
创建子接口,并定义封装类型,如下:
Trunkrouter(config-if)#int f0/01
Trunkrouter(config-subif)#encapsulation dot1q 1
Trunkrouter(config-subif)#ip address 17216101 2552552550
Trunkrouter(config-if)#int f0/02
Trunkrouter(config-subif)#encapsulation dot1q 2
Trunkrouter(config-subif)#ip address 17216201 2552552550
Trunkrouter(config-if)#int f0/03
Trunkrouter(config-subif)#encapsulation dot1q 3
Trunkrouter(config-subif)#ip address 17216301 2552552550
Trunkrouter(config-if)#exit
创建子接口,每个接口对应1个VLAN注意,如果你试图在第一个子接口分配IP地址,将收到错误信息,除非你先定义了封装类型,如下:
Trunkrouter(config-if)#int f0/01
Trunkrouter(config-subif)#ip address 17216101 2552552550
Configuring IP routing on a LAN subinterface is only allowed if that subinterface is already configured as part of an IEEE 80210, IEEE 8021Q, or ISL VLAN
验证配置信息,如下:
Trunkrouter#sh run
(略)应该先在命令行中开启日志!
set logging server enable
set logging server 19216823
后面的地址就是你的服务器也就是PC的地址。
你在网络上查下具体的配置。
反正要设置一大堆的参数。
CISCO交换机基本配置:Console端口连接
用户模式hostname# ;
特权模式hostname(config)# ;
全局配置模式hostname(config-if)# ;
交换机口令设置:
switch>enable ;进入特权模式
switch#config terminal ;进入全局配置模式
switch(config)#hostname csico ;设置交换机的主机名
switch(config)#enable secret csico1 ;设置特权加密口令
switch(config)#enable password csico8 ;设置特权非密口令
switch(config)#line console 0 ;进入控制台口
switch(config-line)#line vty 0 4 ;进入虚拟终端
switch(config-line)#login ;虚拟终端允许登录
switch(config-line)#password csico6 ;设置虚拟终端登录口令csico6
switch#exit ;返回命令
交换机VLAN创建,删除,端口属性的设置,配置trunk端口,将某端口加入vlan中,配置VTP:
switch#vlan database ;进入VLAN设置
switch(vlan)#vlan 2 ;建VLAN 2
switch(vlan)#vlan 3 name vlan3 ;建VLAN 3并命名为vlan3
switch(vlan)#no vlan 2 ;删vlan 2
switch(config)#int f0/1 ;进入端口1
switch(config)#speed 查看speed命令的子命令
switch(config)#speed 100 设置该端口速率为100mb/s (10/auto)
switch(config)#duplex 查看duplex的子命令
switch(config)#duplex full 设置该端口为全双工(auto/half)
switch(config)#description TO_PC1 这是该端口描述为TO_PC1
switch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2
switch(config-if)#switchport mode trunk ;设置为trunk模式(access模式)
switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan
switch(config-if)#switchport trunk encap dot1q ;设置vlan 中继
switch(config)#vtp domain vtpserver ;设置vtp域名相同
switch(config)#vtp password ;设置发vtp密码
switch(config)#vtp server ;设置vtp服务器模式
switch(config)#vtp client ;设置vtp客户机模式
交换机设置IP地址,默认网关,域名,域名服务器,配置和查看MAC地址表:
switch(config)#interface vlan 1 ;进入vlan 1
switch(config-if)#ip address 19216811 2552552550 ;设置IP地址
switch(config)#ip default-gateway 19216816 ;设置默认网关
switch(config)#ip domain-name ciscocom 设置域名
switch(config)#ip name-server 192168118 设置域名服务器
switch(config)#mac-address-table 查看mac-address-table的子命令
switch(config)#mac-address-table aging-time 100 设置超时时间为100ms
switch(config)#mac-address-table permanent 00000c01bbcc f0/3 加入永久地址在f0/3端口
switch(config)#mac-address-table restricted static 00000c02bbcc f0/6 f0/7 加入静态地址目标端口f0/6源端口f0/7
switch(config)#end
switch#show mac-address-table 查看整个MAC地址表
switch#clear mac-address-table restricted static 清除限制性静态地址
交换机显示命令:
switch#write ;保存配置信息
switch#show vtp ;查看vtp配置信息
switch#show run ;查看当前配置信息
switch#show vlan ;查看vlan配置信息
switch#show interface ;查看端口信息
switch#show int f0/0 ;查看指定端口信息
switch#show int f0/0 status;查看指定端口状态
switch#dir flash: ;查看闪存
>思科交换机的基本配置命令学习
一、交换机口令设置:
switch>enable ;进入特权模式
switch#config terminal ;进入全局配置模式
switch(config)#hostname csico ;设置交换机的主机名
switch(config)#enable secret
csico1 ;设置特权加密口令
switch(config)#enable password csico8 ;设置特权非密口令
switch(config)#line console 0 ;进入控制台口
switch(config-line)#line vty 0 4
;进入虚拟终端
switch(config-line)#login ;虚拟终端允许登录
switch(config-line)#password
csico6 ;设置虚拟终端登录口令csico6
switch#exit ;返回命令
二、交换机显示命令:
switch#write ;保存配置信息
switch#show vtp ;查看vtp配置信息
switch#show run ;查看当前配置信息
switch#show
vlan ;查看vlan配置信息
switch#show interface ;查看端口信息
switch#show int f0/0
;查看指定端口信息
switch#show int f0/0 status;查看指定端口状态
switch#dir flash: ;查看闪存
Cisco路由器配置命令大全网络 2010-06-26 06:43:44 阅读657 评论0 字号:大中小 订阅
(1)模式转换命令
用户模式----特权模式,使用命令"enable"
特权模式----全局配置模式,使用命令"config
t"
全局配置模式----接口模式,使用命令"interface+接口类型+接口号"
全局配置模式----线控模式,使用命令"line+接口类型+接口号"
注:
用户模式:查看初始化的信息
特权模式:查看所有信息、调试、保存配置信息
全局模式:配置所有信息、针对整个路由器或交换机的所有接口
接口模式:针对某一个接口的配置
线控模式:对路由器进行控制的接口配置
(2)配置命令
show running config 显示所有的配置
show
versin 显示版本号和寄存器值
shut down 关闭接口
no shutdown 打开接口
ip add +ip地址
配置IP地址
secondary+IP地址 为接口配置第二个IP地址
show interface+接口类型+接口号 查看接口管理性
show controllers interface 查看接口是否有DCE电缆
show history 查看历史记录
show
terminal 查看终端记录大小
hostname+主机名 配置路由器或交换机的标识
config memory
修改保存在NVRAM中的启动配置
exec timeout 0 0 设置控制台会话超时为0
service password-encryptin
手工加密所有密码
enable password +密码 配置明文密码
ena sec +密码 配置密文密码
line vty 0
4/15 进入telnet接口
password +密码 配置telnet密码
line aux 0 进入AUX接口
password
+密码 配置密码
line con 0 进入CON接口
password +密码 配置密码
bandwidth+数字 配置带宽
no ip address 删除已配置的IP地址
show startup config 查看NVRAM中的配置信息
copy
run-config atartup config 保存信息到NVRAM
write 保存信息到NVRAM
erase
startup-config 清除NVRAM中的配置信息
show ip interface brief 查看接口的谪要信息
banner
motd # +信息 + # 配置路由器或交换机的描素信息
description+信息 配置接口听描素信息
vlan database
进入VLAN数据库模式
vlan +vlan号+ 名称 创建VLAN
switchport access vlan +vlan号
为VLAN为配接口
interface vlan +vlan号 进入VLAN接口模式
ip add +ip地址 为VLAN配置管理IP地址
vtp+service/tracsparent/client 配置SW的VTP工作模式
vtp +domain+域名 配置SW的VTP域名
vtp +password +密码 配置SW的密码
switchport mode trunk 启用中继
no vlan +vlan号
删除VLAN
show spamming-tree vlan +vlan号 查看VLA怕生成树议
三 路由器配置命令
ip
route+非直连网段+子网掩码+下一跳地址 配置静态/默认路由
show ip route 查看路由表
show protocols
显示出所有的被动路由协议和接口上哪些协议被设置
show ip protocols 显示了被配置在路由器上的路由选择协议,同时给出了在路由选择协议中使用
的定时器
等信息
router rip 激活RIP协议
network +直连网段 发布直连网段
interface lookback 0 激活逻辑接口
passive-interface +接口类型+接口号 配置接口为被动模式
debug ip +协议 动态查看路由更新信息
undebug all 关闭所有DEBUG信息
router eigrp +as号
激活EIGRP路由协议
network +网段+子网掩码 发布直连网段
show ip eigrp neighbors 查看邻居表
show ip eigrp topology 查看拓扑表
show ip eigrp traffic 查看发送包数量
router
ospf +process-ID 激活OSPF协议
network+直连网段+area+区域号 发布直连网段
show ip ospf
显示OSPF的进程号和ROUTER-ID
encapsulation+封装格式 更改封装格式
no ip admain-lookup
关闭路由器的域名查找
ip routing 在三层交换机上启用路由功能
show user 查看SW的在线用户
clear line
+线路号 清除线路
四 三层交换机配置命令
配置一组二层端口
configure terminal 进入配置状态
nterface range {port-range} 进入组配置状态
配置三层端口
configure terminal 进入配置状态
interface {{fastethernet | gigabitethernet} interface-id} | {vlan vlan-id} |
{port-
channel port-channel-number} 进入端口配置状态
no switchport
把物理端口变成三层口
ip address ip_address subnet_mask 配置IP地址和掩码
no shutdown 激活端口
例:
Switch(config)# interface gigabitethernet0/2
Switch(config-if)#
no switchport
Switch(config-if)# ip address 1922013521 2552552550
Switch(config-if)# no shutdown
配置VLAN
configure terminal 进入配置状态
vlan vlan-id 输入一个VLAN号, 然后进入vlan配态,可以输入一个新的VLAN号或旧的来进行修改按照以下几个步骤 *** 作即可,
A进入全局配置模式
switch#config terminal
B将交换机配置为VTP客户端模式
switch(config)#vtp mode client
C指定VTP的管理域名称,必须与VTP服务器拥有相同的域名称
switch(config)#vtp domail domail_name
D键入VTP域密码
switch(config)#vtp password password_name
E返回特权模式
switch(config)#end
F查看并检验配置
switch#show vtp status
H保存VTP配置
switch#copy running-config startup-config
这里面核心的 *** 作是对VTP客户端的指定,密码设置,域名称的设置。a、更改远程TELNNET密码
Switch#configure terminal
Switch(config)#line vty 0 4
Switch(config-line)#password qycx123
Switch(config-line)#login
Switch(config-line)#exit
b、更改进入全局配置模式时的密码
Switch#configure terminal
Switch(config)#enable secret qycx123
思科交换机常用命令——创建并划分VLAN
a、创建VLAN
Switch#vlan database
Switch(vlan)#vlan 99 name office (创建vlan 99 并命名为office)
b、将端口划分至vlan
Switch(config)#interface fastEthernet 0/8
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 99 (将8号快速以太口划分至vlan 99)
思科交换机常用命令——调试命令
a、显示所有配置命令:Switch#show run
b、显示所有接口状态:Switch#show ip int brief
c、显示所有VLAN的信息:Switch#show vlan brief
cisco交换机还是比较常用的,于是我研究了一下Cisco交换机命令的大总结,在这里拿出来和大家分享一下,希望对大家有用。我所针对的都是Cisco的设备而言的,华为的可以跟据手册来查,配置都是差不多的,这里华子就不多写华为的设备了,了解的也不是很多。
Cisco交换机命令之使用Telnet远程式管理
switch(config)#interface vlan 1 进入vlan 1
switch(config-if)#ip address 设置IP地址
switch(config-if)#ip default-gateway 设置默认网关
switch(config)#line vty 0 4 进入虚拟终端
switch(config-line)#login 允许登录
switch(config-line)#password xx 设置登录口令
switch#exit 返回命令
Cisco交换机命令之控制台口令
switch(config)#line console 0 进入控制台口
switch(config-line)#login 允许登录
switch(config-line)#password xx 设置登录口令
switch#exit 返回命令
Cisco交换机命令之基本接口配置
switch(config)#interface f0/1 进入f0/1接口
switch(config-if)#duplex full 配置全双工模式
switch(config-if)#speed 100 配置速率
switch(config-if)#description to 接口描述
switch(config)#ip domain-name com 设置或名服务器
switch(config)#mac-address-table aging-time 设置mac表超时时间
switch#write 保存配置信息
switch#copy running-config startup-config 保存当前配置nvram
switch#erase startup-config 清除配置文件
Cisco交换机命令之交换机VLAN设置:
switch#vlan database 进入VLAN设置
switch(vlan)#vlan 2 建VLAN 2
switch(vlan)#name 名字 建VLAN 2的名称
switch(vlan)#no vlan 2 删vlan 2
注:删除vlan时原属于此vlan的端口处于非激活状态,直到重新分配为止。
switch(config)#int f0/1 进入端口1
switch(config-if)#switchport mode access 当前端口工作莫试
switch(config-if)#switchport access vlan 2 当前端口加入vlan 2
switch(config-if)#switchport mode trunk 设置为干线
switch(config-if)#switchport trunk encapsulation dot1q 设置vlan 中继协议
switch(config-if)#no switchport mode 或 ( switchport mode access) 禁用干线
switch(config-if)#switchport trunk allowed vlan add 1,2 ; 从Trunk中添加vlans
switch(config-if)#switchport trunk allowed vlan remove 1,2 ;从Trunk中删除vlans
switch(config-if)#switchport trunk pruning vlan remove 1,2 ;从Trunk中关闭局部修剪
Cisco交换机命令之以太网通道配置
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 查看通道信息
Cisco交换机命令之vtp配置
switch(config)#vtp domain 设置vtp域名
switch(config)#vtp password 设置vtp密码
switch(config)#vtp mode server 设置vtp服务器模式
switch(config)#vtp mode client 设置vtp客户机模式
switch(config)#vtp mode transparent 设置vtp 透明模式
switch(config)#vtp version 设置vtp版本
switch(config)#vtp pruning 启用vtp修解
switch(config)#no vtp pruning 关闭vtp修解
注:要想从vtp中减少一台交换机只需将该交换机vtp 名更改
Cisco交换机命令之生成树stp:
switch(config)#spanning-tree vlan 启用stp生成树(基于vlan)
switch(config)#spanning-tree vlan root primary 指定根交换机(基于vlan)
switch(config)#spanning-tree vlan root secondary 指定备用根交换机(基于vlan)
switch(config)#spanning-tree vlan priority 指定交换机优先级(基于vlan)
switch(config)#no spanning-tree vlan priority 将交换机的优先级恢复默认值(基于vlan)
switch(config-if)#spanning-tree vlan cost 指定端口成本(起用trunk的端口模式下)
switch(config-if)#spanning-tree vlan port-prioty 指定交换机端口优先级(基于vlan)
switch(config-if)#spanning-tree portfast 配置速端口(连接终端设备的端口状态)如pc机
switch(config)#spanning-tree uplinkfast 配置上行速端口
switch(config)#spanning-tree vlan hello-time 配置交换机hello时间(基于vlan)
switch(config)#spanning-tree vlan forward-time 修改转发延迟计时器(基于vlan)
switch(config)#spanning-tree vlan max-time 修改最大老化时间(基于vlan)
switch#show spanning-tree summery 检测vlan生成树配置
switch#show spanning-tree vlan detail 浏览详细生成树配置信息
switch#show spanning-tree interface detail 浏览详细生成树端口配置信息
Cisco交换机命令之交换机显示命令:
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 mac-address-table aging-time 查看mac超时时间
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设备
准备工具/原料:一台PC和一台交换机
1、首先将一台PC和一台交换机用线缆连接起来。
2、打开PC,规范好PC的网络配置,如下图所示,记住PC的网关就是交换机的IP地址。
3、进入交换机的中端里面进行配置。
4、先给交换机起一个名字,命令是:Switch#conf tEnter configuration commands, one per line End with CNTL/ZSwitch(config)#hostname s1s1(config)#
5、在小型或中型甚至大型企业,不可能只有一台交换机连接一台电脑,以下就是交换机的端口。
6、交换机还可以创建wlan模式。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)