交换机如何配置

如题所述

准备工具/原料:一台PC和一台交换机

1、首先将一台PC和一台交换机用线缆连接起来。

2、打开PC,规范好PC的网络配置,如下图所示,记住PC的网关就是交换机的IP地址

3、进入交换机的中端里面进行配置。

4、先给交换机起一个名字,命令是:Switch#conf tEnter configuration commands, one per line.  End with CNTL/Z.Switch(config)#hostname s1s1(config)#

5、在小型或中型甚至大型企业,不可能只有一台交换机连接一台电脑,以下就是交换机的端口。

6、交换机还可以创建wlan模式。

温馨提示:答案为网友推荐,仅供参考
第1个回答  2021-02-09
Network Configuration Manager是一种全面的网络变更和配置管理(NCCM)解决方案,它使网络管理员能够高效、轻松地管理Cisco交换机、路由器和其他网络设备的配置。 许多IT专家的分析一次又一次地揭示了大多数网络中断最常见的原因是错误的配置变更。对网络设备配置的每一次变更都会带来网络中断、安全问题甚至性能下降的风险。计划外的变更使网络容易出现意外中断。此外,网络管理员还面临跟踪网络设备中所有事件的挑战——谁做了什么,什么时候做的。
网络配置管理器提供了一个简单、全面和优雅的解决方案,用于方便的网络变更和配置管理(NCCM)。使用Network Configuration Manager,您可以管理您的Cisco交换机、路由器和其他网络设备的配置,持续监控配置变更,接收相应变更的通知,查看详细的操作审计跟踪,轻松恢复到受信任的交换机配置,自动完成许多交换机配置任务,并完成更多的工作。 https://www.manageengine.cn/network-configuration-manager/switch-configuration.html
第2个回答  2014-03-07
cisco交换机配置清除、启动及基本配置 CISCO交换机基本配置

switch>ena 进入特权模式
switch#erase nvram 全部清除交换机的所有配置
switch#reload 重新启动交换机(初始提示符为switch> )
------------------------------------------------------------------------------------
CISCO交换机基本配置:Console端口连接
用户模式hostname> ;
特权模式hostname(config)# ;
全局配置模式hostname(config-if)# ;

交换机口令设置:
switch>enable ;进入特权模式
switch#config;进入全局配置模式
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#write 保存配置设置
switch#copy running-config startup-config 保存配置设置,与write一样
switch#exit ;返回命令
配置终端过一会时间就会由全局配置模式自动改为用户模式,将超时设置为永不超时
switch#conf t
switch(config)#line con 0
switch(config-line)#exec-timeout 0
---------------------------------------------------------------------------------
交换机显示命令:
switch#write ;保存配置信息
switch#show vtp ;查看vtp配置信息
switch#show run ;查看当前配置信息
switch#show vlan ;查看vlan配置信息
switch#show vlan name vlan2
switch#show interface ;查看端口信息
switch#show int f0/0 ;查看指定端口信息
switch#show int f0/0 status;查看指定端口状态
switch#show interface status
switch#dir flash: ;查看闪存
switch#show running-config
switch(config)#do show running-config 显示存储在内存中的当前正确配置文件。
show startup-configuration:显示存储在非易失性存储器(NVRAM)的配置文件。
show users:显示所有连接到路由器的用户。
show hosts:显示主机名和地址信息。
switch(config)#do show interface
switch(config-if)#do show int f0/21
switch#show arp
switch#show mac-address-table
------------------------------------------------------------------------------
2960交换机上配置,配置IP及网关
switch#conf t
switch(config)#interface vlan1 进入vlan 1特殊接口配置模式
switch(config-if)#ip address 192.168.1.1 255.255.255.0 设置交换机的管理IP地址
switch(config)#ip default-gateway 192.168.1.1 设置交换机的网关地址
switch(config)#ip domain-name pctc.com.cn 设置交换机所连域的域名
switch(config)#no ip domain-name
switch#ip name-server 218.87.18.230 设置交换机所连域的域名服务器IP
switch#show int vlan 1 查看交换机的VLAN 1特殊接口配置信息
switch#show run 查看交换机的当前运行配置等全部信息
--------------------------------------------------------------------------------
交换机VLAN创建,删除,端口属性的设置,配置trunk端口,将某端口加入vlan中,配置VTP:
switch(config)#vlan 2
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-if)#do show int f0/21 显示21口配置信息
switch(config-if)#shut ;shutdown 关闭当前端口
switch(config-if)#no shut ;no shutdown 开启当前端口
switch(config)#duplex ? 查看duplex的子命令
switch(config)#duplex full 设置该端口为全双工(auto/half)
switch(config)#description TO_PC1 这是该端口描述为TO_PC1
switch(config)#interface f0/21
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 192.168.1.1 255.255.255.0 ;设置IP地址
switch(config)#ip default-gateway 192.168.1.6 ;设置默认网关
switch(config)#ip domain-name cisco.com 设置域名
switch(config)#ip name-server 192.168.1.18 设置域名服务器
switch(config)#mac-address-table? 查看mac-address-table的子命令
switch(config)#mac-address-table aging-time 100 设置超时时间为100ms
switch(config)#mac-address-table permanent 0000.0c01.bbcc f0/3 加入永久地址在f0/3端口
switch(config)#mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 加入静态地址目标端口f0/6源端口f0/7
switch(config)#end
switch#show mac-address-table 查看整个MAC地址表
switch#clear mac-address-table restricted static 清除限制性静态地址
-----------------------------------------------------------------------------------
交换机端口加入vlan
将多个端口加入到VLAN2
switch(config)#interface range fa 0/17-24
switch(config-if-range)#switchport access vlan 2
单个端口加入VLAN
switch(config)#interface f0/1
switch(config-if-range)#switchport access vlan 2
--------------------------------------------------------------------------------
交换机的端口和MAC地址表的设置
2960交换机配置端口属性
switch#conf t
switch#interface ethernet 0/1
进入第1个端口
switch#description switch-e0/1-pc1
给端口写入注释信息
switch#duplex auto/full/full-flow-control/half
设置端口的工作模式
switch#port secure
启用端口安全性
switch#port secure max-mac-count 1
设置该端口允许对应的MAC地址数(默认132个)
switch#sh mac-address-table security
查看端口安全性

