-2

What solution do you have so that I can get the speed of downloading from a server or uploading to a server on the TCP or UDP protocol, which I do not have access to that server? but I have root access to my server.

For example, I have a server and without access to Google servers to install special programs and only having the site address or the IP of that external server, I want to know the speed of data transfer between my server and that Google server? (Similar to downloading/uploading a file)

My best option is Linux CLI platform and any idea, solution, open source code, program or any solution or suggestion is helpful.

1 Answer 1

1

I presume you have nftables or iptables available. the commands below are for iptables.

iptables -N ACCT_OUT #outbound accounting
iptables -n ACCT_IN #inbound accounting
iptables -A FORWARDING --dst <remoteip> -j ACCT_OUT 
iptables -A FORWARDING --src <remoteip> -j ACCT_IN
iptables -A ACCT_IN -p tcp 
iptables -A ACCT_IN -p udp
iptables -A ACCT_IN -p icmp
iptables -A ACCT_OUT -p tcp
iptables -A ACCT_OUT -p udp
iptables -A ACCT_OUT -p icmp

This will count bytes hitting these chains.

iptables -L -n -v -x

This will zero out the counters.

iptables -Z ACCT_OUT
iptables -Z ACCT_IN

This resource provides a much more verbose answer. https://catonmat.net/traffic-accounting-with-iptables

1
  • In general, when I type iptables -L -n -v -x, the bytes column shows a very small value compared to what my traffic has passed! Dec 25, 2022 at 13:00

Not the answer you're looking for? Browse other questions tagged .