How to reset ifconfig counters?












14















When i run ifconfig eth0 see following lines:



eth0      Link encap:Ethernet  HWaddr 08:00:27:42:81:a7  
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe42:81a7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:66 errors:0 dropped:0 overruns:0 frame:0
TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8001 (8.0 KB) TX bytes:34004 (34.0 KB)


How can i reset these counters especially RX/TX packets?










share|improve this question


















  • 1





    While you may not want to do this, it worth noting that you can also just restart your computer. :)

    – Vreality
    Sep 20 '13 at 17:38






  • 6





    Yes you can reset counters by restarting your computer, but is it a good choice? Is it comfortable to close all programs and restart computer to just reset some counters? You suggest Restart Engineering dude, it is not a solution.

    – SuB
    Sep 20 '13 at 18:45


















14















When i run ifconfig eth0 see following lines:



eth0      Link encap:Ethernet  HWaddr 08:00:27:42:81:a7  
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe42:81a7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:66 errors:0 dropped:0 overruns:0 frame:0
TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8001 (8.0 KB) TX bytes:34004 (34.0 KB)


How can i reset these counters especially RX/TX packets?










share|improve this question


















  • 1





    While you may not want to do this, it worth noting that you can also just restart your computer. :)

    – Vreality
    Sep 20 '13 at 17:38






  • 6





    Yes you can reset counters by restarting your computer, but is it a good choice? Is it comfortable to close all programs and restart computer to just reset some counters? You suggest Restart Engineering dude, it is not a solution.

    – SuB
    Sep 20 '13 at 18:45
















14












14








14


2






When i run ifconfig eth0 see following lines:



eth0      Link encap:Ethernet  HWaddr 08:00:27:42:81:a7  
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe42:81a7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:66 errors:0 dropped:0 overruns:0 frame:0
TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8001 (8.0 KB) TX bytes:34004 (34.0 KB)


How can i reset these counters especially RX/TX packets?










share|improve this question














When i run ifconfig eth0 see following lines:



eth0      Link encap:Ethernet  HWaddr 08:00:27:42:81:a7  
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe42:81a7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:66 errors:0 dropped:0 overruns:0 frame:0
TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8001 (8.0 KB) TX bytes:34004 (34.0 KB)


How can i reset these counters especially RX/TX packets?







12.04 networking reset ifconfig






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 20 '13 at 17:03









oddoneoddone

521148




521148








  • 1





    While you may not want to do this, it worth noting that you can also just restart your computer. :)

    – Vreality
    Sep 20 '13 at 17:38






  • 6





    Yes you can reset counters by restarting your computer, but is it a good choice? Is it comfortable to close all programs and restart computer to just reset some counters? You suggest Restart Engineering dude, it is not a solution.

    – SuB
    Sep 20 '13 at 18:45
















  • 1





    While you may not want to do this, it worth noting that you can also just restart your computer. :)

    – Vreality
    Sep 20 '13 at 17:38






  • 6





    Yes you can reset counters by restarting your computer, but is it a good choice? Is it comfortable to close all programs and restart computer to just reset some counters? You suggest Restart Engineering dude, it is not a solution.

    – SuB
    Sep 20 '13 at 18:45










1




1





While you may not want to do this, it worth noting that you can also just restart your computer. :)

– Vreality
Sep 20 '13 at 17:38





While you may not want to do this, it worth noting that you can also just restart your computer. :)

– Vreality
Sep 20 '13 at 17:38




6




6





Yes you can reset counters by restarting your computer, but is it a good choice? Is it comfortable to close all programs and restart computer to just reset some counters? You suggest Restart Engineering dude, it is not a solution.

– SuB
Sep 20 '13 at 18:45







Yes you can reset counters by restarting your computer, but is it a good choice? Is it comfortable to close all programs and restart computer to just reset some counters? You suggest Restart Engineering dude, it is not a solution.

– SuB
Sep 20 '13 at 18:45












1 Answer
1






active

oldest

votes


















10














