华为交换机基本配置、用户配置、vlan配置、端口镜像配置、交换机mac地址学习
登录交换机进入用户视图
System-view
从用户视图进入系统视图 system-view
sysname
在系统视图下修改交换机名称 sysname
Clock datetime
在用户视图下设置系统时钟 clock datetime “时时:分分:秒秒 年-月-日”
例如:修改时间为2019年4月16日 23:30:30
Clock datetime 23:30:30 2019-4-16
Clock timezone
在用户视图下设置时区
例如:设置当前时区为北京时区
因为北京时间是utc+8所以语法可以写成 clock timezone Beijing add 08:00:00
Display clock
查看 时钟和时区 dis clock
Save
保存配置文件
Dir
查看保存配置文件
Reboot
重启switch
Reset saved-configuration
清除设备中的启动配置文件
Display version
在系统视图下查看设备版本信息
Display current-configuration
查看设备当前配置
Display interface brief
查看各个接口信息
Display current-configuration interface ethernet 0/0/1
查看 ethernet 0/0/1 接口下的配置命令
Display interface ethernet 0/0/1
查看 ethernet 0/0/1接口的详细信息
User-interface vty 0 4
进入虚拟终端
Authentication-mode (pasasword 0r aaa)
set authentication password (chipper:密文 or simple:明文 )
设置vty用户认证
User privilege level
设置用户权限User privilege level (0-15)
例如:选择vty 0 4 设置远程用户(ssh,telnet)可以用ssh和telnet 登录,密文为[email protected],用户权限为15
User-interface vty 0 4
Authentication mode password
Set authentication password cipher [email protected]
User privilege level 15
Protocol inbound all
配置aaa 只允许ssh登录
创建aaa用户 test
Local-user test password cipher [email protected]
Local-user test service-type ssh
Local-user test privilege level 15
Ssh user
将aaa用户 与ssh 关联
User-interface console 0
设置交换机登录密码qwe123
User-interface console 0
Authentication mode password
Set authentication password simple qwe123
设置用户test-dl 登录,test-dl 为aaa用户,密码为testdl
User-interface console 0
用户登录超时设置
Idle-timeout 分钟 秒
例如:设置用户登录超时的时间为30分钟,默认的为十分钟
Observe-port port-mirroring
二层交换机镜像配置
例如:将ethernet 0/0/1 配置为端口镜像管理口,将端口eth0/0/1加入observe-port 1里面进行监控
Observe-port 1 int g0//0/20
Int eth 0/0/1
Port-mirroring to observe-port 1 both
Display port-mirroring
查看镜像端口
Speed duplex
设置接口速率和双工模式
Switch mac地址学习
交换机属于二层设备-数据链路层-帧-mac
了解到 二层交换机通信是转发端口mac地址 跟IP没关系
意思就是二层交换机也只能学习到每个端口的mac地址
学习mac的方式
如果两台终端通过交换机通信了,那交换机是肯定学习到了mac地址
可以用 display mac-address 查看学习到的mac地址表
这种方式是属于动态学习,synamic
可以在交换机中静态配置mac地址
可以通过这条命令配置静态mac地址表
Mac-address static mac地址 接口 所属vlan
静态配置的优先级是最高的
交换机学习mac地址老化时间配置
华为交换机默认的交换机学习mac地址的老化时间为300秒
Mac-address aging-time 500
将老化时间改为500秒
如果改为 mac-address aging-time 0 说明学习到的mac永久保存
关闭信息中心提示
Undo info-center enable
Vlan 配置
创建vlan
备注vlan
查看 vlan dis vlan
将交换机端口加入vlan
将端口ethernet 0/0/1这个端口加入到vlan10里面
进入vlan接口里面 ,添加端口
进入端口里面,添加vlan
Truck
配置 truck 链路
进入接口视图,允许所有vlan通过
Port link-type truck
Port truck allow-pass vlan all
Hybrid 端口介绍
它的功能很全,即可用作终端接口,也可用作交换机互连端口
就一个特殊作用,在vlan间可通信的前提下,它可自动决定哪些vlan之间可以相互通信
就是在配置hybrid时可以允许打一个tagged,也就是在这个接口下可以设置放行vlan流量。
Display vlan 查看
Display 可以查看所有vlan
Display vlan id
可以查看某个vlan信息
Display vlan id verbose
查看某个vlan的信息详细
Statistics enable 代表vlan流量统计开启
Display vlan summary 可以查看vlan总数和具体vlan编号