常规情况下,当JUNOS进程异常或内核崩溃时,将自动生成一个Core-dump文件,有时故障排查的需要下,需手动的去生成一个Core-dump文件。


以NSD进程手动生成Core-dump为例:

{primary:node0}

root@vsrx-a> show system processes extensive | match nsd

Mar 06 01:57:59

8128 root        1  76    0 14416K  9464K select 0   0:00  0.00% nsd

NSD的进程ID是8128, 当前防火墙没有任何的Core-dump文件:

{primary:node0}

root@vsrx-a> show system core-dumps

Mar 06 01:58:45

node0:

--------------------------------------------------------------------------

/var/crash/*core*: No such file or directory

/var/tmp/*core*: No such file or directory

/var/tmp/pics/*core*: No such file or directory

/var/crash/kernel.*: No such file or directory

/tftpboot/corefiles/*core*: No such file or directory

现手动的为NSD进程手动生成一个Core-dump文件,使用request命令生动产生Core-dump文件时,会导致nsd进程重启。

{primary:node0}

root@vsrx-a> request system core-dump network-security node 0

{primary:node0}

root@vsrx-a> show system processes extensive | match nsd

Mar 06 02:01:43

8471 root        1  76    0 14212K  8652K select 0   0:00  0.00% nsd

{primary:node0}

root@vsrx-a> show system core-dumps

Mar 06 02:01:46

node0:

--------------------------------------------------------------------------

/var/crash/*core*: No such file or directory

-rw-rw----  1 root  wheel     304987 Mar 6  02:01 /var/tmp/nsd.core-tarball.0.tgz

/var/tmp/pics/*core*: No such file or directory

/var/crash/kernel.*: No such file or directory

/tftpboot/corefiles/*core*: No such file or directory

total files: 1

以下方法为不重启NSD的情况下,生成一个Core-dump信息:

{primary:node0}

root@vsrx-a> show system processes extensive | match nsd

Mar 06 02:03:34

8471 root        1  76    0 14212K  8652K select 0   0:00  0.00% nsd

{primary:node0}

root@vsrx-a> start shell

root@vsrx-a% gcore -s -c /var/tmp/nsd.core.8471 8471

root@vsrx-a% cli

{primary:node0}

root@vsrx-a> show system core-dumps

node0:

--------------------------------------------------------------------------

/var/crash/*core*: No such file or directory

-rw-rw----  1 root  wheel     304987 Mar 6  02:01 /var/tmp/nsd.core-tarball.0.tgz

-rw-r--r--  1 root  wheel    5758976 Mar 6  02:04 /var/tmp/nsd.core.8471

/var/tmp/pics/*core*: No such file or directory

/var/crash/kernel.*: No such file or directory

/tftpboot/corefiles/*core*: No such file or directory

total files: 2

{primary:node0}

root@vsrx-a> show system processes extensive | match nsd

8471 root        1  76    0 14212K  9288K select 0   0:00  0.00% nsd

生成一个内核的core-dump (RE将会重启)

root@vsrx-a% sysctl -w debug.kdb.panic=1

debug.kdb.panic: 0

sysctl: debug.kdb.panic: Operation not permitted

root@vsrx-a%

Note:真机可能会可以使用

或者以下方式:

set system debugger-on-break

then

router>edit

router#

ctrl ]

telnet>send brk

db> panic

在线生成一个Kernel Core-dump信息,而不重启RE

root@lab-16% sysctl -w kern.live_core_dump=1

kern.live_core_dump: 0 -> 1

FPC/IQ2/MS-PIC/上生成一个Core-dump信息(CPU将会重启)

VMX(vmx16 vty)# set parser security 10

Security level set to 10

VMX(vmx16 vty)# test panic

The semaphore timeout period has expired.

Press Ctrl+C to cancel or Enter to reconnect immediately.

Reconnecting in 1 seconds

【Junos】手动生成Core-dump文件_第1张图片

这样将会导致FPC板卡Offline,需要手工的Online一把后,板卡Online了,但是无法与原先板卡上的接口互通,后尝试重试Vmx后,可以正常通信。

可以不用重启CPU的方式,但Services PIC可能会Restart。

Note: 以下命令可能真机板卡支持,当前所有手工产生Core-dump的命令,慎用

VMX(lab-16 vty)# wr coredump

^

Syntax error at `wr'.

VMX(lab-16 vty)# write coredump

^

Syntax error at `write'.

设备上查看小的Core-dump日志分析信息,使用以下命令:

root@lab-16> show system core-dumps core-file-info /var/tmp/vmxt.core.0.gz detail

【Junos】手动生成Core-dump文件_第2张图片