2912交换机配置端口属性

switch#conf t
进入全局配置模式
switch#interface fastethernet 0/1
进入第1个端口
switch#description switch-f0/1-pc1
给端口写入注释信息
switch#duplex auto/full/half
设置端口的工作模式
switch#port security
启用端口安全性
switch#port security max-mac-count 1
设置该端口允许对应的MAC地址数(默认132个)
switch#end
返回特权模式
switch#sh port security
查看端口安全性

配置和查看MAC地址表
1924交换机配置MAC地址表

switch#mac-address-table aging-time 600
设置动态地址超时时间
switch#mac-address-table permanent 0000.0cdd.5a4d e0/3
定义永久MAC地址(绑定MAC地址)
switch#mac-address-table restricted static 0000.0cdd.aaed e0/6 e0/7
定义受限MAC地址
switch#address-violation disable/ignore/suspend
定义地址安全违规
switch#show mac-address-table
查看上述配置
switch#clear mac-addr restric static
清除受限MAC地址表项

2912交换机配置MAC地址表

switch#mac-address-table aging-time 700
设置动态地址超时时间
switch#mac-address-table static 0000.0cdd.5a4d e0/3
定义永久MAC地址(绑定MAC地址)
switch#mac-address-table secure 00d0.f80d.3333 f0/3 vlan 1
定义受限MAC地址
switch#port security action shutdown/trap
定义地址安全违规
switch#show port security
查看上述配置

配置VTP、VLAN、VLAN Trunk和STP
配置VTP

switch#conf t
switch#vtp server
定义VTP的工作模式
switch#vtp domain cisco
定义VTP的域名
switch#trunk on
启用干道
switch#vtp domain cisco
加入VTP域
switch#vtp client
定义VTP的工作模式
switch#trunk on
启用干道
switch#show trunk b
switch#show trunk b allowed-vlans
查看干道信息

配置VLAN

switch#vlan 10 dept1
switch#vlan 20 dept2
switch#vlan 30 dept3
switch#vlan 40 dept4
定义所需VLAN
switch#show vlan
查看VLAN信息
switch#show vlan
switch#show vtp
查看VTP的信息
switch#int e0/1
switch#vlan-membership static 10
switch#int e0/2
switch#vlan-membership static 20
switch#int e0/3
switch#vlan-membership static 30
switch#int e0/4
switch#vlan-membership static 40
把接口划入各自VLAN

配置spanning tree

switch#spantree 1
启用生成树协议
switch#sh spantree 1
查看生成树信息
switch#no spantree 1
关闭生成树协议
switch#sh spantree 1
查看生成树信息

交换机上屏蔽个别MAC地址方法

configure terminal
interface gigabitEthernet 0/20
switchport
sw mode acc
sw port-sec
sw port-sec mac-add [macaddress]
sw port-sec max 1
sw port-sec violation restrict本回答被提问者和网友采纳
第3个回答  2014-02-21
错,交换机可配置的要配置数据,不可配置的只要插上就可以上网的,不过你的方法不对,设备也不对,就是配置对了也不能上的,
一、首先,你用的是猫,就是拨号上的网,要用户名与密码的,这就决定了交换机是不行的,你要换成路由器,我假设你有一个路由器,不管什么牌子的,只要你有,然后你把猫出来的线插在路由器的WAN口,就是进线口,然后你电脑的网口线与路由器的LAN口相连,然后在IE浏览器里输入192。168.1.1 ,会弹出一个对话框的,大多数路由器默认的用户名与密码都是admin 当然,前提是新路由器或你以前没有改过路由器的初始密码。在路由器的WAN口选项里输入你猫的用户名与密码。一步一步按着它弹出的提示来做。
二、你路由器会有四到八或更多的LAN口,就是除了WAN口以外的口,这些都可以直接在电脑上用的,插在电脑上就可以上网了,如果你想更多的电脑上网的话,你可能把其中一个口用来连交换机,这样的话,交换机剩下的口也能上网啦,都不要配置,要配置的都是企业级的交换机与路由器,这些是网络工程师去做的,家用的都是傻瓜级的,是即插即用的,呵呵!
第4个回答  2020-04-26
房东那里交换机不是可网管的,你那个路由器插上网线就可以用,不要插错口,插普通口,不要路由功能,就当个交换机使用就可以,地址是自动获取的吧
相似回答