1.实验环境:eNSP
2.实验前提:创建一个交换机:S3700
3.交换机配置以及查看
3.1切换视图命令
- <Huawei> //用户视图
- <Huawei>system-view //进入系统视图
- [Huawei] //系统视图
- [Huawei]interface Ethernet0/0/1 //进入接口视图(1号接口)
- [Huawei-Ethernet0/0/1]quit //返回上一视图
- [Huawei]
- [Huawei]interface Ethernet0/0/1 //再次进入接口视图
- [Huawei-Ethernet0/0/1]return //直接返回用户视图,或使用快捷键ctrl+z
- <Huawei>
3.2查看设备型号版本
[Huawei]display version
3.3修改交换机主机名
[Huawei]sysname sw1
3.4关闭日志信息提示
- [sw1]undo info-center enable //关闭日志信息提示
3.5查看交换机配置
[Huawei]display current-configuration //查看设备配置,按空格翻页,按回车换行,或用鼠标滚轮查看
3.6使用账户和密码登录终端
- <Huawei>system-view
- [Huawei]aaa //进入账户管理视图
- [Huawei-aaa]local-user test01 password simple 123 //创建账户叫test01,配置明文方式密码123
- [Huawei-aaa]local-user test01 password cipher 123 //创建账户叫test01,如果该账户已经存在,则为修改配置,配置密文方式密码123
- [Huawei-aaa]quit
- [Huawei]user-interface console 0 //进入用户控制台接口
- [Huawei-ui-console0]authentication-mode aaa //激活配置
- 然后使用快捷键ctrl+] 退出系统,再回车重新登录,可以验证账户密码
- [Huawei]display current-configuration //可以查看明文和密文密码
3.7 保存配置
- <Huawei>save //保存配置
- The current configuration will be written to the device.
- Are you sure to continue?[Y/N]y //这里按y确认
- Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]: //直接回车
- Mar 12 2019 19:12:18-08:00 Huawei %%01CFM/4/SAVE(l)[0]:The user chose Y when dec
- iding whether to save the configuration to the device.
- Now saving the current configuration to the slot 0.
- Save the configuration successfully. //看到successfully表示成功
- <Huawei>reboot //重启设备,如果有未保存的配置会先提示保存
- Info: The system is now comparing the configuration, please wait.
- Warning: All the configuration will be saved to the configuration file for the n
- ext startup:flash:/vrpcfg.zip, Continue?[Y/N]:y //提示是否保存,选择y
- 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 //是否重启,选择y
4.交换机原理
4.1通过两台交换机和四台pc机进行实验.
交换机工作原理:学习,广播,转发,更新.
学习:MAC地址表是交换机通过学习接收的数据帧的源MAC地址来形成的
广播:如果目标地址在MAC地址表中没有,交换机就向除接收到该数据帧的接口外的其他所有接口广播该数据帧
转发:交换机根据MAC地址表单播转发数据帧
更新:交换机MAC地址表的老化时间是300秒,交换机如果发现一个帧的入接口和MAC地址表中源MAC地址的所在接口不同,交换机将MAC 地址重新学习到新的接口
4.2通过搭建拓扑网路,将一台交换机和两台pc进行单个交换机间的通信
1.用pc1 ping pc2,然后pc2 ping pc1;
2.打开交换机的命令行输入:
display mac-address
3.查看mac的路由表
注释:pc1同错0/1port到达pc2,pc2通过0/2到达pc1
4.3将一台交换机2接入上一个交换机1,另外两台pc接入交换机2,测试通信
1.用pc1 ping pc3 ,pc3 ping pc1
2.打开交换机1的命令行输入:
display mac-address
3.查看mac的路由表
4.打开交换机2的命令行输入:
display mac-address
5.查看mac的路由表: