一、实验环境 (针对我们的学习环境) 1、登陆地址
http://192.168.200.100:8081/cts/app/index简写
192.168.200.100:8081/cts二、交换机基本操作 1、基本介绍 交换机命令行主要有“用户模式”,“特权模式”,“全局模式”,“VLAN模式”,“接口模式”,“线程模式”
switch> "用户模式" switch# "特权模式" switch(config) "全局模式" switch(config-vlan) "VLAN模式" switch(config-if) "接口模式" switch(config-line) "线程模式"2、基本查看命令
show version //查看交换机版本信息 show vlan //查看vlan show interface fastethernet 0/3 //查看第三个端口的状态 show mac-address-table //查看mac地址表 show running-config //查看交换机配置信息,信息存储在RAM show clock //查看系统时间 show ip interface brief //查看三层设备的ip和子网掩码 show interface f0/1 //查看接口信息mac地址 流量 show interface status //查看交换接口的信息,包括状态、vlan、双工、速度和使用介质3、解决实际问题 (1)配置主机名
enable //进入特权模式 configure terminal //进入全局模式 hostname TonLX //把名字改成TonLX(2)配置系统时间
enable configure terminal clock set 18:07:43 10 20 2020 //把日期改成2020年10月20日(3)设置每日登陆提示
enable configure terminal banner motd # TonLX 今天是2020年10月20日 # //提示信息已#开始以#结束,最多255个字节(4)配置交换机端口速率与双工配置 /** 默认端口速率100Mbit/s,全双工 端口速率可自定义,默认是auto(自适应) 双工模式有full(全双工),half(半双工),默认是auto(自适应) **/ (4.1)设置端口速率
enable configure terminal interface fastethernet 0/2 speed 10 no shutdown (4.2)设置双工模式 enable configure terminal interface fastethernet 0/2 duplex half no shutdown(5)配置交换机管理地址 /** 二层交换机不能配置IP地址,不过可以给虚拟接口(switch virtual interface,SVI)配 ip地址来作为管理设备,默认可以给vlan1配管理地址,因为vlan1可以连通所有端口 **/ (5.1)配置交换机远程登录地址
enable configure terminal interface vlan 1 //打开vlan 1 ip address 192.168.10.1 255.255.255.0 //给这台交换机配置了一个管理地址 no shutdown //保存生效 end //返回特权模式(5.2)配置交换机登录密码以及特权密码
configure terminal enable secret level 1 0 TonLX //配置远程telnet的登录密码 enable secret level 15 0 TonLX //配置使用enable的密码 (5.3)启动交换机的远程登录线程密码 configure terminal line vty 0 4 //启动4条线程 password TonLX //配置线程密码 login //激活线程(6)划分VLAN
enable configure terminal vlan 10 exit vlan 20 exit interface range fastethernet 0/1-12 switchport access vlan 10 end configure terminal interface range fastethernet 0/13-24 switchport sccess vlan 20 end no shutdown(7)配置tunk /*这里只做一台交换机,第二台一样, 1 端口均为全双工模式; 2 端口速率相同; 3 端口的类型必须一样,比如同为以太口或同为光纤口; 4 端口同为access 端口并且属于同一个vlan 或同为trunk 端口; 5 如果端口为trunk 端口,则其allowed vlan 和native vlan 属性也应该相同。 */
enable configure terminal interface fastethernet 0/1 switchport mode trunk exit保存配置文件信息
enable write memory或者write或者copy running-config startup-config