宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取

准备1台路由器,2台二层交换机,4台PC机

一.设置交换机路由器名字,端口IP,登陆密码,远程登陆
system-view 进入全部模式
[Huawei]sysname lsw1 设置交换机1名字
[Huawei]sysname lsw2 设置交换机2名字
[Huawei]sysname AR1 设置路由器名字

设置2台交换机IP:
[lsw1]interface vlanif 1
[lsw1-Vlanif1]ip address 192.168.1.2 24

[lsw2]interface vlanif 1
[lsw2-Vlanif1]ip address 192.168.2.2 24

设置路由器端口IP
[AR1]interface GigabitEthernet 0/0/0
[AR1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[AR1]interface GigabitEthernet 0/0/1
[AR1-GigabitEthernet0/0/1]ip address 192.168.2.1 24

PC设置IP地址,路由器端口IP为网关地址:全网互通

设置2台交换机登陆密码:
[lsw1]user-interface console 0 进入console口
[lsw1-ui-console0]authentication-mode password 准备密码
[lsw1-ui-console0]set authentication password cipher 123 设置密文123

[lsw2]user-interface console 0
[lsw2-ui-console0]authentication-mode password
[lsw2-ui-console0]set authentication password cipher 123

设置2台交换机远程登陆密码:
[lsw1]interface vlanif 1 进入vlan1
[lsw1-Vlanif1]user-interface vty 0 3 限制登陆人数4人
[lsw1-ui-vty0-3]user privilege level 3 设置3级操作权限
[lsw1-ui-vty0-3]authentication-mod aaa 设置3a认证
[lsw1-ui-vty0-3]aaa 进入3a模式
[lsw1-aaa]local-user xx password cipher 123 设置用户xx,密文123
[lsw1-aaa]local-user xx service-type telnet 设置连接协议telnet

[lsw2]interface vlanif 1
[lsw2-Vlanif1]user-interface vty 0 3
[lsw2-ui-vty0-3]user privilege level 3
[lsw2-ui-vty0-3]authentication-mod aaa
[lsw2-ui-vty0-3]aaa
[lsw2-aaa]local-user xx password cipher 123
[lsw2-aaa]local-user xx service-type telnet

设置路由器登陆密码:
[AR1]user-interface console 0 进入console口
[AR1-ui-console0]set authentication password cipher 456 设置密文456

设置路由器远程登陆密码:
路由器每个端口都是一个完整的广播域,两个端口都需要设置远程登陆
[AR1]interface GigabitEthernet 0/0/0 进入路由端口
[AR1-GigabitEthernet0/0/0]user-interface vty 0 3 限制登陆人数4人
[AR1-ui-vty0-3]user privilege level 3 设置3级操作权限
[AR1-ui-vty0-3]authentication-mode aaa 设置3a认证
[AR1-ui-vty0-3]aaa 进入3a模式
[AR1-aaa]local-user xx password cipher 456 设置用户xx,密文456
[AR1-aaa]local-user xx service-type telne 设置连接协议telnet

[AR1]interface GigabitEthernet 0/0/1
[AR1-GigabitEthernet0/0/1]user-interface vty 0 3
[AR1-ui-vty0-3]user privilege level 3
[AR1-ui-vty0-3]authentication-mode aaa
[AR1-ui-vty0-3]aaa
[AR1-aaa]local-user xx password cipher 456
[AR1-aaa]local-user xx service-type telnet

额外知识点:
1)display bridge mac-address 查看本机MAC地址
2)display mac-address 查看MAC地址表
3)查看直连的设备
lldp enable 全部设备启用邻居发现协议
display lldp neighbor brief 发现直连设备
4)undo negotiation auto 先进端口,后取消端口的自动协商模式
duplex half|full 设置端口为半双工或全双工模式
speed 10|100 设置配置速率10M或100M
5)display interface Ethernet brief 显示端口信息