Linux 重置网卡统计

发布时间:2021-12-02浏览次数:0

支持注册ChatGPT Plus的OneKey虚拟卡
绑定Apple Pay、Google Pay、支付宝和微信支付进行日常消费

注册和了解更多 ->

silver

重置网卡的统计信息有两种方法:

  • 重启服务器。
  • 卸载网卡驱动并重新挂载。

但是很多情况下,服务器是不能随便重启的,所以只能选择第二种方法。
*注:* 网卡的数据统计与驱动有关。

  1. 查看网卡现有数据统计:
$ ifconfig eth0
Link encap:Ethernet  HWaddr 52:54:11:7d:1d:4a  
inet addr:10.141.14.111  Bcast:10.141.63.255  Mask:255.255.192.0
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:15231844 errors:0 dropped:0 overruns:0 frame:0
TX packets:15504595 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 
RX bytes:1922538759 (1.9 GB)  TX bytes:2186793789 (2.1 GB)
  1. 查看网卡的驱动信息
$ ethtool -i eth0
driver: virtio_net    // 驱动信息
version: 1.0.0
  1. 对驱动模块进行 reload
$ ifocnfig eth0 down && modprobe -r virtio_net && modprobe virtio_net && ifconfig eth0 up

完成后可使用 ifconfig eth0 进行查看。

字节笔记本扫描二维码查看更多内容