0

I tried to find out the maximum up- and down- DSL throughput I can achieve on my local machine.

I tried it with iptraf:

On my server with $IP I started:

iptraf -s

and on my local machine:

iperf -c $IP 

will output

------------------------------------------------------------
Client connecting to $IP, TCP port 5001
TCP window size: 21.8 KByte (default)
------------------------------------------------------------
[  3] local 10.116.135.6 port 50423 connected with $IP port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.3 sec  8.00 MBytes  6.51 Mbits/sec

If I start it in a loop:

while true;do iperf -c $IP |tail -n 1; done

this creates the output:

[  3]  0.0-11.6 sec  7.50 MBytes  5.45 Mbits/sec
[  3]  0.0-10.3 sec  8.25 MBytes  6.75 Mbits/sec
[  3]  0.0-10.2 sec  7.88 MBytes  6.45 Mbits/sec
[  3]  0.0-10.2 sec  8.25 MBytes  6.81 Mbits/sec
...

To measure over 10 minutes every second, you can also:

iperf -c $IP -i 1 -t 600

This will only show the maximum bandwidth over 10 minutes:

I=600; 
iperf -c $IP -i 1 -t $I | awk -F '  +' '{print $5}'|sort|tail -n 1

But how can I calculate the maximum down and upload separately?

  • Why won't you use iftop? Tons of filters there or vnstat. – Danila Ladner Jan 18 '14 at 0:22
  • Sounds complicated, how would that work? – rubo77 Jan 18 '14 at 0:25
  • Are you trying to figure out how much bandwidth you are using, or what the maximum possible capacity is for your link? If the later, then I don't think vnstat/iftop is what you are looking for. – Zoredache Jan 18 '14 at 2:12
  • I want to measure the bandwidth I have like I can do it with speedtest.net already. But I would like to do it on my own on the console – rubo77 Jan 18 '14 at 10:39
  • 2
    This is like asking "how do I see the fastest my car can go, by watching the spedometer as I drive around the city". – Grant Jan 18 '14 at 18:55
1

Use vnstat

vnstat -i eth0 -l
Monitoring eth0...    (press CTRL-C to stop)

   rx:      704 kbit/s   104 p/s          tx:       32 kbit/s    63 p/s
   rx:      588 kbit/s    97 p/s          tx:       32 kbit/s    59 p/s
   rx:     2.56 Mbit/s   395 p/s          tx:       96 kbit/s   211 p/s^C


 eth0  /  traffic statistics

                           rx         |       tx
--------------------------------------+------------------
  bytes                     5.46 MiB  |         233 KiB
--------------------------------------+------------------
          max            3.51 Mbit/s  |      140 kbit/s
      average            1.40 Mbit/s  |    58.25 kbit/s
          min               0 kbit/s  |        4 kbit/s
--------------------------------------+------------------
  packets                       6853  |            3910
--------------------------------------+------------------
          max                514 p/s  |         315 p/s
      average                214 p/s  |         122 p/s
          min                  1 p/s  |           1 p/s
--------------------------------------+------------------
  time                    32 seconds

EDIT: read man and use the options to suite yourself, it is quite extensive.

EDIT: How to generate raw traffic for RX/TX on SERVER/CLIENT.

ON SERVER: 1) Start listening on random port '2899':

root@ub1:~# netcat -v -v -l -n -p 2899 >/dev/null &

3) Generate raw traffic from SERVER to CLIENT for 2 minutes:

 timeout -sHUP 2m yes|nc -v -v -n 192.168.1.2 3755 >/dev/null

ON CLIENT: 2) Start listening on random port '3755':

root@ub2:~# netcat -v -v -l -n -p 3755 >/dev/null &

4) Generate raw traffic from CLIENT to SERVER:

 timeout -sHUP 2m yes|nc -v -v -n 192.168.1.1 2899 >/dev/null

Start vnstat on that interface for that time while you are generating traffic to see your max/min/average.

| improve this answer | |
  • I've never even heard of that command! – ewwhite Jan 18 '14 at 1:11
  • It came from BSD, got adapted to linux later. – Danila Ladner Jan 18 '14 at 1:14
  • He question isn't entirely clear, but I think he is trying to find his maximum link capacity, not monitor what his current usage is. To max out his link the tool needs to generate traffic. I am not sure this answers the question. – Zoredache Jan 18 '14 at 2:14
  • he could still use vnstat over period of time and at that time generate traffic piping 'yes' into 'nc' or something similar, there is nothing to throttle the link on interface in default configuration sending raw data to the server, or wherever he needs to initiate the traffic from. – Danila Ladner Jan 18 '14 at 2:36
  • ok, how can I generate maximum trafic with yes and ncat? I could send data up and down to my root server – rubo77 Jan 18 '14 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.