1、配置管理IP
1 [HUAWEI]>system-view 2 3 [HUAWEI]vlan 12 4 5 [HUAWEI-VLAN12]management-vlan 6 7 [HUAWEI-VLAN12]quit 8 9 [HUAWEI]interface vlanif12 10 11 [HUAWEI-VLAN12]ip address 12.172.1.3 255.255.255.0 12 13 [HUAWEI-VLAN12]quit
1 <HUAWEI> system-view 2 3 [HUAWEI] interface MEth0/0/1 //进入管理接口MEth0/0/1 4 5 [HUAWEI] ip adddress 12.172.1.3 255.255.255.0 //设置管理ip 6 7 [HUAWEI] ip route-static 0.0.0.0 0.0.0.0 12.172.1.254 //配置管理接口网关
2、配置telnet
1 [HUAWEI]telnet server enable //Telnet出厂时是关闭的,需要打开 2 3 [HUAWEI]user-interface vty 0 4 //Telnet常用于设备管理员登录,推荐使用AAA认证 4 5 [HUAWEI-ui-vty0-4]protocol inbound telnet // V2R6及之前版本缺省支持telnet协议,但是V2R7及之后版本缺省的是SSH协议,因此使用telnet登录之前,必须要先配置这条命令。 6 7 [HUAWEI-ui-vty0-4]authentication-mode aaa 8 9 [HUAWEI-ui-vty0-4]idle-timeout 15 10 11 [HUAWEI-ui-vty0-4]quit 12 13 [HUAWEI]aaa 14 15 [Huawei-aaa]local-user admin password cipher huawei123 //Telnet登录交换机的用户名和密码。用户名不区分大小写,密码区分大小写 16 17 [HUAWEI-aaa]local-user admin privilege level 15 //将管理员的账号权限设置为15(最高) 18 19 [HUAWEI-aaa]local-user admin service-type telnet
<HUAWEI> system-view [HUAWEI] user-interface console 0 [HUAWEI-ui-console0] authentication-mode aaa [HUAWEI-ui-console0] quit
3、Vlan相关配置
3.1 创建vlan
1 [huawei]vlan 900 #创建VLAN 900 2 [huawei-vlan900]quit # 退出VLAN配置模式
3.2 设置接口G0/0/1类型access,并加入vlan12
1 [huawei]interface gigabitethernet0/0/1 2 [huawei-GigabitEthernet0/0/1]port link-type access 3 [Huawei-GigabitEthernet0/0/1]port default vlan 12 4 [huawei-GigabitEthernet0/0/1]quit
1 [Huawei]interface GigabitEthernet 0/0/2 2 [Huawei-GigabitEthernet0/0/2]port link-type trunk 3 [Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan 12
3.3 恢复Access接口上VLAN的缺省配置
1 <HUAWEI> system-view 2 [HUAWEI] interface gigabitethernet 0/0/1 3 [HUAWEI-GigabitEthernet0/0/1]undo port default vlan 4 [HUAWEI-GigabitEthernet0/0/1]undo port link-type
3.4 恢复Trunk接口上VLAN的缺省配置
1 <HUAWEI> system-view 2 [HUAWEI] interface gigabitethernet 0/0/1 3 [HUAWEI-GigabitEthernet0/0/1] undo port trunk pvid vlan 4 [HUAWEI-GigabitEthernet0/0/1] undo port trunk allow-pass vlan all 5 [HUAWEI-GigabitEthernet0/0/1] port trunk allow-pass vlan 1
4、Eth-Trunk相关配置
1 <huawei>system-view 2 [huawei]sysname huawei //更改交换机名称为huawei 3 [huawei]interface eth-trunk 1 //创建Eth-Trunk 1 4 [huawei-eth-Trunk1]quit 5 [huawei]interface gigbitethernet 0/0/3 6 [huawei-GigabitEthernet0/0/3]eth-trunk 1 //将G0/0/3加入Eth-Trunk 1 7 [huawei-GigabitEthernet0/0/3]quit 8 9 10 [huawei]interface eth-trunk 1 11 [huawei-Eth-Trunk1]port link-type trunk //设置端口模式为Trunk 12 [huawei-Eth-Trunk1]port trunk allow-pass vlan 100 to 200 //允许vlan100-200的报文通过
5、交换机接口开启关闭配置
1 <huawei>system-view 2 [huawei]interface gigabitethernet 0/0/3 3 [huawei-GigiabitEthernet0/0/3]shutdown //关闭接口 4 [huawei-GigiabitEthernet0/0/3]undo shutdown //开启接口
1 <HUAWEI>save all //保存配置
6、重置交换机
1 <huawei>system-view 2 [huawei]reset saved-configuration //删除设备配置 3 [huawei]reboot //重启