LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Bandwith on a network card (https://www.linuxquestions.org/questions/linux-software-2/bandwith-on-a-network-card-451585/)

rincewind 06-04-2006 05:34 PM

Bandwith on a network card
 
Hello world!

Is there any good program running i bash or commando in linux where I can se how much one of my NICs send bytes and recived bytes over a timespan?

The machine im trying to this with is my home webserver, yet I can't find a suitable program to check this.. (webalizer only analyzis web trafic, I wanna do this on EVERY port (of coz, it would be nice to se how much bandwith it takes on diffrent port also)).

Does anyone know?

Regardz,
-- Rincewind
"If you run away, you live to run away another day!"

osor 06-04-2006 06:28 PM

I know this is going to sound geeky, but you can always use iptables. You can create dummy chains for a certain match of a packet (unless, of course, you already have such chains and don't need dummy ones). Netfilter keeps packet and byte counters for every chain (viewable with `iptables -nL CHAIN' and zeroed with `iptables -Z CHAIN').

So for example, if you want to see the amount of ingress traffic destined for port 80 on your webserver, you could either
  1. Create a dummy chain (if you already have a good ruleset that you don't want to disturb):
    Code:

    # Initialization stuff
    #        :
    #        :
    #        :

    # Create a dummy chain to `touch' while traversing the filters
    iptables -N WEBSERVER_IN
    iptables -A INPUT -p tcp --dport 80 -j WEBSERVER_IN

    # The rest of your normal rules, including the final
    # non-returning targets such as ACCEPT, DROP, or DENY
    #                        :
    #                        :
    #                        :

  2. Use an specific chain:
    Code:

    # Initialization stuff
    #        :
    #        :
    #        :

    # Create a chain to for the webserver
    iptables -N WEBSERVER_IN
    iptables -A INPUT -p tcp --dport 80 -j WEBSERVER_IN
    iptables -A WEBSERVER_IN -j ACCEPT

    # The rest of your normal rules, including the final
    # non-returning targets such as ACCEPT, DROP, or DENY
    #                        :
    #                        :
    #                        :


Tinkster 06-04-2006 06:33 PM

Not on an arbitrary port for an arbitrary time without special
tools/instructions.

ifconfig will tell you TX/RX since an interface was enabled.
You could use iptables LOG-target to record all packet sizes, though,
or use any of the traffic monitoring tools out there. Have a search
on http://freshmeat.net ... there's ipac-ng, for instance.


Cheers,
Tink


All times are GMT -5. The time now is 04:22 PM.