예: 글로벌 라우팅 프로토콜 운영 추적
이 예에서는 전역 라우팅 추적 작업을 수행할 때 생성된 파일을 나열하고 보는 방법을 보여줍니다.
요구 사항
뷰 권한이 있어야 합니다.
개요
글로벌 라우팅 프로토콜 추적을 구성하려면 계층 수준에서 다음과 같은 명령문을 [edit routing-options]
포함합니다traceoptions
.
traceoptions { file filename <files number> <size size> <world-readable | no-world-readable>; flag flag <disable>; }
성명서의 traceoptions flag
플래그는 식별자입니다. 명령을 사용하여 set
플래그를 구성할 때 이미 설정될 수 있는 플래그는 수정되지 않습니다. 다음 예에서 타이머 추적 플래그 설정은 이미 구성된 작업 플래그에 영향을 미치지 않습니다. delete
명령을 사용하여 특정 플래그를 삭제합니다.
[edit routing-options traceoptions]
user@host# show
flag task;
user@host# set traceoptions flag timer
user@host# show
flag task;
flag timer;
user@host# delete traceoptions flag task
user@host# show
flag timer;
이 예에서는 라우팅 테이블의 변경 사항을 추적하는 추적 파일을 구성하고 보는 방법을 보여줍니다. 단계를 조정하여 추적 작업을 지원하는 모든 Junos OS 계층 수준에 대한 작업을 추적할 수 있습니다.
추적 작업을 지원하는 계층 수준 목록을 보려면 구성 모드에서 help apropos traceoptions
명령을 입력합니다.
구성
CLI 빠른 구성
이 예제를 신속하게 구성하려면 다음 명령을 복사하여 텍스트 파일에 붙여넣고, 줄 바꿈을 제거하고, 네트워크 구성에 필요한 세부 정보를 변경한 다음, 명령을 복사하여 계층적 수준에서 CLI [edit]
에 붙여넣습니다.
set routing-options traceoptions file routing-table-changes set routing-options traceoptions file size 10m set routing-options traceoptions file files 10 set routing-options traceoptions flag route set routing-options static route 1.1.1.2/32 next-hop 10.0.45.6
추적 작업 구성
단계별 절차
다음 예제에서는 구성 계층에서 다양한 레벨을 탐색해야 합니다. CLI 탐색에 대한 자세한 내용은 Junos OS CLI 사용자 가이드의 Configuration 모드에서 CLI Editor를 사용하는 것을 참조하십시오.
추적 작업을 구성하려면 다음을 수행합니다.
추적 작업을 구성합니다.
[edit routing-options traceoptions] user@host# set file routing-table-changes user@host# set file size 10m user@host# set file files 10 user@host# set flag route
정적 경로를 구성하여 라우팅 테이블의 변경을 야기합니다.
[edit routing-options static] user@host# set route 1.1.1.2/32 next-hop 10.0.45.6
디바이스 구성을 완료한 경우 구성을 커밋합니다.
[edit] user@host# commit
Trace 파일 보기
단계별 절차
추적 파일을 보려면 다음을 수행합니다.
운영 모드에서 시스템의 로그 파일을 나열합니다.
user@host> file list /var/log /var/log: ... routing-table-changes ...
라우팅 테이블 변경 파일의 컨텐츠를 봅니다.
user@host> file show /var/log/routing-table-changes Dec 15 11:09:29 trace_on: Tracing to "/var/log/routing-table-changes" started Dec 15 11:09:29.496507 Dec 15 11:09:29.496507 Tracing flags enabled: route Dec 15 11:09:29.496507 Dec 15 11:09:29.533203 inet_routerid_notify: Router ID: 192.168.4.1 Dec 15 11:09:29.533334 inet_routerid_notify: No Router ID assigned Dec 15 11:09:29.533381 inet_routerid_notify: No Router ID assigned Dec 15 11:09:29.533420 inet_routerid_notify: No Router ID assigned Dec 15 11:09:29.534915 inet_routerid_notify: Router ID: 192.168.4.1 Dec 15 11:09:29.542934 inet_routerid_notify: No Router ID assigned Dec 15 11:09:29.549253 inet_routerid_notify: No Router ID assigned Dec 15 11:09:29.556878 inet_routerid_notify: No Router ID assigned Dec 15 11:09:29.582990 rt_static_reinit: examined 3 static nexthops, 0 unreferenced Dec 15 11:09:29.589920 Dec 15 11:09:29.589920 task_reconfigure reinitializing done ...
로그 파일의 출력을 필터링합니다.
user@host> file show /var/log/routing-table-changes | match 1.1.1.2 Dec 15 11:15:30.780314 ADD 1.1.1.2/32 nhid 0 gw 10.0.45.6 Static pref 5/0 metric at-0/2/0.0 <ctive Int Ext> Dec 15 11:15:30.782276 KRT Request: send len 216 v104 seq 0 ADD route/user af 2 table 0 infot 0 addr 1.1.1.2 nhop-type unicast nhindex 663
선택적 일치 조건의 명령을 실행
monitor start
하여 추적 작업을 실시간으로 확인합니다.user@host> monitor start routing-table-changes | match 1.1.1.2 Aug 10 19:21:40.773467 BGP RECV 0.0.0.0/0 Aug 10 19:21:40.773685 bgp_rcv_nlri: 0.0.0.0/0 Aug 10 19:21:40.773778 bgp_rcv_nlri: 0.0.0.0/0 belongs to meshgroup Aug 10 19:21:40.773832 bgp_rcv_nlri: 0.0.0.0/0 qualified bnp->ribact 0x0 l2afcb 0x0
정적 경로를 비활성화합니다.
user@host# deactivate routing-options static route 1.1.1.2/32 user@host# commit
*** routing-table-changes *** Dec 15 11:42:59.355557 CHANGE 1.1.1.2/32 nhid 663 gw 10.0.45.6 Static pref 5/0 metric at-0/2/0.0 <Delete Int Ext> Dec 15 11:42:59.426887 KRT Request: send len 216 v104 seq 0 DELETE route/user af 2 table 0 infot 0 addr 1.1.1.2 nhop-type discard filtidx 0 Dec 15 11:42:59.427366 RELEASE 1.1.1.2/32 nhid 663 gw 10.0.45.6 Static pref 5/0 metric at-0/2/0.0 <Release Delete Int Ext>
monitor
Enter 키를 누르고 모니터 정지를 입력하여 명령을 중단합니다.[Enter] user@host> monitor stop
문제 해결을 마치면 추적 로깅을 비활성화하여 시스템 리소스에 불필요한 영향을 주지 않도록 하는 것이 좋습니다.
구성이 비활성화되면 비활성 태그가 있는 구성에 나타납니다.
[edit routing-options] user@host# deactivate traceoptions user@host# commit
[edit routing-options] user@host# show inactive: traceoptions { file routing-table-changes size 10m files 10; flag route; } static { inactive: route 1.1.1.2/32 next-hop 10.0.45.6; }
추적 작업을 다시 활성화하려면 구성 모드 명령문 활성화 를 사용합니다.
[edit routing-options] user@host# activate traceoptions user@host# commit
결과
구성 모드에서 명령을 입력하여 구성을 show routing-options
확인합니다. 출력이 의도한 구성을 표시하지 않는 경우 이 예제의 지침을 반복하여 구성을 수정합니다.
user@host# show routing-options traceoptions { file routing-table-changes size 10m files 10; flag route; } static { route 1.1.1.2/32 next-hop 10.0.45.6; }