Juniper JUNOS系统维护常用命令

传统上,JUNOS提供了三组命令,协助负责网络运维以及网络巡检的工程师,对Juniper Networks路由器设备完成运作监控以及日常维护工作。我之所以强调“传统上”,是因为可能大部分人还习惯于使用某个show命令,然后记录系统状态输出结果的流程上面。而实际上,JUNOS还可以支持你使用operation (op) scripts来执行更为高效的网络排错以及网络管理。以后我会慢慢介绍关于JUNOSCRIPT的更多信息,今天我们先关注传统上的运维工具。JUNOS所提供的三组命令分别为:

  • nigel@junos> show chassis
  • nigel@junos> show system
  • nigel@junos> show log

其中,show chassis主要显示机箱上的各个部件如FPCs, PICs, 路由引擎(RE), 电源, 风扇(Cooling System)以及cFEB, SFM, SSB, SCB, FEB (需要注意的是它们均同样负责Juniper路由器的路由查询以及数据包交换转发工作,只是在不同型号的设备上的名称,具体功能细节以及转发速率有所不同而已) 的工作状态信息,偏向对Juniper路由器硬件方面的检查。而show log则用于查看JUNOS系统内部各种守护进程所产生的日志信息。而对于系统工作与软件进程维护而言,则主要show system命令。

查看JUNOS系统启动信息 | show system boot-messages

nigel@junos> show system boot-messages | find memory
real memory  = 133169152 (130048K bytes)
sio0: gdb debugging port
avail memory = 123105280 (120220K bytes)

使用导出符,可以从JUNOS系统启动信息中进一步查询当前JUNOS系统内安装的内存数量。

查看JUNOS系统存储状态 | show system processes storage

nigel@junos> show system storage | trim 35
Used      Avail  Capacity   Mounted on
 43M        55M       44%  /
 16K         0B      100%  /dev/
 13M         0B      100%  /packages/mnt/jbase
 39M         0B      100%  /packages/mnt/jkernel-7.2R4.2
 12M         0B      100%  /packages/mnt/jpfe-M40-7.2R4.2
2.3M         0B      100%  /packages/mnt/jdocs-7.2R4.2
 14M         0B      100%  /packages/mnt/jroute-7.2R4.2
4.5M         0B      100%  /packages/mnt/jcrypto-7.2R4.2
3.0K       457M        0%  /tmp
 30K        11M        0%  /config
4.0K         0B      100%  /proc
 37M       1.2G        3%  /var

这里的导出符并没有意义,我只是为了协调篇幅不得已而为之。但你实际使用show system storage这个命令的时候,JUNOS会完整输出当前设备的各项存储情况。

查看JUNOS系统进程状态 | show system processes extensive

由于JUNOS基于FreeBSD内核构造,对于系统进程的管理实际上与FreeBSD的ps命令有紧密的关联。如show system processes命令本身实际上等同于FreeBSD上的ps -ax命令。

nigel@junos> show system processes extensive
last pid:  3390;  load averages:  0.00,  0.00,  0.00
up 0+02:38:11    08:14:55
60 processes:  1 running, 59 sleeping

Mem: 58M Active, 42M Inact, 12M Wired, 6884K Cache,
22M Buf, 588K Free
Swap: 512M Total, 512M Fre

使用extensive参数,还可以额外查看JUNOS系统运行时间(uptime),当前系统时间,以及JUNOS系统内存分配情况。同时JUNOS也向你输出当前系统的全部进程信息。

 nigel@junos> show system processes extensive | trim 18
NICE  SIZE    RES STATE    TIME   WCPU    CPU COMMAND
   0  9324K  4448K select   0:03  0.00%  0.00% cli
   0  1816K  1240K select   0:03  0.00%  0.00% ppmd
   0  3036K  2076K select   0:02  0.00%  0.00% dcd
   0 14260K  9700K select   0:01  0.00%  0.00% mgd
   0  1336K   704K select   0:01  0.00%  0.00% telnetd
   0  1776K   980K select   0:01  0.00%  0.00% alarmd
   0  7372K  3680K kqread   0:01  0.00%  0.00% rpd
   0  1316K   760K select   0:01  0.00%  0.00% irsd
   0  4480K  2120K select   0:01  0.00%  0.00% kmd
   0  7628K  3804K kqread   0:01  0.00%  0.00% rpd
   0  7628K  3796K kqread   0:01  0.00%  0.00% rpd
   0  7628K  3808K kqread   0:01  0.00%  0.00% rpd
   0  9136K  1516K select   0:01  0.00%  0.00% chassisd
   0  4012K  2036K select   0:00  0.00%  0.00% snmpd
   0  3256K  1672K select   0:00  0.00%  0.00% mib2d
   0  1140K   572K select   0:00  0.00%  0.00% smartd
   0  1996K  1180K select   0:00  0.00%  0.00% bfdd
