Cisco 交换机常用操作
交换机的三种模式 1、用户模式:查看简单的配置2、特权模式:能够进行查看和命令的操作,相当于管理员
3、全局配置模式:配置交换机的参数
3.1)、由用户模式输入enable、进入特权模式
3.2、由特权模式进入全局配置模式输入config terminal
3.3、配置接口的ip时要进入到相应的接口中,用interface +接口
交换机常用配置
1、配置主机名
switch(config)#hostname cisco2960
2、配置特权模式密码
switch(config)#enable secret cisco #密码为cisco 并加密显示
3、配置console
switch(config)#line console 0
switch(config-line)#passwordcisco
switch(config-line)#login
4、配置Telnet
switch(config)#line vty 0 4
switch(config-line)#passwordcisco
switch(config-line)#login
5、创建VLAN
switch#vlan database
switch(vlan)#vlan10name vlan10
switch(vlan)#exit
配置VLAN 1 IP地址,这样就可以通过远程telnet到交换机
switch(config)interface vlan 1
switch(config-if)#ip address 192.168.1.100 255.255.255.0
switch(config-if)#no shutdown
6、删除VLAN
switch#vlan database
switch(vlan)#no vlan 10
switch(vlan)#exit
7、查看VLAN
switch#show vlan
8、将端口加入到VLAN中
Switch#configure t
Switch(config)#interface fastethernet 0/10
switch(config-if)#switchport access vlan 10
9、取消端口VLAN
Switch#configure t
Switch(config)#interface fastethernet 0/10
switch(config-if)#no switchport access vlan 10
10、配置Http-Server
Switch#configure t
Switch(config)#ip name-server 192.168.0.100
11、取消Http-Server访问
Switch#configure t
Switch(config)#no ip name-server 192.168.0.100
12、清除arp
Switch#clear arp
13、查看端口状态
Switch#show interfaces fastethernet 0/10
14、启用端口
Switch#configure t
Switch(config)#interface fastethernet 0/10
Switch(config)#no shutdown
15、关闭端口
Switch#configure t
Switch(config)#interface fastethernet 0/10
Switch(config)#shutdown
16、查看MAC地址列表
Switch#show mac-address-table
17、根据MAC地址查端口
Switch#show mac add | in 0021.5e6f.9b68
18、查看arp信息
Switch#show arp
19、查看交换机CDP邻居信息
Switch#show cdpneighbors
20、查看running配置
Switch#show running-config
21、查看start配置
Switch#show startup-config
注:running 配置是保存在交换机内存里面,当交换机重启时,不会生效
要交换机重启时生效,必须保存在startup-config配置里
22、保存交换机配置
Switch#copy running-config startup-config
23、将startup配置通过tftp保存到tftp服务器
Switch#copy startup-configtftp:192.168.1.200
24、配置SNMP
Switch#configure t
Switch(config)#snmp-server community testsnmp RO #此处不是零,是大定字母O
Switch(config)#snmp-server trap-source FastEthernet0/1 # 以Fa0/1端口为监控源
Switch(config)#snmp-server contact test@163.com #设置管理者的邮箱地址
Switch(config)#snmp-server host 192.168.1.200 testsnmp #设置管理机的IP地址为192.168.1.200,并设置团体名testsnmp
Switch(config)#snmp-server enable traps #启动监控
25、配置Qos
Switch#configure t
Switch(config)#mls qos #启用qos
Switch(config)#access-list 101 permit ip any any #建立访问控制列表 101 为ACL名称允许任何IP
#Switch(config)#class-map match-all 5 #设置Qos> Switch(config-cmap)#match access-group 101 #帮定ACL列表
Switch(config)#policy-map 5M #设置策略名称
Switch(config-pmap)#class 5 #帮定class-map
页:
[1]