#夏日生活打卡季#
一、華為交換機登入
- 確定計算機與華為交換機處于同一網絡中,并使用網絡線纜将計算機連接配接到交換機的管理接口。
- 打開一個支援SSH或Telnet協定的終端軟體,例如PuTTY(對于Windows系統)或Terminal(對于Mac或Linux系統)。
- 在終端軟體中,輸入交換機的管理IP位址,并選擇SSH或Telnet作為連接配接方式。
- 點選或按下Enter鍵,終端軟體将會建立與交換機的連接配接。
- 在登入提示符下,輸入登入使用者名和密碼。預設情況下,華為交換機的預設使用者名是"admin",預設密碼是"admin",或使用設定的自定義使用者名和密碼進行登入。
- 輸入使用者名和密碼後,按下Enter鍵進行驗證。
二、華為交換機在登入後基本的設定
常見的基本設定指令:
- 修改交換機主機名:
csharpCopy code
[Switch] sysname NEW_HOSTNAME
- 設定管理接口IP位址:
cssCopy code
[Switch] interface interface_name [Switch-Interface1/0/1] ip address IP_ADDRESS MASK [Switch-Interface1/0/1] quit
- 配置管理使用者:
csharpCopy code
[Switch] local-user USERNAME password irreversible-cipher PASSWORD [Switch] local-user USERNAME service-type telnet ssh [Switch] privilege level 15 [Switch] quit
- 配置SSH通路:
csharpCopy code
[Switch] rsa local-key-pair create [Switch] ssh user USERNAME authentication-type password [Switch] ssh user USERNAME service-type stelnet [Switch] ssh user USERNAME level 15 [Switch] quit
- 配置Telnet通路:
csharpCopy code
[Switch] telnet server enable [Switch] quit
- 儲存配置:
csharpCopy code
[Switch] save
三、華為交換機VLAN 配置
華為交換機的VLAN配置步驟:
- 進入交換機的指令行界面。
- 建立VLAN:
cssCopy code
[Switch] vlan batch vlan_id1 [to vlan_id2]
例如,建立VLAN 10和VLAN 20:
csharpCopy code
[Switch] vlan batch 10 20
- 配置端口的通路模式(Access Mode)或雙向模式(Hybrid Mode):
Access Mode:用于連接配接終端裝置的端口,裝置隻能屬于一個VLAN。
scssCopy code
[Switch] interface interface_name [Switch-Interface1/0/1] port link-type access [Switch-Interface1/0/1] port default vlan vlan_id [Switch-Interface1/0/1] quit
例如,将端口1/0/1配置為Access Mode,屬于VLAN 10:
scssCopy code
[Switch] interface Ethernet 1/0/1 [Switch-Ethernet1/0/1] port link-type access [Switch-Ethernet1/0/1] port default vlan 10 [Switch-Ethernet1/0/1] quit
Hybrid Mode:用于連接配接上級交換機或路由器的端口,可以同時屬于多個VLAN。
cssCopy code
[Switch] interface interface_name [Switch-Interface1/0/1] port link-type hybrid [Switch-Interface1/0/1] port hybrid vlan vlan_id1 [to vlan_id2] [Switch-Interface1/0/1] quit
例如,将端口1/0/2配置為Hybrid Mode,同時屬于VLAN 10和VLAN 20:
cssCopy code
[Switch] interface Ethernet 1/0/2 [Switch-Ethernet1/0/2] port link-type hybrid [Switch-Ethernet1/0/2] port hybrid vlan 10 20 [Switch-Ethernet1/0/2] quit
- 配置端口的Trunk Mode(可選):
Trunk Mode:用于連接配接交換機之間的端口,可以傳輸多個VLAN的資料。
cssCopy code
[Switch] interface interface_name [Switch-Interface1/0/1] port link-type trunk [Switch-Interface1/0/1] port trunk allow-pass vlan vlan_id1 [to vlan_id2] [Switch-Interface1/0/1] quit
例如,将端口1/0/3配置為Trunk Mode,允許傳輸VLAN 10和VLAN 20的資料:
cssCopy code
[Switch] interface Ethernet 1/0/3 [Switch-Ethernet1/0/3] port link-type trunk [Switch-Ethernet1/0/3] port trunk allow-pass vlan 10 20 [Switch-Ethernet1/0/3] quit
- 儲存配置:
csharpCopy code
[Switch] save
四、華為交換機接口配置
華為交換機的接口配置主要步驟:
- 進入交換機的指令行界面。
- 選擇要配置的接口:
csharpCopy code
[Switch] interface interface_name
例如,選擇接口GigabitEthernet 0/0/1:
csharpCopy code
[Switch] interface GigabitEthernet 0/0/1
- 配置接口的工作模式:
Access Mode:用于連接配接終端裝置的接口,裝置隻能屬于一個VLAN。
csharpCopy code
[Switch-GigabitEthernet0/0/1] port link-type access [Switch-GigabitEthernet0/0/1] port default vlan vlan_id
例如,将接口GigabitEthernet 0/0/1配置為Access Mode,屬于VLAN 10:
csharpCopy code
[Switch-GigabitEthernet0/0/1] port link-type access [Switch-GigabitEthernet0/0/1] port default vlan 10
Trunk Mode:用于連接配接交換機之間的接口,可以傳輸多個VLAN的資料。
cssCopy code
[Switch-GigabitEthernet0/0/1] port link-type trunk [Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan vlan_id1 [to vlan_id2]
例如,将接口GigabitEthernet 0/0/1配置為Trunk Mode,允許傳輸VLAN 10和VLAN 20的資料:
csharpCopy code
[Switch-GigabitEthernet0/0/1] port link-type trunk [Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 20
- 配置接口的速率和雙工模式(可選):
scssCopy code
[Switch-GigabitEthernet0/0/1] speed {10 | 100 | 1000 | auto} [Switch-GigabitEthernet0/0/1] duplex {auto | half | full}
例如,将接口GigabitEthernet 0/0/1配置為自動速率和全雙工模式:
scssCopy code
[Switch-GigabitEthernet0/0/1] speed auto [Switch-GigabitEthernet0/0/1] duplex full
- 配置接口的描述(可選):
scssCopy code
[Switch-GigabitEthernet0/0/1] description text
例如,為接口GigabitEthernet 0/0/1添加描述:
cssCopy code
[Switch-GigabitEthernet0/0/1] description Connection to PC
- 退出接口配置模式:
csharpCopy code
[Switch-GigabitEthernet0/0/1] quit
- 儲存配置:
csharpCopy code
[Switch] save
五、華為交換機安全配置
華為交換機的安全配置涉及多個方面,常見的安全配置項:
- 控制台和Telnet通路控制:
設定控制台密碼:
cssCopy code
[Switch] user-interface console 0 [Switch-console0] authentication-mode password [Switch-console0] set authentication password cipher password
設定Telnet密碼:
cssCopy code
[Switch] user-interface vty 0 4 [Switch-ui-vty0-4] authentication-mode password [Switch-ui-vty0-4] set authentication password cipher password
- SSH遠端通路控制:
生成RSA密鑰對:
luaCopy code
[Switch] rsa local-key-pair create
啟用SSH服務:
bashCopy code
[Switch] ssh server enable
配置SSH使用者:
cssCopy code
[Switch] user-interface vty 0 4 [Switch-ui-vty0-4] authentication-mode aaa [Switch-ui-vty0-4] protocol inbound ssh
- AAA認證配置:
配置AAA認證政策:
sqlCopy code
[Switch] aaa [Switch-aaa] local-user admin password irreversible-cipher password [Switch-aaa] local-user admin privilege level 15 [Switch-aaa] local-user admin service-type telnet ssh
啟用AAA認證:
bashCopy code
[Switch] aaa enable
- 端口安全:
配置端口安全:kotlinCopy code[Switch] interface interface_name [Switch-interface] port-security enable [Switch-interface] port-security max-mac-num max_number [Switch-interface] port-security violation {shutdown | restrict | protect}
- 通路控制清單(ACL):
建立和配置ACL:
csharpCopy code
[Switch] acl number 2000 [Switch-acl4-basic-2000] rule 5 permit source source_ip destination destination_ip
應用ACL:
cssCopy code
[Switch] interface interface_name [Switch-interface] packet-filter inbound acl number
建議參考相關的華為交換機配置手冊或官方文檔進行具體操作,并根據實際需求進行适當的安全配置。