ensp命令练习
1交换机的基本配置
1.1交换机
用户视图 进入 系统视图
<Huawei>system-view //用户视图 [Huawei] //系统视图
修改交换机的名字
<Huawei>system-view //用户视图 [Huawei]sysname switch //修改名字为 switch [switch]
关闭终端日志提示
[switch]quit //退出到用户视图 <switch>undo terminal monitor //系统视图
进入接口视图
<switch>system-view //进入系统视图 [switch]interface GigabitEthernet 0/0/1 //进入接口视图 [switch-GigabitEthernet0/0/1]
进入接口视图 禁用接口
<switch>system-view //进入系统视图 [switch]interface GigabitEthernet 0/0/1 //进入接口视图 [switch-GigabitEthernet0/0/1]shutdown //禁用接口GE0/0/1
进入接口视图 启用接口
<switch>system-view //进入系统视图 [switch]interface GigabitEthernet 0/0/1 //进入接口视图 [switch-GigabitEthernet0/0/1]undo shutdown //启用接口GE0/0/1
进入系统视图 进入console口 管理交换机
<switch>system-view //进入系统视图 [switch]user console 0 //进入console口 [switch-ui-console0]
进入系统视图 进入console口 配置交换机密码
<switch>system-view //进入系统视图 [switch]user console 0 //进入console口 [switch-ui-console0]authentication-mode password //进入身份模式 [switch-ui-console0]set authentication password cipher 123 //设置进去交换机的密码为 123 [switch-ui-console0]
进入系统视图 进入console口 配置交换机的超时保护时间
<switch>system-view //进入系统视图 [switch]user console 0 //进入console口 [switch-ui-console0]idle-timeout 1440 //设置
进入系统视图 进入console口 退出console
Ctrl + Z 快捷键,表示退出
<switch>system-view //进入系统视图 [switch]user console 0 //进入console口 [switch-ui-console0]quit //退出 [switch]return //退出 <switch>
重启
<switch>reboot //重启 Info: The system is now comparing the configuration, please wait. Warning: All the configuration will be saved to the configuration file for the n ext startup:, Continue?[Y/N]: Y // 输入y 确认重启
保存
<switch>save //保存 The current configuration will be written to the device. Are you sure to continue?[Y/N] y //输入Y 确认保存 Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]: Now saving the current configuration to the slot 0. Save the configuration successfully. <switch>
恢复出厂设置
<switch>reset saved-configuration // 恢复出厂设置 Warning: The action will delete the saved configuration in the device. The configuration will be erased to reconfigure. Continue? [Y/N]:y //确认恢复出厂设置输入Y Warning: Now clearing the configuration in the device. Info: Succeeded in clearing the configuration in the device. <switch>reboot // 重启 见效果 <Huawei> // 恢复完成
查看交换机 信息
<Huawei>display version // 查看交换机信息 Huawei Versatile Routing Platform Software VRP (R) software, Version 5.110 (S5700 V200R001C00) Copyright (c) 2000-2011 HUAWEI TECH CO., LTD Quidway S5700-28C-HI Routing Switch uptime is 0 week, 0 day, 0 hour, 2 minutes <Huawei>
查看当前有效配置
<Huawei>display current-configuration //查看当前有效配置 # sysname Huawei //交换机名 # cluster enable ntdp enable ndp enable # drop illegal-mac alarm # diffserv domain default # drop-profile default # aaa authentication-scheme default authorization-scheme default accounting-scheme default domain default domain default_admin local-user admin password simple admin local-user admin service-type http # interface Vlanif1 # interface MEth0/0/1 # interface GigabitEthernet0/0/1 # interface GigabitEthernet0/0/2 # interface GigabitEthernet0/0/3 # interface GigabitEthernet0/0/4 # interface GigabitEthernet0/0/5 # interface GigabitEthernet0/0/6 # interface GigabitEthernet0/0/7 # interface GigabitEthernet0/0/8 # interface GigabitEthernet0/0/9 # interface GigabitEthernet0/0/10 # interface GigabitEthernet0/0/11 # interface GigabitEthernet0/0/12 # interface GigabitEthernet0/0/13 # interface GigabitEthernet0/0/14 # interface GigabitEthernet0/0/15 # interface GigabitEthernet0/0/16 # interface GigabitEthernet0/0/17 # interface GigabitEthernet0/0/18 # interface GigabitEthernet0/0/19 # interface GigabitEthernet0/0/20 # interface GigabitEthernet0/0/21 # interface GigabitEthernet0/0/22 # interface GigabitEthernet0/0/23 # interface GigabitEthernet0/0/24 # interface NULL0 # user-interface con 0 user-interface vty 0 4 # return <Huawei>
2远程交换机
进入虚拟接口lvanif1 进行配置
2.1 配置lsw1
进入用户视图 lsw1
<Huawei>system-view //进入用户视图 [Huawei]sysname lsw1 //修改名字为 lsw1
关闭终端日志提示
[lsw1]quit //退出 <lsw1>undo terminal monitor //关闭日志提示
进入vlan 1 口 配置 交换机的ip
[lsw1]interfave vlan 1 //进入虚拟的vlanif1 口 进行配置的ip及子网掩码 [lsw1-Vlanif1]ip address 192.168.1.1 255.255.255.0 [lsw1-Vlanif1]quit //退出
管理远程 配置vty 接口
vty是虚拟终端 是一种网络远程设备链接的方式
vty 0 4 表示同时打卡5 个回话
[lsw1]user vty 0 4 //进入远程登录的视图
配置远程访问 密码
[lsw1-ui-vty0-4]set authentication password cipher Taren1 //配置远程访问的密码
配置远程访问 权限
一共1-15个等级
0 参观, ping tracert tenlet quit
1 监控 ,0级命令 reboot reset undo debugging
2, 系统配置 0,1级命令 所有配置命令(管理及命令除外)
3-15管理, 所有命令
[lsw1-ui-vty0-4]user privilege level 3 //设置权限级别 默认0 级 [lsw1-ui-vty0-4]return //返回用户视图 <lsw1>save //保存
2.2配置pc(交换机)lsw2
<Huawei>system-view //进入系统视图 Enter system view, return user view with Ctrl+Z. [Huawei]sysname lsw2 //修改名字 [lsw2]quit // 退出
关闭终端日志提示
<lsw2>undo terminal monitor //关闭日志提示 Info: Current terminal monitor is off. <lsw2>system-view //进入用户视图 Enter system view, return user view with Ctrl+Z.
进入vlan 1 口 配置 交换机的ip
[lsw2]inter vlan 1 //进入虚拟的vlanif1 [lsw2-Vlanif1]ip address 192.168.1.2 255.255.255.0 //进行配置的ip及子网掩码 [lsw2-Vlanif1]return
通过telnet 输入lsw1 的ip
<lsw2>telnet 192.168.1.1 //输入lsw1 的ip Trying 192.168.1.1 ... Press CTRL+K to abort Connected to 192.168.1.1 ... Login authentication Password: //输入密码 进入lsw1 Info: The max number of VTY users is 5, and the number of current VTY users on line is 1. The current login time is 2022-09-10 14:07:10.
通过lsw2 远程 管理lsw1 并修改lsw1 的名字为 gei
Info: The max number of VTY users is 5, and the number of current VTY users on line is 1. The current login time is 2022-09-10 14:07:10. <lsw1>sys Enter system view, return user view with Ctrl+Z. [lsw1]sysname gei //修改lsw1 的名字为 gei [gei]
3远程路由器
基于上面远程交换机的基础
路由器的配置的在实接口GigabitEthernet 0/0/1 进行配置
3.1 配置ar1
进入用户视图 ar1
<Huawei>system-view //进入用户视图 [Huawei]sysname ar1 //修改名字为 ar1 [ar1]
关闭终端日志提示
[ar1]quit //退出 <ar1>undo terminal monitor //关闭日志提示
进入interface GigabitEthernet0/0/1配置 交换机的ip
[ar1]interface GigabitEthernet 0/0/1 [ar1-GigabitEthernet0/0/1]ip address 192.168.1.254 255.255.255.0 [ar1-GigabitEthernet0/0/1]quit
管理远程 配置vty 接口
vty是虚拟终端 是一种网络远程设备链接的方式
vty 0 4 表示同时打卡5 个回话
[ar1]user-inter vty 0 4 //进入远程登录的视图
配置远程访问 密码
[ar1-ui-vty0-4]set authentication password cipher Taren1 //配置远程访问的密码
配置远程访问 权限
一共1-15个等级
0 参观, ping tracert tenlet quit
1 监控 ,0级命令 reboot reset undo debugging
2, 系统配置 0,1级命令 所有配置命令(管理及命令除外)
3-15管理, 所有命令
[ar1-ui-vty0-4]user privilege level 3 //设置权限级别 默认0 级 [ar1-ui-vty0-4]return //返回用户视图 <ar1>save //保存
查看路由表
<AR1>display ip routing-table //查看路由表 Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 7 Routes : 7 Destination/Mask Proto Pre Cost Flags NextHop Interface 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.1.0/24 Direct 0 0 D 192.168.1.254 GigabitEthernet 0/0/1 192.168.1.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 <AR1>
2.2配置pc(交换机)lsw2
<Huawei>system-view //进入系统视图 Enter system view, return user view with Ctrl+Z. [Huawei]sysname lsw2 //修改名字 [lsw2]quit // 退出
关闭终端日志提示
<lsw2>undo terminal monitor //关闭日志提示 Info: Current terminal monitor is off. <lsw2>system-view //进入用户视图 Enter system view, return user view with Ctrl+Z.
进入vlan 1 口 配置 交换机的ip
[lsw2]inter vlan 1 //进入虚拟的vlanif1 [lsw2-Vlanif1]ip address 192.168.1.2 255.255.255.0 //进行配置的ip及子网掩码 [lsw2-Vlanif1]return
通过telnet 输入lsw1 的ip
<lsw2>telnet 192.168.1.1 //输入ar1 的ip Trying 192.168.1.1 ... Press CTRL+K to abort Connected to 192.168.1.1 ... Login authentication Password: //输入密码 进入ar1 Info: The max number of VTY users is 5, and the number of current VTY users on line is 1. The current login time is 2022-09-10 14:07:10.
通过lsw2 远程 管理lsw1 并修改lsw1 的名字为 AR1
Info: The max number of VTY users is 5, and the number of current VTY users on line is 1. The current login time is 2022-09-10 14:07:10. <ar1>sys Enter system view, return user view with Ctrl+Z. [ar1]sysname AR1 //修改lsw1 的名字为 AR1 [AR1]