交换机命令行

1.实验环境:eNSP

2.实验前提:创建一个交换机:S3700

3.交换机配置以及查看

3.1切换视图命令

  1.             //用户视图
  2. system-view             //进入系统视图
  3. [Huawei]            //系统视图
  4. [Huawei]interface Ethernet0/0/1 //进入接口视图(1号接口)
  5. [Huawei-Ethernet0/0/1]quit    //返回上一视图
  6. [Huawei]
  7. [Huawei]interface Ethernet0/0/1 //再次进入接口视图
  8. [Huawei-Ethernet0/0/1]return     //直接返回用户视图,或使用快捷键ctrl+z

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使用账户和密码登录终端

  1. system-view
  2. [Huawei]aaa                //进入账户管理视图
  3. [Huawei-aaa]local-user test01 password simple 123 //创建账户叫test01,配置明文方式密码123
  4. [Huawei-aaa]local-user test01 password cipher 123 //创建账户叫test01,如果该账户已经存在,则为修改配置,配置密文方式密码123
  5. [Huawei-aaa]quit
  6. [Huawei]user-interface console 0        //进入用户控制台接口
  7. [Huawei-ui-console0]authentication-mode aaa     //激活配置
  8. 然后使用快捷键ctrl+] 退出系统,再回车重新登录,可以验证账户密码
  9. [Huawei]display current-configuration   //可以查看明文和密文密码

3.7 保存配置

  1. save                //保存配置
  2. The current configuration will be written to the device.
  3. Are you sure to continue?[Y/N]y                    //这里按y确认
  4. Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]: //直接回车
  5. Mar 12 2019 19:12:18-08:00 Huawei %%01CFM/4/SAVE(l)[0]:The user chose Y when dec
  6. iding whether to save the configuration to the device.
  7. Now saving the current configuration to the slot 0.
  8. Save the configuration successfully.                //看到successfully表示成功
  9. reboot        //重启设备,如果有未保存的配置会先提示保存
  10. Info: The system is now comparing the configuration, please wait.
  11. Warning: All the configuration will be saved to the configuration file for the n
  12. ext startup:flash:/vrpcfg.zip, Continue?[Y/N]:y            //提示是否保存,选择y
  13. Info: If want to reboot with saving diagnostic information, input 'N' and then e
  14. xecute 'reboot save diagnostic-information'.
  15. 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张图片

1.用pc1 ping pc2,然后pc2 ping pc1;

2.打开交换机的命令行输入:

        display mac-address

3.查看mac的路由表交换机命令行_第2张图片

注释:pc1同错0/1port到达pc2,pc2通过0/2到达pc1

 4.3将一台交换机2接入上一个交换机1,另外两台pc接入交换机2,测试通信交换机命令行_第3张图片

1.用pc1 ping pc3 ,pc3 ping pc1

2.打开交换机1的命令行输入:

        display mac-address

3.查看mac的路由表

交换机命令行_第4张图片

4.打开交换机2的命令行输入:

        display mac-address

5.查看mac的路由表:交换机命令行_第5张图片

你可能感兴趣的:(网络,拓扑学)