一、交换机基本配置
1、Catalyst交换机默认配置
IP地址:0.0.0.0 没有IP,交换机工作在二层,基于MAC地址转发,工作不依靠IP地址。二层交换机的IP地址主要用作管理
CDP:启动 思科发现协议,在一台思科设备上,只依靠接口,不依赖MAC地址和IP地址,自动发现其他的思科设备,必须所有设备都是思科的
10/100端口:自动协商
生成树协议:启用
控制台密码:没有
端口状态:开启 路由器默认关闭,交换机默认开启
2、配置查看命令
Switch#show running-config 查看配置信息
Switch# show cdp 查看CDP信息
Switch#show spanning-tree 查看生成树
Switch#show spanning-tree brief 生成树概要信息
Switch#show vlan 查看VLAN
Switch#show interface status 查看接口状态
Switch#show ip interface brief 查看所有端口信息
Switch#show ip interface f0/1 查看指定端口信息,一般路由器使用,显示的信息和三层有关
Switch#show interfaces f0/1 查看指定端口信息,一般交换机使用,显示的信息和二层有关
Switch#show interfaces f0/1
FastEthernet0/1 is down, line protocol is down (disabled) 接口类型
Hardware is Lance, address is 0050.0fe1.3e01 (bia 0050.0fe1.3e01)
BW 100000 Kbit, DLY 1000 usec, 带宽,延迟
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set 以太网封装
Keepalive set (10 sec)
Half-duplex, 100Mb/s 半双工
input flow-control is off, output flow-control is off
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:08, output 00:00:05, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue :0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
956 packets input, 193351 bytes, 0 no buffer
Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 watchdog, 0 multicast, 0 pause input
0 input packets with dribble condition detected
2357 packets output, 263570 bytes, 0 underruns
0 output errors, 0 collisions, 10 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
3、端口命名规则
接口类型 模块号 端口在本模块上的序号
e0/1 标准以太网 0代表模块号(设备自带设备) 1是模块上的序号
f0/1 快速以太网
s0/1 串口
4、交换机配置IP地址,子网掩码和默认网关
配置IP作用:管理员通过接口VLAN1链接到交换机进行配置管理
VLAN 1和接口VLAN1的区别:VLAN1是一个广播域,接口VLAN1是利用VLAN1的编号,来配置一个IP地址,实现远程访问telnet管理的方式。\
配置方法
Switch(config)#interface vlan 1 进入接口VLAN1
Switch(config-if)#ip address 192.168.1.1 255.255.255.0 设置IP 掩码
Switch(config-if)#no shutdown 启用
Switch(config)#line vty 0 4
Switch(config-line)#password 123456 进入虚拟接口设置密码,没有密码的话无法通过telnet链接
配置网关作用:实现跨网段管理
配置方法
Switch(config)#ip default-gateway 192.168.1.88 设置网关
5、双工模式和速率
半双工
单向数据流
产生冲突率高
Hub连接
全双工
点到点连接
要求两端设备同时配置为全双工
避免冲突
设置双工
默认为auto(协商)
将f0/1设置为全双工
Switch(config)#interface f0/1
Switch(config-if)#duplex ?
auto Enable AUTO duplex configuration
full Force full duplex operation
half Force half-duplex operation
Switch(config-if)#duplex full
Switch#show interfaces f0/1
设置速率
默认为auto(协商)
将f0/1设置为100M
Switch(config-if)#speed ?
10 Force 10 Mbps operation
100 Force 100 Mbps operation
auto Enable AUTO speed configuration
Switch(config-if)#speed 100
6、配置porttfast
作用:不侦听,学习,直接进行转发,肯定要链接终端的端口配置为快速端口。可以快速启用
Switch(config-if)#spanning-tree portfast
7、管理MAC地址表
300秒更新一次
查看MAC地址表
Switch#show mac-address-table
清空MAC地址表
Switch#clear mac-address-table
设置静态
Switch(config)#mac-address-table static cc00.0e54.0000 interface f0/1 vlan 1
8、配置port Security 端口安全
作用:定义端口必须链接指定PC,或者是定义一个端口链接进来的MAC地址不能超过多少。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。