Those counters are kept by the kernel, so your answer depends on how your network card driver is built. Two possible choices:




  1. Kernel module

  2. Inside the kernel


If it is second, you can not reset counters without restarting the operating system. If it is first, you can do it by unloading the module from the kernel and then loading it back again. If your NIC card use e1000 module, use following commands:



ifconfig eth0 down
modprobe -r e1000
modprobe e1000
ifconfig eth0 up


Use ethtool to find out your NIC moudle:



ethtool -i eth0


In front of driver you see your module name:



driver: e1000
version: 7.3.21-k8-NAPI
firmware-version:
...


Use apt-get to install ethtool as follow:



apt-get install ethtool





share|improve this answer


























  • modprobe -r unloads the driver from the kernel (which could leave you without a method of accessing the machine), so if you are doing this remotely I would advise just rebooting instead.

    – Score_Under
    Jan 9 '18 at 10:56











  • @Score_Under: A better solution for remote access is writing these command to a bash script file and then run it with nohup, i.e: nohup bash restart_counters_script.sh

    – SuB
    Jan 9 '18 at 14:25













  • Do you know how can I do this with loopback interface? Also: is possible to just unbind/bind the driver without removing the kernel module?

    – Pablo Bianchi
    Dec 30 '18 at 3:36













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f348038%2fhow-to-reset-ifconfig-counters%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









10














Those counters are kept by the kernel, so your answer depends on how your network card driver is built. Two possible choices:




  1. Kernel module

  2. Inside the kernel


If it is second, you can not reset counters without restarting the operating system. If it is first, you can do it by unloading the module from the kernel and then loading it back again. If your NIC card use e1000 module, use following commands:



ifconfig eth0 down
modprobe -r e1000
modprobe e1000
ifconfig eth0 up


Use ethtool to find out your NIC moudle:



ethtool -i eth0


In front of driver you see your module name:



driver: e1000
version: 7.3.21-k8-NAPI
firmware-version:
...


Use apt-get to install ethtool as follow:



apt-get install ethtool





share|improve this answer


























  • modprobe -r unloads the driver from the kernel (which could leave you without a method of accessing the machine), so if you are doing this remotely I would advise just rebooting instead.

    – Score_Under
    Jan 9 '18 at 10:56











  • @Score_Under: A better solution for remote access is writing these command to a bash script file and then run it with nohup, i.e: nohup bash restart_counters_script.sh

    – SuB
    Jan 9 '18 at 14:25













  • Do you know how can I do this with loopback interface? Also: is possible to just unbind/bind the driver without removing the kernel module?

    – Pablo Bianchi
    Dec 30 '18 at 3:36


















10














Those counters are kept by the kernel, so your answer depends on how your network card driver is built. Two possible choices:




  1. Kernel module

  2. Inside the kernel


If it is second, you can not reset counters without restarting the operating system. If it is first, you can do it by unloading the module from the kernel and then loading it back again. If your NIC card use e1000 module, use following commands:



ifconfig eth0 down
modprobe -r e1000
modprobe e1000
ifconfig eth0 up


Use ethtool to find out your NIC moudle:



ethtool -i eth0


In front of driver you see your module name:



driver: e1000
version: 7.3.21-k8-NAPI
firmware-version:
...


Use apt-get to install ethtool as follow:



apt-get install ethtool





share|improve this answer


























  • modprobe -r unloads the driver from the kernel (which could leave you without a method of accessing the machine), so if you are doing this remotely I would advise just rebooting instead.

    – Score_Under
    Jan 9 '18 at 10:56











  • @Score_Under: A better solution for remote access is writing these command to a bash script file and then run it with nohup, i.e: nohup bash restart_counters_script.sh

    – SuB
    Jan 9 '18 at 14:25













  • Do you know how can I do this with loopback interface? Also: is possible to just unbind/bind the driver without removing the kernel module?

    – Pablo Bianchi
    Dec 30 '18 at 3:36
















10












10








10







