前提
試しに以下のような設定で、ログをとってみます。
show firewall
name IN {
default-action drop
enable-default-log
rule 20 {
action drop
log enable
protocol icmp
}
}
ファイアウォールのデフォルトアクションのログ
set firewall name IN enable-default-log
の記述により、ファイアウォールのデフォルトアクションのログを
show log firewall name IN
でみることができます。
(ログ本体は、/var/log/messages に保存されていく形です。)
例
vyos@khayama-test:~$ show log firewall name IN
Apr 13 01:36:59 khayama-test kernel: [143095.733345] [LOCAL-default-D]IN=eth1 OUT= MAC=06:b1:48:85:80:75:e4:c7:22:63:xx:xx:xx:xx SRC=223.xx.xx.xx DST=161.xx.xx.xx LEN=40 TOS=0x00 PREC=0x00 TTL=44 ID=31841 PROTO=TCP SPT=8089 DPT=23 WINDOW=12977 RES=0x00 SYN URGP=0
ファイアウォールの各ルールのログ
特定のルールについても、
set firewall name IN rule 20 log enable
と記述しておくことで
show log firewall name IN rule 20
でルールごとのログをみることができます。
また、
monitor firewall name IN rule 20
でリアルタイムにログ監視することができます。
例
vyos@khayama-test:~$ monitor firewall name IN
Notice: monitoring information is displayed only for rules with enabled logging
Firewall-IN-rule-20: [143430.504542] [IN-20-D] IN=eth1 OUT=eth0 MAC=06:b1:48:85:80:75:e4:c7:22:61:xx:xx:xx:xx SRC=172.xx.xx.xx DST=10.xx.xx.xx LEN=60 TOS=0x00 PREC=0x00 TTL=56 ID=0 PROTO=ICMP TYPE=0 CODE=0 ID=1 SEQ=1361