华为交换机与三层交换机配置

交换机的命令行视图

  • 华为交换机的命令行
    -用户视图
    <Huawei>
    -系统视图
    <Huawei>system-view
    [Huawei]
    -接口视图
    [Huawei] interface Ethernet0/0/1
    [Huawei-Ethernet0/0/1]
    • interface: 接口
    • Ethernet: 接口类型
    • 0/0/1:第一个“0”代表槽位号,第二个“0”代表子卡号,“1”代表接口号
  • 修改交换机名称
    <Huawei>system-view
    [Huawei]sysname sw1
    [sw1]
  • 查看系统版本vrp(通用路由平台)
    [sw1]display version
  Huawei Versatile Routing Platform Software
  VRP (R) software, Version 5.110 (S3700 V200R001C00)
  Copyright (c) 2000-2011 HUAWEI TECH CO., LTD

  Quidway S3700-26C-HI Routing Switch uptime is 0 week, 0 day, 0 hour, 7 minutes
  • 查看当前配置
    [sw1]display current-configuration
#
sysname sw1
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password simple admin
 local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Ethernet0/0/1
#
interface Ethernet0/0/2
#
interface Ethernet0/0/3
#
  • 配置用户名密码
<Huawei>
<Huawei>system-view   //进入系统视图
[Huawei]aaa           //进入aaa认证
[Huawei-aaa]local-user admin01 password cipher 123  //创建用户名密码  ciphter 密文
Info: Add a new user.
[Huawei-aaa]quit
[Huawei]user-interface console 0             
[Huawei-ui-console0]authentication-mode aaa   //激活配置
[Huawei-ui-console0]                   // ctrl + z
<Huawei>save                    // 保存配置
<Huawei>system-view
<Huawei>sysname sw1
<sw1>reset saved-configuration // 清楚配置
<sw1>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:, Continue?[Y/N]:n  // 是否再次保存配置 n
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
Dec  2 2021 11:34:15-08:00 sw1 %%01CMD/4/REBOOT(l)[51]:The user chose Y when dec
iding whether to reboot the system. (Task=co0, Ip=**, User=admin01)
  • 查看mac地址表
    <Huawei>display mac-address

交换机转发原理

  • 初始状态
  • MAC地址学习
  • 广播未知数据帧
  • 接收方回应
    学习,学习源mac地址,记录对应的接口号
    广播,向除了数据来源之外的所有接口发送信息
    转发,1对1进行数据传递
    更新,超过300秒无任何数据通讯,mac地址记录将被删除
    接口设备更换,或者接口down掉

快捷命令

ctrl + z 快速返回用户视图 等同于 return
ctrl + ] 快速退出系统
quit 一步步返回

三层交换机

三层交换机使用valn虚拟接口来配置地址,从而实现不通网段的通信

[Huawei]interface Vlanif 1    //进入虚拟接口vlan1
[Huawei-Vlanif1]ip address 192.168.1.254 24
[Huawei]vlan 2
[Huawei-vlan2]quit
[Huawei]interface Vlanif 2
[Huawei-Vlanif1]ip address 192.168.2.254 24
[Huawei]vlan 3
[Huawei-vlan3]quit
[Huawei]interface Vlanif 3
[Huawei-Vlanif1]ip address 192.168.3.254 24

[Huawei]interface g0/0/2      //将2口加入vlan2
[Huawei-GigabitEthernet0/0/2] port link-type access
[Huawei-GigabitEthernet0/0/2] port default vlan 2

[Huawei]interface g0/0/3
[Huawei-GigabitEthernet0/0/3] port link-type access
[Huawei-GigabitEthernet0/0/3] port default vlan 3
  • 查看设备的ip地址配置情况
    display ip interface brief

s5700为接口配置ip思路
1, 创建新vlan
2, 进入此vlan,配置ip
3, 将接口加入此vlan

posted @ 2021-12-02 10:59  菜鸟成长历程  阅读(1524)  评论(0编辑  收藏  举报