当前位置:文档之家› Juniper+CLI基本配置(小结)

Juniper+CLI基本配置(小结)

CLI配置:操作模式进入和退出操作模式:下面的例子显示了使用用户名root登陆到路由器进入到操作模式login: rootPassword:Last login: Wed Nov 28 18:40:03 from 192.168.161.250--- JUNOS 5.0R2.4 built 2001-09-25 02:34:13 UTCroot@52network>Exit the operational mode by using the quit command:root@52network> quit52network (ttyd0)login:设置CLI:1. set cli命令:root@52network> set CLI ?Possible completions:complete-on-space Toggle word completion on spaceidle-timeout Set the CLI maximum idle timeprompt Set the CLI command prompt stringrestart-on-upgrade Set CLI to prompt for restart after a software upgrade screen-length Set number of lines on screenscreen-width Set number of characters on a lineterminal Set terminal type2.set CLI complete-on-space这个命令将允许自动完成命令,语法如下:set CLI complete-on-space <on|off>例子:root@52network> show p^'p' is ambiguous.Possible completions:pfe Show packet forwarding engine datapim Show information about PIMpolicy Show policy informationroot@52network> show po<space>root@52network> show policy3.set CLI idle-timeout设置CLI会话空闲时的最大时间语法:set CLI idle-timeout <timeout> (0-100000 minutes)例子:root@52network> set CLI idle-timeout 1Idle timeout set to 1 minuteroot@52network> Warning: session will be closed in 10 seconds if there is no activityIdle timeout exceeded: closing session4.set CLI prompt设置cli会话操作模式下的提示符语法:set cli prompt <cli-prompt>例子:root@52network>set cli prompt newpromptnewprompt>5.set CLI restart-on-upgrade设置当软件更新完成,将提示去重新启动路由器,默认打开语法:set CLI restart-on-upgrade <on|off>6.set CLI screen-length and screen-width设置cli屏幕长度和宽度语法:set CLI screen-length <length> Number of lines on screen (0..100000) set CLI screen-width <width> Number of characters on a line (0..100000) 例子:root@52network> set CLI screen-length 2Screen length set to 2root@52network> set CLI screen-width 5Screen width set to 57. set CLI terminal设置路由器的终端类型root@52network> set CLI terminal ?Possible completions:ansi ANSI-compatible terminalsmall-xterm Small (24 line) xterm windowvt100 VT100-compatible terminalxterm Large (65 line) xterm window7. set date设置时间语法:set date <time> New date and time (YYYYMMDDhhmm.ss)例子:root@52network> set date 200202171448.00Sun Feb 17 14:48:00 UTC 20028. 操作模式中的基本操作:Function Keyboard SequenceMove cursor back one character Ctrl-bMove cursor forward one character Ctrl-fMove cursor to beginning of line Ctrl-aMove cursor to end of line Ctrl-eDelete character before the cursor Ctrl-h, Delete, Backspace Delete character the cursor is on Ctrl-dDelete word before cursor Ctrl-w, Esc-Backspace, Alt-Backspace Insert most recently deleted text at the cursor Ctrl-yRedraw the current line Ctrl-lScroll backward through history Ctrl-pScroll forward through history Ctrl-nSearch CLI history in reverse order Ctrl-rMove cursor back one word Esc-b or Alt-bMove cursor forward one word Esc-f or Alt-fDelete the word after the cursor Esc-d, Alt-dSearch CLI history Esc-/Specify the number of times to execute a key-board sequence (number from one to nine)Esc-number sequence, Alt-number sequence9. cli注释信息:root@52network> show con^'con' is ambiguous.(命令不完整)root@52network> set CLI^syntax error, expecting <command>(语法错误)10.控制cli输出信息:1.显示输出:root@52network> show configurationversion 5.0R3.3;system {host-name 52network;login {user test {uid 2001;class superuser;authentication {encrypted-password "$Upc0"; # SECRET-DATA}}user root {uid 2000;class superuser;authentication {encrypted-password "0"; # SECRET-DATA---(more)---定制输出信息使用管道参数:这个参数可以帮助在一个大的文件中快速的找到制定的信息root@52network> show configuration | ?Possible completions:count Count occurrencesdisplay Display additional informationexcept Show only text that does not match a patternfind Search for the first occurrence of a patternhold Hold text without exiting the --More-- prompt match Show only text that matches a patternno-more Don't paginate outputresolve Resolve IP addressessave Save output text to a filetrim Trim specified number of columns from start of line 2.过滤输出信息1. count:显示文件或列表行数语法:show route protocol isis | count例子:root@52network> show configuration | countCount: 143 linesroot@52network> show route protocol isis | countCount: 59 lines2.display:display命令提供显示输出xml格式语法:show configuration | display xml例子:root@52network> show configuration | display xml | find interfaces <interfaces><interface><name junos:key="key">fxp0</name><speed>100m</speed><link-mode>full-duplex</link-mode><unit><name junos:key="key">0</name><encapsulation>802.3-llc</encapsulation><family><inet><address><name junos:key="key">192.168.161.16/24</name></address></inet></family></unit></interface></interfaces></configuration></rpc-reply>3.except:此参数设置显示输出信息不包含指定信息语法:show configuration | except <pattern> pattern to avoid例子:root@52network> show configurationversion 5.0R3.3;system {host-name 52network;login {user test {uid 2001;class superuser;authentication {encrypted-password "$1$A"; # SECRET-DATA }}user root {uid 2000;class superuser;authentication {encrypted-password "niG0"; # SECRET-DATAroot@52network> show configuration | except uidversion 5.0R3.3;system {host-name 52network;login {user test {class superuser;authentication {encrypted-password "$1$A"; # SECRET-DATA}}user root {class superuser;authentication {encrypted-password "niG0"; # SECRET-DATA4.find 和match命令find查找指定信息,并且显示所有相似信息match查找指定信息,并且只显示此指定信息语法:show route | find <pattern> pattern to search forshow route | match <pattern> pattern to match against例子:root@52network> show route | find 192.168.161.0192.168.161.0/24 *[Direct/0] 3d 02:05:58> via fxp0.0192.168.161.16/32 *[Local/0] 3d 02:05:58Localroot@52network> show route | match 192.168.161.0192.168.161.0/24 *[Direct/0] 3d 02:06:085.holdhold参数设置通过up和down翻动查看文件。

相关主题