---(more)---[abort]

查看JUNOS系统协议状态 | show system statistics

show system statistics将显示JUNOS系统内部各种协议的统计状态信息,一般而言,你应该在命令后面跟上你所需要查看的具体协议以获得更为精确的信息。我在下面列出了JUNOS允许你指定查看的特定协议。

nigel@junos> show system statistics ?
Possible completions:
  <[Enter]>            Execute this command
  arp                  Address Resolution Protocol
  clnl                 Connectionless Network Layer
  esis                 End System-to-Intermediate System
  icmp                 Internet Control Message Protocol
  icmp6                Internet Control Message Protocol
                       for IPv6
  igmp                 Internet Gateway Management
                       Protocol
  ip                   IP version 4 (IPv4)
  ip6                  IP version 6 (IPv6)
  mpls                 Multiprotocol Label Switching
  rdp                  Reliable Datagram Protocol
  tcp                  Transmission Control Protocol
  tnp                  Trivial Network Protocol
  tudp                 Trivial User Datagram Protocol
  udp                  User Datagram Protocol
  vpls                 Virtual private LAN service
  |                    Pipe through a command

nigel@junos> show system statistics ip
ip:
	14065 total packets received
	0 bad header checksums
	0 with size smaller than minimum
	0 with data size < data length
	0 with header length < data size
	0 with data length < header length
	0 with incorrect version number
	0 packets destined to dead next hop
	0 fragments received
	0 fragments dropped (dup or out of space)
	0 fragments dropped (queue overflow)
	0 fragments dropped after timeout
	0 fragments dropped due to over limit
	0 packets reassembled ok
	14063 packets for this host
	8824 packets for unknown/unsupported protocol
	0 packets forwarded
	0 packets not forwardable
	0 redirects sent
	13606 packets sent from this host
	0 packets sent with fabricated ip header
	0 output packets dropped due to no bufs
	0 output packets discarded due to no route
	0 output datagrams fragmented
---(more)---[abort]

查看JUNOS系统运行时间 | show system uptime

nigel@junos> show system uptime
Current time: 2008-09-23 09:04:50 CST
System booted: 2008-09-23 05:37:14 CST (03:27:36 ago)
Protocols started: 2008-09-23 05:37:49 CST (03:27:01 ago)
Last configured: 2008-09-23 05:59:30 CST (03:05:20 ago)
by nigel
 9:04AM  up 3:28, 1 user, load averages: 0.01, 0.02, 0.00

查看JUNOS系统连接状态 | show system connections

nigel@junos> show system connections | match ip4
ip4        0      0  *.*                    *.*
ip4        0      0  *.*                    *.*
ip4        0      0  *.*                    *.*
ip4     1872      0  *.*                    *.*
ip4        0      0  *.*                    *.*
ip4        0      0  *.*                    *.*
ip4        0      0  *.*                    *.*

重启JUNOS系统路由守护进程 | restart routing

nigel@junos> restart routing
Routing protocol daemon started, pid 3425

重启/关闭JUNOS系统 | request system reboot/halt

nigel@junos> request system reboot
Reboot the system ? [yes,no] (no) yes 

Shutdown NOW!
[pid 3612]

nigel@junos>
*** FINAL System shutdown message from nigel@junos ***
System going down IMMEDIATELY                                                  

Connection closed by foreign host.

3 thoughts on “Juniper JUNOS系统维护常用命令

  1. 使用JUNOS查询网络服务端口号码 « JUNIPER JUNOS & CISCO IOS 互联路由

  2. monster crocodile captured in the philippines

  3. Make sure to evenly cover your hair, especially the tips.
    As we know that our bodys natural structure and physique also contains the wax esters which helps as natural moisturizer on the skin and prevents
    from multiple environmental problems. Once you have determined what kind of texture your hair has, you can then start using
    one of the techniques described below to improve it.
    This is why many salon stylists always recommend a hot oil treatment for hair.

    Essential oils are very good agents to make the hair grow stronger,
    fuller and thicker.

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s