Description
This article provides a procedure from CLI to clear interface counters.
Solution
Connect to the FortiGate through SSH or Serial Console and type the follow command to see the current counter values:
FGT # diagnose netlink interface list wan1
if=wan1 family=00 type=1 index=6 mtu=1500 link=0 master=0
ref=51 state=start present fw_flags=0 flags=up broadcast run allmulti multicast
Qdisc=pfifo_fast hw_addr=08:5b:0e:d5:17:a8 broadcast_addr=ff:ff:ff:ff:ff:ff
stat: rxp=4890926 txp=8987 rxb=498192619 txb=2170882 rxe=0 txe=0 rxd=0 txd=0 mc=0 collision=0
re: rxl=0 rxo=0 rxc=0 rxf=0 rxfi=0 rxm=0
te: txa=0 txc=0 txfi=0 txh=0 txw=0
misc rxc=0 txc=0 stop=0
input_type=0 state=6 arp_entry=18 refcnt=51
To clear the counters use the following command:
FGT # diagnose netlink interface clear wan1
The result of the cleared counters can now be seen by the following command:
FGT # diagnose netlink interface list wan1
if=wan1 family=00 type=1 index=6 mtu=1500 link=0 master=0
ref=43 state=start present fw_flags=0 flags=up broadcast run allmulti multicast
Qdisc=pfifo_fast hw_addr=08:5b:0e:d5:17:a8 broadcast_addr=ff:ff:ff:ff:ff:ff
stat: rxp=78 txp=4 rxb=7874 txb=1221 rxe=0 txe=0 rxd=0 txd=0 mc=0 collision=0
re: rxl=0 rxo=0 rxc=0 rxf=0 rxfi=0 rxm=0
te: txa=0 txc=0 txfi=0 txh=0 txw=0
misc rxc=0 txc=0 stop=0
input_type=0 state=6 arp_entry=18 refcnt=43
However, to clear counters under 'di hardware deviceinfo nic', it is required to reboot the FortiGate.
FGT # di hardware deviceinfo nic internal1
Description :FortiASIC NP6LITE Adapter
Driver Name :FortiASIC NP6LITE Driver
Board :60E
lif id :3
lif oid :67
netdev oid :67
tx group :0
Current_HWaddr e8:1c:ba:03:dc:9b
Permanent_HWaddr e8:1c:ba:03:dc:9b
========== Link Status ==========
Admin :up
netdev status :up
autonego_setting:1
link_setting :0
speed_setting :10
duplex_setting :0
Speed :1000
Duplex :Full
link_status :Up
============ Counters ===========
Rx Pkts :3327
Rx Bytes :988142
Tx Pkts :2442Tx B
Bytes :438323
Host Rx Pkts :3177
Host Rx Bytes :881328
Host Tx Pkts :2308
Host Tx Bytes :349760
Host Tx dropped :0
FragTxCreate :0
FragTxOk :0
FragTxDrop :0