Those counters are kept by the kernel, so your answer depends on how your network card driver is built. Two possible choices:




  1. Kernel module

  2. Inside the kernel


If it is second, you can not reset counters without restarting the operating system. If it is first, you can do it by unloading the module from the kernel and then loading it back again. If your NIC card use e1000 module, use following commands:



ifconfig eth0 down
modprobe -r e1000
modprobe e1000
ifconfig eth0 up


Use ethtool to find out your NIC moudle:



ethtool -i eth0


In front of driver you see your module name:



driver: e1000
version: 7.3.21-k8-NAPI
firmware-version:
...


Use apt-get to install ethtool as follow:



apt-get install ethtool





share|improve this answer















Those counters are kept by the kernel, so your answer depends on how your network card driver is built. Two possible choices:




  1. Kernel module

  2. Inside the kernel


If it is second, you can not reset counters without restarting the operating system. If it is first, you can do it by unloading the module from the kernel and then loading it back again. If your NIC card use e1000 module, use following commands:



ifconfig eth0 down
modprobe -r e1000
modprobe e1000
ifconfig eth0 up


Use ethtool to find out your NIC moudle:



ethtool -i eth0


In front of driver you see your module name:



driver: e1000
version: 7.3.21-k8-NAPI
firmware-version:
...


Use apt-get to install ethtool as follow:



apt-get install ethtool






share|improve this answer














share|improve this answer



share|improve this answer








edited 9 hours ago









Fernando Mariano

32




32










answered Sep 20 '13 at 17:15









SuBSuB

2,02721631




2,02721631













  • modprobe -r unloads the driver from the kernel (which could leave you without a method of accessing the machine), so if you are doing this remotely I would advise just rebooting instead.

    – Score_Under
    Jan 9 '18 at 10:56











  • @Score_Under: A better solution for remote access is writing these command to a bash script file and then run it with nohup, i.e: nohup bash restart_counters_script.sh

    – SuB
    Jan 9 '18 at 14:25













  • Do you know how can I do this with loopback interface? Also: is possible to just unbind/bind the driver without removing the kernel module?

    – Pablo Bianchi
    Dec 30 '18 at 3:36





















  • modprobe -r unloads the driver from the kernel (which could leave you without a method of accessing the machine), so if you are doing this remotely I would advise just rebooting instead.

    – Score_Under
    Jan 9 '18 at 10:56











  • @Score_Under: A better solution for remote access is writing these command to a bash script file and then run it with nohup, i.e: nohup bash restart_counters_script.sh

    – SuB
    Jan 9 '18 at 14:25













  • Do you know how can I do this with loopback interface? Also: is possible to just unbind/bind the driver without removing the kernel module?

    – Pablo Bianchi
    Dec 30 '18 at 3:36



















modprobe -r unloads the driver from the kernel (which could leave you without a method of accessing the machine), so if you are doing this remotely I would advise just rebooting instead.

– Score_Under
Jan 9 '18 at 10:56





modprobe -r unloads the driver from the kernel (which could leave you without a method of accessing the machine), so if you are doing this remotely I would advise just rebooting instead.

– Score_Under
Jan 9 '18 at 10:56













@Score_Under: A better solution for remote access is writing these command to a bash script file and then run it with nohup, i.e: nohup bash restart_counters_script.sh

– SuB
Jan 9 '18 at 14:25







@Score_Under: A better solution for remote access is writing these command to a bash script file and then run it with nohup, i.e: nohup bash restart_counters_script.sh

– SuB
Jan 9 '18 at 14:25















Do you know how can I do this with loopback interface? Also: is possible to just unbind/bind the driver without removing the kernel module?

– Pablo Bianchi
Dec 30 '18 at 3:36







Do you know how can I do this with loopback interface? Also: is possible to just unbind/bind the driver without removing the kernel module?

– Pablo Bianchi
Dec 30 '18 at 3:36




















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f348038%2fhow-to-reset-ifconfig-counters%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How did Captain America manage to do this?

迪纳利

南乌拉尔铁路局