华为交换机配置

 

1. 交换机配置trunk口(网卡2):

interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2009
display this
quit

2. 交换机配置access口(网卡1):

interface GigabitEthernet0/0/13
port link-type access
port default vlan 1500
display this
quit

3. 交换机配置trunk口(网卡3):

interface GigabitEthernet0/0/21
port link-type trunk
port trunk pvid vlan 2010
port trunk allow-pass vlan 1200 to 1399 2010
display this
quit

4. 交换机配置trunk口(网卡4):

interface GigabitEthernet0/0/29
port link-type trunk
port trunk pvid vlan 1600
port trunk allow-pass vlan 1600 2010 to 2013
display this
quit

5. 交换机配置完端口之后要创建vlan:

vlan batch 1200 to 1399 1500 1600 2009 to 2013

或者

vlan 1200

6. 查看哪些端口放开vlan

disp vlan 1200

7. 在交换机上给vlan配置ip

interface Vlanif1600
ip address 172.16.200.252 255.255.255.0

8. 配置交换机可以ssh

配置VTY

system-view
user-interface vty 0 4                    
 authentication-mode aaa                  
 user privilege level 2                   
 protocol inbound ssh
quit

9. 增加一个用户fhadmin

aaa
local-user fhadmin password cipher Huawei@123
local-user fhadmin privilege level 3
local-user fhadmin service-type ssh
quit

10. 使能ssh服务

SSH user fhadmin authentication-type password
SSH user fhadmin service-type stelnet
stelnet server enable
quit
save

11. 遇到的坑

  • 交换机配置完端口一定要创建vlan,要不然即使配置了vlan,网络也不通。
  • 端口设置trunk模式,配置完pvid(默认vlan)之后,需要将默认vlan加入allow-pass列表中。

12. 查看mac地址

[Switch] dis mac-address | include 99e2
-------------------------------------------------------------------------------
MAC Address    VLAN/VSI                          Learned-From        Type      
-------------------------------------------------------------------------------
ec38-8f71-99e2 128/-                             GE1/0/48            dynamic   

-------------------------------------------------------------------------------
Total items displayed = 156

13. 配置端口聚合(对应服务器bond)

创建并配置Eth-Trunk接口

[Switch] interface eth-trunk 1
[Switch-Eth-Trunk1] port link-type trunk
[Switch-Eth-Trunk1] port trunk allow-pass vlan 10 to 20

添加成员接口至创建并配置Eth-Trunk接口

连续接口可一次性添加:

[Switch] interface eth-trunk 1
[Switch-Eth-Trunk1] trunkport gigabitethernet 0/0/1 to 0/0/3

不连续的接口可以分别到接口之中配置

[Switch] interface gigabitethernet 0/0/4
[Switch-GigabitEthernet0/0/4] undo eth-trunk
[Switch-GigabitEthernet0/0/4] undo port link-type
[Switch-GigabitEthernet0/0/4] eth-trunk 1

注意:接口加入聚合之前需要先删除端口中的配置:undo eth-trunkundo port link-type

14.查看交换机端口vlan信息

dis port vlan

参考资料: