交换机
1)作用 用于将多台计算机/交换机连接到一起,组建网络 交换机负责为其中任意两台计算机提供独享线路进行通信 连接电脑组建局域网(组建局域网的主要设备)
2)类型 非网管(即插即用),便宜,不可管理 网管(智能),较贵,可以方便管理(隔离、限速、ACL、堆叠)
部署ENSP平台
1)eNSP:华为的网络设备仿真平台(交换机、路由器、防火墙、wifi、电脑)
2)进入物理交换机配置界面
使用console线一端连接交换机console口,另一端连接计算机USB或com口,Putty、SecureCRT、Xshell等终端程序进入设备的配置界面。
交换机组建局域网
认识配置视图
- 认识设备的配置视图
<Huawei>
用户视图 【查看运行状态】
[Huawei] 系统视图 【配置设备的系统参数】
[Huaiwei-GigabitEthernet0/0/1] 接口视图 【配置接口参数】
[Huawei-ospf-1] 协议视图 【配置XX协议】
- 切换视图
<Huawei> //用户视图
<Huawei> system-view //进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei] //系统视图
[Huawei] interface GigabitEthernet 0/0/1 //进入接口视图
[Huawei-GigabitEthernet0/0/1] //接口视图
- 退回视图
① quit 退回到上一个视图(逐级退回)
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]quit
<Huawei>
② return或者 快捷键Ctrl+Z 直接返回到用户视图
[Huawei-GigabitEthernet0/0/3]return
<Huawei>
- 操作技巧
① 命令是不区分大小写的
② 按?可以获取到帮助信息
方法一:直接在视图上敲?(在该视图上能够敲的命令有哪些)
方法二:问命令全拼 (例如:s?)
方法三:问命令后面能跟哪些命令(例如:interface ?)
③ 命令可以简写
④ 按TAB键自动补全
交换机基本配置命令
display current-configuration //查看当前有效配置
<Huawei> display current-configuration
display version //查看系统版本信息
<Huawei>display version Huawei Versatile Routing Platform Software VRP (R) software, Version 5.110 (S5700 V200R001C00) 备注:设备系统,版本,型号 Copyright (c) 2000-2011 HUAWEI TECH CO., LTD Quidway S5700-28C-HI Routing Switch uptime is 0 week, 0 day, 1 hour, 25 minutes 备注:查看设备的开启时长(week=周,day=天,hour=小时,minutes=分钟)
sysname 设备名 //配置设备名称
[Huawei]sysname SW1 修改设备名为SW1 设备命名规范:部门-位置-机架编号[还是要根据公司规定的命名规范进行命名]
undo shutdown //开启接口 shutdown //关闭接口
[SW1-GigabitEthernet0/0/1] undo shutdown Feb 16 2023 15:48:28-08:00 SW1 %%01PHY/1/PHY(l)[3]:GigabitEthernet0/0/1: cha nge status to up 接口已开启 [SW1-GigabitEthernet0/0/1] shutdown Feb 16 2023 15:51:16-08:00 SW1 %%01PHY/1/PHY(l)[4]:GigabitEthernet0/0/1: cha nge status to down 接口已关闭
save //保存配置
<Huawei>save The current configuration will be written to the device. 当前配置将要被写入到设备中 Are you sure to continue?[Y/N] y 你确定要继续嘛? ...... Save the configuration successfully. 配置保存成功
重启设备
<Switch>reboot Info: The system is now comparing the configuration, please wait. Info: If want to reboot with saving diagnostic information, input 'N' and then e xecute 'reboot save diagnostic-information'. System will reboot! Continue?[Y/N]:y
设置终端密码
[SW1] user-interface console 0 //进入终端进行配置 [SW1-ui-console0] authentication-mode password //启用密码认证 [SW1-ui-console0] set authentication password cipher 123456 //设置终端密码为123456(密文) 想要验证密码,在用户视图中直接敲入quit退出,再按回车键提示输入密码
交换机基本配置
language-mode Chinese //切换语言模式为中文
<Huawei>language-mode Chinese Change language mode, confirm? [Y/N] y 备注:更改语言模式,确认吗?Y确认 提示:改变语言模式成功。 <Huawei>language-mode English //切换语言模式为英文
undo terminal monitor //取消终端提示
<SW2>undo terminal monitor //取消终端提示 terminal 终止 Info: Current terminal monitor is off. 提醒:当前终端提示已经关闭 <SW2>terminal monitor //开启终端提示 Info: Current terminal monitor is on. 提示:当前终端提示已经开启 <SW2>u t m //取消终端提示简写 Info: Current terminal monitor is off.
设置交换机闲置会话时间
user-interface console 0 //进终端进行配置 [SW1]user-interface console 0 //进终端进行配置 [SW1-ui-console0]idle-timeout 1 //设置闲置会话时间为1分钟
恢复出厂设置
<SW1> reset saved-configuration //恢复出厂设置 Warning: The action will delete the saved configuration in the device. The configuration will be erased to reconfigure. Continue? [Y/N]: y //是否要恢复出厂设置 .......... Info: Succeeded in clearing the configuration in the device. <SW1> reboot //重启终端 Warning: All the configuration will be saved to the configuration file for the n ext startup:, Continue?[Y/N]: n //提示是否保存当前配置,选择是Y/否N ........... System will reboot! Continue?[Y/N]: y //提示设备是否要重启,选择是Y/否N
辟邪剑谱
<Huawei> u t m 关闭日志提示 <Huawei> dis ver 显示版本 <Huawei> dis cu 查看当前配置信息 <Huawei> sy 进入系统视图 [Huawei] sy S1 更改设备名为S1 [S1] int g0/0/1 进入接口 [S1-GigabitEthernet0/0/1] sh 禁用接口 [S1-GigabitEthernet0/0/1] undo sh 启用接口 Ctrl+z 返回用户视图 [S1] user-in co 0 进入console口 [S1-ui-console0] auth p 启用密码认证 [S1-ui-console0] set a p c 123设 置密码 [S1-ui-console0] ret 返回到用户视图 <S1> sa 保存 <S1> quit Please Press ENTER. Login authentication Password:输入 123 [S1] user-in co 0 进入console口 [S1-ui-console0] i 1440 设置超时时间24小时 <S1> res sa Warning: The action will delete the saved configuration in the device. The configuration will be erased to reconfigure. Continue? [Y/N]:y确认恢复 <S1> reboot ext startup:, Continue?[Y/N]:n不保存 System will reboot! Continue?[Y/N]:y重启
远程控制交换机
配置思路
- 给设备配置IP地址
SW1:(以上图标注为准) [Huawei]interface Vlanif 1 //进入虚接口Vlanif1 [Huawei-Vlanif1]ip address 192.168.10.100 24 //配置IP地址 PC:(以上图标注为准,也是一台交换机) [Huawei]interface Vlanif 1 //进入虚接口Vlanif1 [Huawei-Vlanif1]ip address 192.168.10.200 24 //配置IP地址 **<SW1>display interface Vlanif 1 //查询IP地址信息**
- 测试两台设备的网络连通性
SW1: <Huawei>ping 192.168.10.200 PC:(以上图标注为准,也是一台交换机) <Huawei>ping 192.168.10.100
- 实施远程
SW1: [SW1]user-interface vty 0 4 //进入远程配置视图,允许5个会话远程访问 [SW1-ui-vty0-4]authentication-mode password //启用密码认证模式 [SW1-ui-vty0-4]set authentication password cipher 123456 //设置密文密码为123456 [SW1-ui-vty0-4]user privilege level 3 //设置权限级别,默认为权限0参观级,3为管理级 PC:(以上图标注为准,也是一台交换机) <huawei> telnet 192.168.10.100 Password: 实现远程控制
注:telnet 远程管理协议,端口号 23