资源描述
,单击此处编辑母版标题样式,单击此处编辑母版文本样式,第二级,第三级,杭州华三通信技术有限公司,命令行操作基础,可以通过,Console,、,AUX,、,Telnet,和,SSH,多种途径,搭建网络设备配置环境,H3C Comware,在上述配置方法中使用的命令行采用了配置权限的分级控制,引入,掌握配置网络设备的基本方法,掌握分级命令行的使用方法,掌握网络设备的常用配置命令,课程目标,学习完本课程,您应该能够:,配置网络设备的方法,命令行使用入门,常用的命令,配置远程登录,目录,访问网络设备命令行接口的方法,通过,Console,口本地访问,通过,AUX,口远程访问,使用,Telnet,终端访问,使用,SSH,终端访问,通过异步串口访问,使用,Console,口进行连接,路由器和交换机的,Console,口用户默认拥有最大的权限,可以执行一切操作和配置,Console,线缆,Router/Switch,终端,Console,口,串口,创建新连接,选择,COM,口,设置属性参数,进入设备配置界面,使用,AUX,口进行连接,在这种配置环境中,用户字符端通过,PSTN,建立拨号连接,接入到网络设备的,AUX,口上。,Router/Switch,终端,PSTN,Modem,Modem,AUX,口,串口,使用,Telnet,进行连接,telnet,的先决条件,客户端与网络设备之间必须具有,IP,可达性,网络设备必须配置一定的,Telnet,验证信息,包括用户名、口令等,中间网络必须允许,TCP,和,Telnet,协议报文通过,主机,Router/Switch,IP,网络,Telnet,客户端,Telnet,服务器,网络接口,网络接口,SSH,介绍,SSH,(,Secure Shell,,安全外壳)在无安全保证的网络上提供安全的远程登录等服务,由传输协议、验证协议和连接协议三部分组成,使用,TCP,端口,22,,一台设备支持多个,SSH,客户端连接,提供,Password,(用户名,/,密码验证)和,Publickey(,密钥对验证,),两种验证方式,PSTN/ISDN,主机,Router/Switch,IP,网络,SSH,客户端,SSH,服务器,配置网络设备的方法,命令行使用入门,常用的命令,配置远程登录,目录,命令行简介,用户登录到路由器出现命令行提示符后,即进入命令行接口,CLI,(,Command Line Interface,),命令行接口是用户与路由器进行交互的常用工具。,命令行接口,通过命令行接口输入命令,用户可以对路由器进行配置和管理。,命令级别,为了设备的安全性,系统将命令进行分级管理,设备管理员可以为不同的用户设置与命令级别相对应的用户级别,从而实现对各个用户的访问权限的限制。,命令视图,命令行接口分为若干个命令视图,所有命令都注册在某个(或某些)命令视图下。通常情况下,必须先进入命令所在的视图才能执行该命令,命令行简介,命令视图,用户视图,设备启动后的缺省视图,可查看启动后基本运行状态和统计信息,系统视图,配置系统全局通用参数的视图,路由协议视图,配置路由协议参数的视图,接口视图,配置接口参数的视图,用户界面视图(,user-interface view,),配置登陆设备的各个用户属性的视图;如,console,、,AUX,、,TTY,、,VTY(,最多支持,5,个,),各种视图之间的关系,用户视图,用户界面视图,接口视图,路由协议视图,VLAN,视图,用,或,return,命令可以从任意视图直接回到用户视图,以任意方式登录命令行,system-view,quit,user-interface,命令,quit,interface,命令,quit,router,命令,quit,vlan,命令,quit,系统视图,使用命令视图,*,*,Copyright(c)2004-2007 Hangzhou H3C Tech.Co.,Ltd.All rights reserved.*,*Without the owners prior written consent,*,*no decompiling or reverse-engineering shall be allowed.*,*,User interface con0 is available.,Please press ENTER.,%Apr 22 16:44:16:802 2008 H3C SHELL/4/LOGIN:Console login from con0,system-view,System View:return to User View with Ctrl+Z.,H3Cinterface GigabitEthernet 0/0,H3C-GigabitEthernet0/0description to_MyPC,H3C-GigabitEthernet0/0ip add 192.168.0.1 255.255.255.0,H3C-GigabitEthernet0/0quit,H3Cuser-interface vty 0 4,H3C-ui-vty0-4authentication-mode scheme,命令级别,访问级(,0,级),网络诊断工具命令(,ping/tracert,)、从本设备出发访问外部设备的命令,(telnet),监控级(,1,级),用于系统维护、业务故障诊断的命令,(display/debugging),系统级(,2,级),业务配置命令,管理级(,3,级),关系到系统基本运行,系统支撑模块的命令,用户级别,用户级别,允许使用的命令级别,0,访问级,1,访问级、监控级,2,访问级、监控级、系统级、,3,访问级、监控级、系统级、管理级,系统对登录用户划分为,4,个等级,某级别的用户登录后,只能使用等于或低于自己级别的命令,命令行帮助特性,?,User view commands:,backup Backup next startup-configuration file to TFTP server,boot-loader Set boot loader,bootrom Update/read/backup/restore bootrom,cd Change current directory,clock Specify the system clock,copy Copy from one file to another,debugging Enable system debugging functions,delete Delete a file,dialer Dialer disconnect,dir List files on a file system,display Show running system information,fixdisk Recover lost chains in storage device,format Format the device,free Clear user terminal interface,ftp Open FTP connection,graceful-restart Restart LDP protocol,language-mode Specify the language environment,license Software license information,-More-,Sysname interface vlan?,VLAN interface number,Sysname interface vlan 1?,命令行帮助特性(续),di?,dialer,dir,display,dis?,display,dis,display,display v?,version,virtual-access,vlan,voice,voiceboard,vrrp,display ver?,version,display ver?,此处按下,键可以补全命令,错误提示信息,Routerdi,%Ambiguous command found at position.,Routerdispaly,%Unrecognized command found at position.,Routerdisplay,%Incomplete command found at position.,Router display interface gigabitethernet 0/0 0,%Too many parameters found at position.,Routerdisplay interface gigabitethernet 0/0/0,%Wrong parameter found at position.,Router,命令行历史记录功能,查看历史命令记录,默认只能显示,10,条,最多支持,256,条命令,翻阅和调出历史记录中的某一条命令,用,或,快捷键调出上一条历史命令,用,或,快捷键调出下一条历史命令,history-command max-size,命令用来设置当前用户界面历史命令缓冲区的容量。,undo,history-command max-size,命令用来恢复缺省情况,display history-command,命令行历史记录功能,配置实例,H3Cdisplay history-command,sys,display history-command,interface Ethernet 0/0,quit,H3Cuser-interface console 0,H3C-ui-console0history-command max-size?,INTEGER The size of command history record buffer,H3C-ui-console0history-command max-size 20,命令行编辑功能,每条命令最长为,256,个字符,按键,功能,普通字符键,若编辑缓冲区未满,则插入到当前光标位置,并向右移动光标,删除光标位置的前一个字符,光标前移,或,光标向左移动一个字符位置,或,光标向右移动一个字符位置,将光标移动到当前行的开头,将光标移动到当前行的末尾,删除当前光标所在位置的字符,删除光标左侧连续字符串内的所有字符,删除光标所在位置及其右侧连续字符串内的所有字符,将光标移动到左侧连续字符串的首字符处,将光标向右移到下一个连续字符串之前,删除光标左侧所有的字符,删除光标右侧所有的字符,分页显示,本页未显示完,还有下一页,display interface,Aux0 current state:DOWN,Line protocol current state:DOWN,Description:Aux0 Interface,The Maximum Transmit Unit is 1500,Hold timer is 10(sec),Internet protocol processing:disabled,Link layer protocol is PPP,LCP initial,Output queue:(Urgent queuing:Size/Length/Discards)0/50/0,Output queue:(Protocol queuing:Size/Length/Discards)0/500/0,Output queue:(FIFO queuing:Size/Length/Discards)0/75/0,Physical layer is asynchronous,Baudrate is 9600 bps,Phy-mru is 1700,Last clearing of counters:Never,Last 300 seconds input rate 0.00 bytes/sec,0 bits/sec,0.00 packets/sec,Last 300 seconds output rate 0.00 bytes/sec,0 bits/sec,0.00 packets/sec,Input:0 packets,0 bytes,0 broadcasts,0 multicasts,0 errors,0 runts,0 giants,-More-,:继续显示下一屏信息,:继续显示下一行信息,:停止显示和命令执行,配置网络设备的方法,命令行使用入门,常用的命令,配置远程登录,目录,常用设备管理命令,配置设备名称,配置系统时间,显示系统时间,配置欢迎/提示信息,H3Csysname?,TEXT Host name(1 to 30 characters),clock datetime?,TIME Specify the time(HH:MM:SS),H3Cheader?,incoming Specify the banner of the terminal user-interface,legal Specify the legal banner,login Specify the login authentication banner,motd Specify the banner of today,shell Specify the session banner,display clock,显示特性,所有的命令行有共同的显示特性,并且可以根据用户的需求,灵活构建显示方式。,NE80E/40E,的命令行接口提供如下显示特性:提示信息和帮助信息提供中、英文两种语言显示。可以通过,language-mode language-name,命令切换语言模式。,键入,:,停止显示和命令执行。,说明:也可以键入除空格键、回车键等的其他键停止显示和命令执行,键入空格键,:,继续显示下一屏信息。,键入回车键,:,继续显示下一行信息。,常用信息查看命令,查看版本信息,查看当前配置,显示接口信息,显示接口IP状态与配置信息,显示系统运行统计信息,display version,display current-configuration,display ip interface brief,display interface,display diagnostic-information,常用信息查看命令,保存当前配置,查看已保存的配置,删除已保存的配置文件,重新启动设置,删除某一条特定的命令,undo,save *.cfg,display saved-configuration,reboot,reset saved-configuration,wntundo sysname,配置网络设备的方法,命令行使用入门,常用的命令,配置远程登录,目录,路由器,Telnet,服务配置命令,配置与网络相连端口的,IP,地址,使能,Telnet,服务器端功能,进入,vty,用户界面视图,设置验证方式,H3Ctelnet server enable,H3C-ethernet0/0ip address,ip-address,mask,|,mask-length,H3Cuser-interface vty,first-num2,last-num2,H3C-ui-vty0authentication-mode none|password|scheme,路由器,Telnet,服务配置命令(续),设置登录密码和用户级别,创建用户、配置密码、设置服务类型、设置用户级别,H3C-ui-vty0set authentication password cipher|simple,password,H3C-ui-vty0user privilege level,level,H3Clocal-user,username,H3C-luser-xxx password cipher|simple,password,H3C-luser-xxx service-type telnet,H3C-luser-xxx level,level,Telnet,配置例子,RTA,system-view,H3Ctelnet server enable,H3Cinterface ethernet0/0,H3C-ethernet0/0ip address 192.168.0.254 24,H3Cuser-interface vty 0,H3C-ui-vty0set authentication password cipher 123456,H3C-ui-vty0user privilege level 2,PCA,IP,地址:,192.168.0.1,子网掩码:,255.255.255.0,Telnet,客户端,Telnet,服务器,G0/0,用,Telnet,登录,Microsoft Windows XP,版本,5.1.2600,(C),版权所有,1985-2001 Microsoft Corp.,C:Documents and Settingsusertelnet 192.168.0.254,*,*Copyright(c)2004-2007 Hangzhou H3C Tech.Co.,Ltd.All rights reserved.*,*Without the owners prior written consent,*,*no decompiling or reverse-engineering shall be allowed.*,*,Login authentication,Password:,输入密码,路由器,SSH,服务配置命令,使能,SSH,服务器功能,配置,SSH,客户端登录时的用户界面,配置,SSH,用户,H3C ssh server enable,H3C-ui-vty0-4authentication-mode scheme,H3C-ui-vty0-4protocol inbound ssh,H3Clocal-user,username,H3C-luser-xxx password cipher|simple,password,H3C-luser-xxx service-type ssh,H3C-luser-xxx level,level,路由器,SSH,服务配置命令(续),生成,RSA,密钥,导出,RSA,密钥,销毁,RSA,密钥,H3Cpublic-key local create rsa,H3C public-key local export rsa ssh2,H3C public-key local destroy,rsa,SSH,配置例子,RTA,H3Cpublic-key local create rsa,H3Cinterface gigabitethernet0/0,H3C-GigabitEthernet0/0ip address 192.168.0.254 255.255.255.0,H3Cssh server enable,H3Cuser-interface vty 0 4,H3C-ui-vty0-4authentication-mode scheme,H3C-ui-vty0-4protocol inbound ssh,H3Clocal-user sshclient,H3C-luser-sshclientpassword simple abc,H3C-luser-sshclientservice-type ssh,H3C-luser-sshclientlevel 3,PCA,IP,地址:,192.168.0.1,子网掩码:,255.255.255.0,运行,SSH,客户端软件,SSH,客户端,SSH,服务器,G0/0,启动,SSH,客户端,登录网络设备,支持,Console,口本地配置、,AUX,口本地或远程配置、,Telnet,或,SSH,本地或远程配置,命令行提供多种命令视图,系统命令行采用分级保护方式,命令行划分为访问级、监控级、系统级、管理级,4,个级别,本章总结,
展开阅读全文