華為交換機與三層交換機配置


交換機的命令行視圖

  • 華為交換機的命令行
    -用戶視圖
    <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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM