一、基础命令
1.快捷键使用表:
快捷键 | 缺省绑定的功能或命令 |
CTRL_A | 表示将光标移动到当前行的开头 |
CTRL_B | 表示将光标向左移动一个字符 |
CTRL_C | 表示停止当前正在执行的功能 |
CTRL_D | 表示删除当前光标所在位置的字符 |
CTRL_E | 表示将光标移动到当前行的末尾 |
CTRL_F | 表示将光标向右移动一个字符 |
CTRL_G | 相当于display current-configuration,表示显示当前配置 |
CTRL_H | 表示删除光标左侧的一个字符 |
CTRL_L | 表示显示IPv4路由表信息 |
CTRL_N | 表示显示历史缓冲区中的下一条命令 |
CTRL_O | undo debugging all,表示关闭所有功能项的调试开关 |
CTRL_P | 表示显示历史缓冲区中的上一条命令 |
CTRL_W | 表示删除光标左侧连续字符串内的所有字符 |
CTRL_X | 表示删除光标左侧所有的字符 |
CTRL_Y | 表示删除光标所在位置及其右侧所有的字符 |
CTRL_Z | 表示退回到用户视图 |
CTRL_] | 表示终止当前连接 |
ESC_B | 示将光标移动到左侧连续字符串的首字符处 |
ESC_D | 表示删除光标所在位置及其右侧连续字符串内的所有字符 |
ESC_F | 表示将光标向右移到下一个连续字符串之前 |
2.常见错误信息表:
英文错误信息 | 错误原因 |
% Incomplete command found at '^' position. | 符号“^”指示位置的参数输入不完整 |
% Ambiguous command found at '^' position. | 符号“^”指示位置的关键字不明确,存在二义性 |
% Too many parameters. | 输入参数太多 |
% Wrong parameter found at '^' position. | 在符号“^”指示位置的参数错误 |
% Unrecognized command found at '^' position. | 命令无法解析,符号“^”指示位置出错 |
3.命令使用
s
ystem-view //进入系统视图-该命令在用户视图下执行
[h3c]sysname ***** //修改设备名称
quit //从当前视图返回上一级视图-该命令可在任意视图下执行
return //返回用户视图-该命令可在任意的非用户视图下执行
reboot //重启设备(重启时注意保存设备配置)
reset saved-configuration //重置设备(重置后重启设备)
undo info-center enable //关闭信息中心
display interface brief //查看端口状态
display ip routing-table //查看IPV4路由表
display ip interface brief //查看接口配置IP信息
display clock //查看设备时间
dis version //查看设备版本信息
display device manuinfo //查看设备SN码、MAC地址、设备型号
display lldp neighbor-information list //查看设备邻居信息
display lldp neighbor-information verbose //查看详细设备邻居信息
dis transceiver interface GigabitEthernet 1/0/1 //查看端口光模块信息
display transceiver diagnosis int GigabitEthernet 1/0/1
//查看端口光功率
display this //查看当前配置-该命令可在任意视图下执行
display saved-configuration //查看已保存过的配置
display current-configuration //查看当前配置
display interface brief | exclude DOWN //查看接口UP信息
display interface brief | exclude IP //查看接口DOWN信息
save //保存当前配置
<H3C>display current-configuration > peizhi.txt
//用户视图下将当前配置文件保存到peizhi.txt文件内文件名取任意名
<H3C>more peizhi.txt //查看文件内容
<H3C>dir //查看设备文件
<H3C>clock datetime 19:00:00 01/05/2022
//修改设备时间格式为时:分:秒,月/日/年
如果修改时提示:
To manually set the system time, execute the clock protocol none comman d first.
使用命令display clock查看未修改成功则在系统视图配置
clock protocol none命令
• 配置实验
1. 单臂路由
1.1实验拓扑
1.2配置思路
路由器:
1. 配置子接口,子接口ID最好跟vlanID相同
2. 子接口封装终结vlanID
3. 子接口配置PC网关,及IP地址
交换机:
1. 配置vlan
2. 配置接口类型,上性为trunk下行为access,绑定放行相应vlanID
PC:
1. 配置IP地址及网关
1.3配置之信息
路由器:
<H3C>system-view
[H3C]interface GigabitEthernet0/1.10 //进入子接口
[H3C]ip address 192.168.1.1 255.255.255.0 //配置IP地址
[H3C]vlan-type dot1q vid 10 //封装终结vlan10
#
[H3C]interface GigabitEthernet0/1.20
[H3C]ip address 192.168.2.1 255.255.255.0
[H3C]vlan-type dot1q vid 20
交换机:
<H3C>system-view
[H3C]vlan 10
#
[H3C]vlan 20
#
[H3C]interface GigabitEthernet1/0/1 //上行口
[H3C]port link-type trunk
[H3C]undo port trunk permit vlan 1
[H3C]port trunk permit vlan 10 20
#
[H3C]interface GigabitEthernet1/0/2 //下行口
[H3C]port link-type access
[H3C]port access vlan 10
#
[H3C]interface GigabitEthernet1/0/3 //下行口
[H3C]port link-type access
[H3C] port access vlan 20
2.超级vlan(supervlan)
2.1实验拓扑
2.2配置思路
1. 交换机配置vlan
2. 配置父vlan即子vlan
3. 配置交换机二层接口
4. 配置交换机三层接口(vlanif,IP地址,arp代理开启)
5. 配置PC 、IP地址及网关
2.3配置信息
交换机:
<H3C>system-view
[H3C]vlan 10
#
[H3C]vlan 20
#
[H3C]vlan 30
#
[H3C]vlan 100
[H3C] supervlan //设置超级vlan
[H3C] subvlan 10 20 30 //添加子vlan
#
[H3C]interface Vlan-interface100
[H3C]ip address 100.1.1.1 255.255.255.0
[H3C]local-proxy-arp enable //开启ARP代理
#
[H3C]interface GigabitEthernet1/0/1
[H3C] port link-type access
[H3C] port access vlan 10
#
[H3C]interface GigabitEthernet1/0/2
[H3C] port link-type access
[H3C] port access vlan 20
#
[H3C]interface GigabitEthernet1/0/3
[H3C] port link-type access
[H3C] port access vlan 30
3.设备远程
3.1 密码认证
3.1.1 实验拓扑
3.1.2 配置思路
1. 设备命名,更换设备默认命名,方便识别不同设备
2. 配置互通,接口配置同网段IP地址可以互通
3. 开启telnet远程服务
4. 配置vty用户
5. 配置认证方式为密码认证
6. 绑定telnet服务
7. 设置用户权限等级
3.1.3 配置信息
R1:
<H3C>system-view
#
[H3C]sysname R1
#
[R1] telnet server enable
#
[H3C]interface GigabitEthernet0/0
[R1-GigabitEthernet0/0]ip address 12.1.1.1 255.255.255.0
[R1-GigabitEthernet0/0]quit
#
[H3C]user-interface vty 0 4 //配置vty用户
[R1-line-vty0-4]authentication-mode password //配置认证方式为密码认证
[R1-line-vty0-4]set authentication password simple 123456 //配置认证密码
[R1-line-vty0-4]protocol inbound telnet //绑定telnet服务
[R1-line-vty0-4]user-role level-15 //配置用户权限等级(0-15)
R2:
<H3C>system-view
#
R2]sysname R2
#
[R2interface GigabitEthernet0/0
[R2-GigabitEthernet0/0]ip address 12.1.1.2 255.255.255.0
3.2 AAA(账号+密码)认证
3.2.1 实验拓扑
3.2.2 配置思路
1. 设备命名,更换设备默认命名,方便识别不同设备
2. 配置互通,接口配置同网段IP地址可以互通
3. 开启telnet远程服务
4. 配置vty用户
5. 配置认证方式为账号+密码认证
6. 配置本地用户
7. 配置用户密码
8. 配置服务类型
9. 配置用户权限等级(0-15)
3.2.3 配置信息
R1:
<H3C>system-view
#
[R1]sysname R1
#
[R1] telnet server enable
#
[R1]interface GigabitEthernet0/0
[R1-GigabitEthernet0/0]ip address 12.1.1.1 255.255.255.0
[R1-GigabitEthernet0/0]quit
#
[R1]user-interface vty 0 4 //配置vty用户
[R1-line-vty0-4]authentication-mode scheme //配置认证方式为账号+密码认证
[R1-line-vty0-4]quit
#
[R1]local-user admin //配置本地用户
[R1-luser-manage-admin]password simple 123456 //配置用户密码
[R1-luser-manage-admin]service-type telnet //设置服务类型
[R1-luser-manage-admin]authorization-attribute user-role level-15 //配置用户权限等级(0-15)
R2:
<H3C>system-view
#
[H3C]sysname R2
#
[R2]interface GigabitEthernet0/0
[R2-GigabitEthernet0/0]ip address 12.1.1.2 255.255.255.0
3.3 ssh远程
3.3.1实验拓扑
3.3.2配置思路
1. 设备命名,更换设备默认命名,方便识别不同设备
2. 配置互通,接口配置同网段IP地址可以互通
3. 开启ssh远程服务
4. 配置vty用户
5. 配置认证方式为账号+密码认证
6. 配置本地用户
7. 配置用户密码
8. 配置服务类型
9. 配置用户权限等级(0-15)
10. 配置ssh服务用户认证为密码认证
3.3.3配置信息
R1:
<H3C>system-view
#
[H3C]sysname R1
#
[R1] ssh server enable
#
[R1]interface GigabitEthernet0/0
[R1-GigabitEthernet0/0]ip address 12.1.1.1 255.255.255.0
[R1-GigabitEthernet0/0]
#
[R1]user-interface vty 0 4 //配置vty用户
[R1-line-vty0-4]authentication-mode scheme //配置认证方式为账号+密码认证
[R1-line-vty0-4]quit
#
[R1]local-user admin //配置本地用户
[R1-luser-manage-admin]password simple 123456 //配置用户密码
[R1-luser-manage-admin]service-type ssh //设置服务类型
[R1-luser-manage-admin]authorization-attribute user-role level-15 //配置用户权限等级
#
[R1]ssh user admin service-type stelnet authentication-type password //配置ssh服务用户为密码认证
R2:
<H3C>system-view
#
[H3C]sysname R2
#
[R2]interface GigabitEthernet0/0
[R2-GigabitEthernet0/0]ip address 12.1.1.2 255.255.255.0
4.端口聚合(链路聚合)
4.1静态聚合
4.1.1 二层接口聚合
4.1.1.1 实验拓扑
4.1.1.2 配置思路
1.配置链路聚合组
2.本地端口加入聚合组
3.两个聚合组配置相同模式
4.1.1.3 配置信息
SW1:
<H3C>system-view
[H3C]sysname SW1
#
[SW1]vlan 10
#
[SW1]interface Bridge-Aggregation1 //创建二层聚合组
[SW1-Bridge-Aggregation1] port link-type trunk
[SW1-Bridge-Aggregation1] port trunk permit vlan 10
#
[SW1]interface Vlan-interface10
[SW1-Vlan-interface10]ip address 12.1.1.1 255.255.255.0
#
[SW1]interface GigabitEthernet1/0/1
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1 //加入至聚合组1
#
[SW1]interface GigabitEthernet1/0/2
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1 //加入至聚合组1
#
[SW1]interface GigabitEthernet1/0/3
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1 //加入至聚合组1
SW2:
<H3C>system-view
[H3C]sysname SW1
#
[SW2]vlan 10
#
[SW2]interface Bridge-Aggregation1
[SW2-Bridge-Aggregation1]port link-type trunk
[SW2-Bridge-Aggregation1]port trunk permit vlan 10
#
[SW1]interface Vlan-interface10
[SW1-Vlan-interface10]ip address 12.1.1.1 255.255.255.0
#
[SW1]interface GigabitEthernet1/0/1
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1
#
[SW1]interface GigabitEthernet1/0/2
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1
#
[SW1]interface GigabitEthernet1/0/3
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1
4.1.2 三层聚合
4.1.2.1 实验拓扑
4.1.2.2 配置思路
1.配置链路聚合组
2.本地端口加入聚合组
4.1.2.3 配置信息
R1:
<H3C>system-view
#
[H3C]sysname R1
#
[R1]int Route-Aggregation 1 //创建三层聚合组1
[R1-Route-Aggregation1]ip address 12.1.1.1 255.255.255.0 #
#
[R1]interface GigabitEthernet 0/0
[R1-GigabitEthernet0/0] port link-aggregation group 1 //加入聚合组1
#
[R1]interface GigabitEthernet 0/1
[R1-GigabitEthernet0/1] port link-aggregation group 1 //加入聚合组1
#
[R1]interface GigabitEthernet 0/2
[R1-GigabitEthernet0/2] port link-aggregation group 1 //加入聚合组1
R2:
<H3C>system-view
#
[H3C]sysname R2
#
[R2]int Route-Aggregation 1
[R2-Route-Aggregation1]ip address 12.1.1.2 255.255.255.0 #
#
[R2]interface GigabitEthernet 0/0
[R2-GigabitEthernet0/0] port link-aggregation group 1
#
[R2]interface GigabitEthernet 0/1
[R2-GigabitEthernet0/1] port link-aggregation group 1
#
[R2]interface GigabitEthernet 0/2
[R2-GigabitEthernet0/2] port link-aggregation group 1
4.2动态聚合
4.2.1 二层接口聚合
4.2.1.1 实验拓扑
4.2.1.2 配置思路
1.配置链路聚合组
2.本地端口加入聚合组
3.两个聚合组配置相同模式
4.2.1.3 配置信息
SW1:
<H3C>system-view
[H3C]sysname SW1
#
[SW1]vlan 10
#
[SW1]interface Bridge-Aggregation1 //创建二层聚合组
[SW1-Bridge-Aggregation1] port link-type trunk
[SW1-Bridge-Aggregation1] port trunk permit vlan 10
[SW1-Bridge-Aggregation1]link-aggregation mode dynamic
#
[SW1]interface Vlan-interface10
[SW1-Vlan-interface10]ip address 12.1.1.1 255.255.255.0
#
[SW1]interface GigabitEthernet1/0/1
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1 //加入至聚合组1
#
[SW1]interface GigabitEthernet1/0/2
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1 //加入至聚合组1
#
[SW1]interface GigabitEthernet1/0/3
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1 //加入至聚合组1
SW2:
<H3C>system-view
[H3C]sysname SW1
#
[SW2]vlan 10
#
[SW2]interface Bridge-Aggregation1
[SW2-Bridge-Aggregation1]port link-type trunk
[SW2-Bridge-Aggregation1]port trunk permit vlan 10
[SW2-Bridge-Aggregation1]link-aggregation mode dynamic
#
[SW1]interface Vlan-interface10
[SW1-Vlan-interface10]ip address 12.1.1.1 255.255.255.0
#
[SW1]interface GigabitEthernet1/0/1
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1
#
[SW1]interface GigabitEthernet1/0/2
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1
#
[SW1]interface GigabitEthernet1/0/3
[SW1-GigabitEthernet1/0/1]port link-aggregation group 1
4.2.2 三层聚合
4.2.2.1 实验拓扑
4.2.2.2 配置思路
1.配置链路聚合组
2.本地端口加入聚合组
4.2.2.3 配置信息
R1:
<H3C>system-view
#
[H3C]sysname R1
#
[R1]int Route-Aggregation 1 //创建三层聚合组1
[R1-Route-Aggregation1]ip address 12.1.1.1 255.255.255.0
[R1-Route-Aggregation1]link-aggregation mode dynamic
#
[R1]interface GigabitEthernet 0/0
[R1-GigabitEthernet0/0] port link-aggregation group 1 //加入聚合组1
#
[R1]interface GigabitEthernet 0/1
[R1-GigabitEthernet0/1] port link-aggregation group 1 //加入聚合组1
#
[R1]interface GigabitEthernet 0/2
[R1-GigabitEthernet0/2] port link-aggregation group 1 //加入聚合组1
R2:
<H3C>system-view
#
[H3C]sysname R2
#
[R2]int Route-Aggregation 1
[R2-Route-Aggregation1]ip address 12.1.1.2 255.255.255.0
[R2-Route-Aggregation1]link-aggregation mode dynamic
#
[R2]interface GigabitEthernet 0/0
[R2-GigabitEthernet0/0] port link-aggregation group 1
#
[R2]interface GigabitEthernet 0/1
[R2-GigabitEthernet0/1] port link-aggregation group 1
#
[R2]interface GigabitEthernet 0/2
[R2-GigabitEthernet0/2] port link-aggregation group 1