预备知识学习
以太网技术要点:ui
以太网帧-Ethernet_Ⅱspa
以太网数据帧的长度在64-518字节之间。(大于或小于则称为无效帧)接口
初始状态下,交换机的MAC地址表为空,交换机将收到的数据帧的源MAC地址和对应接口记录到MAC地址表中,交换机根据MAC地址表将目标主机的回复信息单播转发给源主机。ip
交换机基本工做原理:学习,转发,泛洪,过时(老化时间),过滤ci
交换机设备配置路由
配置console口令terminal
(密码模式,首选):it
[Huawei] user-interface console 0io
[Huawei-ui-console0] authentication-mode password
[Huawei-ui-console0] set authentication password simple/cipher 密码
(AAA验证模式):
[Huawei] user-interface console 0
[Huawei-ui-console0] authentication-mode aaa
[Huawei-ui-console0] quit
[Huawei] aaa
[Huawei-aaa] local-user 用户名 password simple/cipher 密码
[Huawei-aaa] local-user 用户名 service-type terminal
配置交换机设备名
[Huawei] syaname 设备名
(undo sysname则将设备名回退,undo是个好东西)
配置交换机登录权限
用户等级 |
命令等级 |
名称 |
0 |
0 |
参观级 |
1 |
0and1 |
监控级 |
2 |
0,1,and2 |
配置级 |
3~15 |
0,1,2,and3 |
管理级 |
例如,配置console的登录权限
[Huawei-ui-console0] user privilege level 2
(undo user privilege level,回退)
配置超时时间(仍是以console口为例)
[Huawei] user-interface console 0
[Huawei-ui-console0] idle-timeout 分钟 秒数
配置交换机管理接口和地址
例如VLAN20为管理VLAN,PC能和交换机的管理地址相互通信则须要进行以下配置:
[Huawei] vlan 20
[Huawei-vlan20] quit
[Huawei] interface vlanif 2
[Huawei-Vlanif2] ip address 192.168.1.1 24(255.255.255.0)
[Huawei-Vlanif2] quit
[Huawei] interface G0/0/2
[Huawei-GigabitEthernet0/0/2] port link-type access
[Huawei-GigabitEthernet0/0/2] port default vlan 20
配置交换机的网关地址(默认路由)
[Huawei] ip route-static 0.0.0.0 0.0.0.0 网关地址
配置交换机能被远程登录(Telnet)
先决条件:1.交换机设置好管理IP,客户端能ping通交换机
2.必需要设置vty口令(不然客户端会登录失败)
设置vty口令:
[Huawei] user-intface vty 0 ? (最多能够设置5个vty口)
[Huawei-ui-vty0-?] authentication-mode password/aaa
(后续设置步骤请参照以前设置密码的过程)
配置交换机的接口
[Huawei] interface G0/0/1 //进入指定的接口
[Huawei-GigabitEthernet0/0/1] descpriton 对于接口的描述 //对接口进行描述
[Huawei-GigabitEthernet0/0/1] undo negotiation auto //关闭自动协商
[Huawei-GigabitEthernet0/0/1] speed 10/100/1000 //设置端口速率
[Huawei-GigabitEthernet0/0/1] duplex half/full //设置半/全双工模式
设置交换机的端口组
[Huawei] port-group 1 //设置端口组1
[Huawei-port-group-1] group-member e0/0/1 to e0/0/10 //对于连续端口的设置
[Huawei-port-group-1] group-member e0/0/1 e0/0/5 e0/0/10 //对于不连续端口的设置
设置交换机端口组的好处:能够批量运行指令,节省时间。