案例1:华为交换机根据IP查他对应的MAC地址和交换机端口
设备
核心交换机: 华为S5735S-S24T4S-A
VRP ® software, Version 5.170 (S5735 V200R019C10SPC500)
接入层交换机:华为S5720-28p-LI-AC
VRP ® software, Version 5.170 (S5720 V200R011C10SPC600
配置说明
华为交换机根据已知一个IP查他对应的MAC地址,
已知终端ip:192.168.1.11
1.首先在核心交换机上
dis arp | include 192.168.1.11
显示
IP ADDRESS MAC ADDRESS E XPIRE(M) TYPE INTERFACE VPN-INSTANCE VLAN 192.168.1.11 6xxx-9xxx-fxxx 12 D-0 GE0/0/11 Total:113 Dynamic:196 Static:0 Interface:4
找到ip:192.168.1.11对应mac地址为6xxx-9xxx-fxxx,查哪些IP已绑定的对应该的MAC地址
display current-configuration | include 192.168.1
2.然后找到对应接入层交换机
dis mac-address 6xxx-9xxx-fxxx
华为交换机常用配置命令
一、交换机常用命令
查看交换机运行的配置 " display current "
查看当前视图下配置生效的命令 dis this
查看arp路由表,即ip与mac的对应表 d arp
路由标筛选某个网段 "display arp | inclue 10.0.2.
disp arp | in 10.0.2"
查询交换机各端口学习到终端设备的物理地址 display mac-address
查看某端口下mac地址表项 display mac-address GigabitEthernet 0/0/X
"进入系统视图
sys进入,在系统视图下输入quit或者return返回用户视图" system-view 或者 sys 或者 system
进入某个接口 "interface GigabitEthernet 0/0/23
int g0/0/23"
设置接口的默认VLAN port default vlan 501
"设置端口工作模式
设置接口是access或者trunk" port link-type access/ trunk
关闭接口 shutdown
开启接口 undo shutdown
删除单个端口单个配置 "interface g0/0/1
display this
clear configuration interface Ethernet 0/0/1"
查看日志信息 "display trapbuffer
display logbuffer "
关闭所有警告信息 undo terminal monitor
开启/关闭信息中心 undo info-center enable
"display cpu-usage
display memory-usage
display alarm urgent
display device
display version
display interface Ethernet brief
display interface brief //查看端口闭开情况
display routing-table //查看路由信息
display interface description
display interface brief
display counters
display counters error
display counters rate
display ip interface"
华为交换机端口组设置
华为交换机如何进行端口批量设置
永久端口组:port-group name
临时端口组:port-group group-member
创建端口组1:port-group g1
将交换机端口1~24加入端口组1: group-member gigabitethernet 0/0/1 to gigabitethernet 0/0/24
group-member g 0/0/1 to g0/0/24
端口链路类型访问: port link-type access
将端口组加入vlan 301: port default vlan 301
临时端口组
sy
system-view
port-group cjw.com
port linke-type access
port default vlan 100
qu
dis vlan
dis cu
undo port-group cjw.com
port-group group-member g0/0/1 to g0/0/24
port default vlan1
port
port linke-type access
port default vlan 300
interface g
interface GigabitEnthernet 0/0/2
port linke-type access
interface GigabitEthernet 0/0/1
port-isolate enable
华为交换机终端重置
重置console密码
恢复出厂态默认console密码是admin@huawei.com
掉电重启,界面显示Press Ctrl+B or Ctrl+E to enter BootROM menu …时按Ctrl+B
输入密码admin@huawei.com
进入BootROM MENU
选择7.Clear password for console user
提示Note: Clear password for console user? Yes or No(Y/N):
输入y确认
再次显示BootROM MENU
选择1.Boot with default mode重启设备,再登陆不需要密码
<HUAWEI>sys #进入系统管理视图(system-view)
[HUAWEI]user-interface console 0 #进入console控制模式
[HUAWEI-ui-console0]authentication-mode password #工作模式为密码模式
[HUAWEI-ui-console0]set authentication password cipher mima123 #设置console密码为可逆向解码模式,密码为mima123
[HUAWEI-ui-console0]quit #退出console模式(q)
[HUAWEI]q #退出系统视图
<HUAWEI>save #保存配置
验证是否成功:
<HUAWEI>q #先退出登录
Password:输出以上配置的密码可以成功登陆
配置telnet登陆
<HUAWEI>sys 进入系统视图
[HUAWEI]telnet server enable #开启telnet权限
[HUAWEI]user-interface maximum-vty 15 #设置虚拟用户最多15个同时在线(不同交换机规格不同,大多是是5个)
[HUAWEI]user-interface vty 0 4 #进入虚拟终端
[Huawei-ui-vty0-4]authentication-mode aaa #配置用户对终端接口的管理模式为aaa(aaa表示输入正确用户名密码才允许登陆,password表示输入正确密码可以登陆)
[HUAWEI-ui-vty0-4]protocol inbound telnet #添加协议池包含telnet(可以将telnet改成all,保证其他协议也会加入)
[Huawei-ui-vty0-4]q #退出虚拟终端
[HUAWEI]aaa #进入aaa管理模式
[HUAWEI-aaa]local-user goldencis password cipher huawei1234 #设置telnet登陆用户名为goldencis密码是huawei1234
[HUAWEI-aaa]local-user huawei privilege level 15 #设置用户权限级别
[HUAWEI-aaa]local-user goldencis service-type telnet 设置goldencis登陆服务类型
[HUAWEI-aaa]q #退出aaa模式
[HUAWEI]interface vlanif 1 #进入vlan1
[HUAWEI-Vlanif1]ip address 192.168.8.112 255.255.255.0 #配置vlan1的IP和子网掩码,不需要配置网关
验证配置是否生效
交换机连接外网,验证PC通过网线与交换机连接,PC上网正常。
PC通过网线与交换机连接(网络口即可),cmd命令行telnet 上一步设置的交换机维护IP,输入用户名密码登陆正常。
此时交换机可以通过telnet方式进行管理,不需要再连接串口了。
重置设置就完成啦!
如果交换机配置混乱无法理清,但知道console登陆密码,可以通过命令恢复出厂设置:
登陆交换机<HUAWEI>
<HUAWEI>reset saved-configuration
The configuration will be erased to reconfigure. Continue? [Y/N]:y
<HUAWEI>reboot
Warning: The configuration has been modified, and it will be saved to the next startup saved-configuration file . Continue? [Y/N]:n
System will reboot! Continue?[Y/N]:y
重启后有默认密码,华为默认密码一般为admin@huawei.com 再参照以上步骤重置console密码就可以啦