机房交换机配置指南
交换机基础知识
1 交换机类型交换机根据其工作层次可分为二层交换机、三层交换机和多层交换机,二层交换机主要处理MAC地址,三层交换机可以处理IP地址,多层交换机则结合了二三层交换机的功能。
2 交换机接口交换机接口分为电口和光口,电口主要用于连接铜缆,光口用于连接光纤,根据传输速率,接口可分为10/100Mbps、1Gbps、10Gbps等。
交换机配置步骤
1 初始化交换机将交换机电源开启,进入命令行界面,输入命令进入特权模式,再输入命令
configure terminal
进入全局配置模式。
2 配置交换机名称在全局配置模式下,使用命令为交换机设置名称。
3 配置交换机IP地址在全局配置模式下,使用命令
interface vlan
进入VLAN接口配置模式,然后使用命令为VLAN接口配置IP地址。
4 配置交换机端口在全局配置模式下,使用命令
interface fastethernet
进入端口配置模式,然后使用命令和设置端口速率和双工模式。
5 配置VLAN在全局配置模式下,使用命令进入VLAN配置模式,然后使用命令为VLAN命名。
6 配置端口所属VLAN在端口配置模式下,使用命令
switchport mode access
设置端口为接入模式,然后使用命令
switchport access vlan
将端口分配到指定VLAN。
7 配置STP(生成树协议)在全局配置模式下,使用命令
spanning-tree mode
设置STP模式,然后使用命令
spanning-tree [portfast]
配置端口。
8 配置端口安全在端口配置模式下,使用命令
switchport port-security
启用端口安全功能,然后使用命令
switchport port-security maximum
设置最大MAC地址数量。
交换机配置实例
以下是一个简单的交换机配置实例:
R1> enableR1# configure terminalR1(config)# hostname R1R1(config)# interface vlan 10R1(config-if)# ip address 192.168.10.1 255.255.255.0R1(config-if)# exitR1(config)# interface fastethernet 0/1R1(config-if)# speed 100R1(config-if)# duplex fullR1(config-if)# switchport mode accessR1(config-if)# switchport access vlan 10R1(config-if)# exitR1(config)# vlan 10R1(config-vlan)# name VLAN10R1(config-vlan)# exitR1(config)# spanning-tree mode pvstR1(config)# spanning-tree [portfast]R1(config)# endR1# show running-configBuilding configuration...Current configuration : 522 bytes!version 15.1no service padservice timestamps debug datetime msecservice timestamps log datetime msecservice 641no service password-recoveryhostname R1!boot-sTartup-config file "C:Program FilesciscoIOSbinstartshbootconfig.txt"!!interface vlan 10ip address 192.168.10.1 255.255.255.0!interface FastEthernet0/1description FastEthernet0/1speed 100duplex fullswitchport mode accessswitchport access vlan 10!vlan 10name VLAN10!spanning-tree mode pvstspanning-tree [portfast]!end
Q1:如何查看交换机的配置信息?A1:使用命令
show running-config
可以查看交换机的当前配置信息。
Q2:如何备份交换机的配置文件?A2:使用命令
copy running-config startup-config
可以将交换机的当前配置信息保存到启动配置文件中。
TP-link交换机设置
不用设置,如果是交换机直接把网线接到你的交换机,再把两台电脑接到交换机,如果你买的是路由器的话,把路由器的地址改一下,免得和房东的冲突,把dhcp服务器关闭,把所有网线都接在LAN口上面就可以运行使用了
多台交换机怎么样配置?
一、无论是核心还是边缘,都要先创建三个部门Vlan,并且将所有归于Default Vlan的端口删除:config vlan default del port allcreate vlan bumen1create vlan bumen2create vlan bumen3二、定义802.1q标记config vlan bumen1 tag 10config vlan bumen2 tag 20config vlan bumen3 tag 30三、核心独有,设定Vlan网关地址:config vlan bumen1 ipa 192.168.1.1/24config vlan bumen2 ipa 192.168.2.1/24config vlan bumen3 ipa 192.168.3.1/24en ipf四、设定核心交换机端口为Trunk Mode,在Extreme中即为把所有Vlan加到Trunk口,并设定每个Vlan的数据包均加802.1q标签:config vlan bumen1 add port 1-3 tconfig vlan bumen2 add port 1-3 tconfig vlan bumen3 add port 1-3 t在边缘交换机仅需要把与核心S200互连的上行口设为Trunk口就可以了,端口号自己定,把上面三条命令中的1-3变成自己定的上行端口号。五、自己想哪些端口接哪个Vlan的机器,就用这条命令加上去:config vlan add port
24口交换机的设置
要达到你的要求要用三层交换机。 。 。 当然也可以用二层。 。 。 不过那样的话三层的设置就要在路由上写了(前提是你的路由支持)比如cisco3560,具体如下:
router> en//进入特权模式
.........#conf t//进入全局模式
s0/0 //进入s0/0端口
address 192.168.1.2255.255.255.0 //配置端口地址
shutdown //开启端口
//推出端口
e 0/0 //进入。 。 端口
address 192.168.0.3 255.255.255.0 //配置端口ip
shutdown//开启端口
//推出端口
route 192.168.0.6 255.255.255.0 192.168.1.2//可以上网的地址到外网端口的路由
route 192.168.0.17 255.255.255.0 192.168.1.2//同上
routing //运行路由
//退出
//结束
不过怎么写怎么感觉楼主的方案太麻烦。 。 。 可以用不同ip段。 。 。 路由就简单多。 。 。














发表评论