Show elapsed (round-trip) time of packets.

$fping -e www.gnu.org
www.gnu.org is alive (301 ms)
$fping -e www.gnu.org
www.gnu.org is alive (302 ms)
$fping -e www.rajagiritech.edu.in
www.rajagiritech.edu.in is alive (62.2 ms)
$fping www.gnu.org
www.gnu.org is alive
$ping www.gnu.org
PING wildebeest.gnu.org (208.118.235.148) 56(84) bytes of data.
64 bytes from wildebeest.gnu.org (208.118.235.148): icmp_seq=1 ttl=49 time=302 ms
64 bytes from wildebeest.gnu.org (208.118.235.148): icmp_seq=2 ttl=49 time=301 ms
64 bytes from wildebeest.gnu.org (208.118.235.148): icmp_seq=3 ttl=49 time=302 ms
^C
--- wildebeest.gnu.org ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 3ms
rtt min/avg/max/mdev = 301.312/301.802/302.169/0.360 ms
$ping www.rajagiritech.edu.in
PING rajagiritech.edu.in (202.88.225.163) 56(84) bytes of data.
64 bytes from 163.225.88.202.asianet.co.in (202.88.225.163): icmp_seq=1 ttl=56 time=62.4 ms
64 bytes from 163.225.88.202.asianet.co.in (202.88.225.163): icmp_seq=2 ttl=56 time=62.0 ms
64 bytes from 163.225.88.202.asianet.co.in (202.88.225.163): icmp_seq=3 ttl=56 time=62.4 ms
^C
--- rajagiritech.edu.in ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 4ms
rtt min/avg/max/mdev = 62.038/62.254/62.368/0.254 ms
$

Installing dig command on Debian

$sudo apt-get install -y dnsutils
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libcaribou-gtk-module libcaribou-gtk3-module libebur128-1 libevent-2.0-5 libgdict-1.0-10 libgdict-common
  libgmime-2.6-0 libgnome-autoar-common libgom-1.0-common libjavascriptcoregtk-3.0-0 libnotmuch4 libpcre16-3
  libperl5.24 libraw15 libsexy2 libwebkitgtk-3.0-0 libwebpmux2 python-olefile rename tcpd
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libbind9-160 libdns169 libirs160 libisc166 libisccc160 libisccfg160 liblmdb0 liblwres160
Suggested packages:
  rblcheck
The following NEW packages will be installed:
  dnsutils libbind9-160 libdns169 libirs160 libisc166 libisccc160 libisccfg160 liblmdb0 liblwres160
0 upgraded, 9 newly installed, 0 to remove and 562 not upgraded.
Need to get 226 kB/1,804 kB of archives.
After this operation, 7,160 kB of additional disk space will be used.
Get:1 http://http.us.debian.org/debian sid/main amd64 libirs160 amd64 1:9.11.2.P1-1 [52.5 kB]
Get:2 http://http.us.debian.org/debian sid/main amd64 dnsutils amd64 1:9.11.2.P1-1 [174 kB]
Fetched 226 kB in 3s (74.3 kB/s)  
Selecting previously unselected package liblmdb0:amd64.
(Reading database ... 181458 files and directories currently installed.)
Preparing to unpack .../0-liblmdb0_0.9.21-1_amd64.deb ...
Unpacking liblmdb0:amd64 (0.9.21-1) ...
Selecting previously unselected package libisc166:amd64.
Preparing to unpack .../1-libisc166_1%3a9.11.2.P1-1_amd64.deb ...
Unpacking libisc166:amd64 (1:9.11.2.P1-1) ...
Selecting previously unselected package libdns169:amd64.
Preparing to unpack .../2-libdns169_1%3a9.11.2.P1-1_amd64.deb ...
Unpacking libdns169:amd64 (1:9.11.2.P1-1) ...
Selecting previously unselected package libisccc160:amd64.
Preparing to unpack .../3-libisccc160_1%3a9.11.2.P1-1_amd64.deb ...
Unpacking libisccc160:amd64 (1:9.11.2.P1-1) ...
Selecting previously unselected package libisccfg160:amd64.
Preparing to unpack .../4-libisccfg160_1%3a9.11.2.P1-1_amd64.deb ...
Unpacking libisccfg160:amd64 (1:9.11.2.P1-1) ...
Selecting previously unselected package libbind9-160:amd64.
Preparing to unpack .../5-libbind9-160_1%3a9.11.2.P1-1_amd64.deb ...
Unpacking libbind9-160:amd64 (1:9.11.2.P1-1) ...
Selecting previously unselected package liblwres160:amd64.
Preparing to unpack .../6-liblwres160_1%3a9.11.2.P1-1_amd64.deb ...
Unpacking liblwres160:amd64 (1:9.11.2.P1-1) ...
Selecting previously unselected package libirs160:amd64.
Preparing to unpack .../7-libirs160_1%3a9.11.2.P1-1_amd64.deb ...
Unpacking libirs160:amd64 (1:9.11.2.P1-1) ...
Selecting previously unselected package dnsutils.
Preparing to unpack .../8-dnsutils_1%3a9.11.2.P1-1_amd64.deb ...
Unpacking dnsutils (1:9.11.2.P1-1) ...
Setting up liblmdb0:amd64 (0.9.21-1) ...
Setting up libisc166:amd64 (1:9.11.2.P1-1) ...
Processing triggers for libc-bin (2.26-6) ...
Processing triggers for man-db (2.7.6.1-4) ...
Setting up liblwres160:amd64 (1:9.11.2.P1-1) ...
Setting up libisccc160:amd64 (1:9.11.2.P1-1) ...
Setting up libdns169:amd64 (1:9.11.2.P1-1) ...
Setting up libisccfg160:amd64 (1:9.11.2.P1-1) ...
Setting up libirs160:amd64 (1:9.11.2.P1-1) ...
Setting up libbind9-160:amd64 (1:9.11.2.P1-1) ...
Setting up dnsutils (1:9.11.2.P1-1) ...
Processing triggers for libc-bin (2.26-6) ...
$

finding the current state of a network cable

$sudo cat /sys/class/net/eth0/speed 
100
$sudo cat /sys/class/net/eth0/ca
carrier          carrier_changes  
$sudo cat /sys/class/net/eth0/carrier
1
$sudo cat /sys/class/net/eth0/carrier_changes 
2
$sudo cat /sys/class/net/eth0/operstate 
up
$sudo ethtool eth0
Settings for eth0:
	Supported ports: [ TP MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Supported pause frame use: No
	Supports auto-negotiation: Yes
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: Yes
	Link partner advertised link modes:  10baseT/Half 10baseT/Full 
	                                     100baseT/Half 100baseT/Full 
	Link partner advertised pause frame use: Symmetric Receive-only
	Link partner advertised auto-negotiation: Yes
	Speed: 100Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 0
	Transceiver: internal
	Auto-negotiation: on
	Supports Wake-on: pumbg
	Wake-on: g
	Current message level: 0x00000033 (51)
			       drv probe ifdown ifup
	Link detected: yes
$

http://www.ostechnix.com/how-to-find-out-the-connected-
state-of-a-network-cable-in-linux/

httping with sending of username and password and flood ping

$httping -U www.beautifulwork.org
No URL/host to ping given

$httping -U http://www.beautifulwork.org
No URL/host to ping given

$httping  http://www.beautifulwork.org
PING www.beautifulwork.org:80 (/):
connected to 89.36.208.169:80 (224 bytes), seq=0 time=455.10 ms 
connected to 89.36.208.169:80 (224 bytes), seq=1 time=458.34 ms 
connected to 89.36.208.169:80 (224 bytes), seq=2 time=447.45 ms 
^CGot signal 2
--- http://www.beautifulwork.org/ ping statistics ---
4 connects, 3 ok, 0.00% failed, time 4418ms
round-trip min/avg/max = 447.5/453.6/458.3 ms
$httping -U anonymous http://www.beautifulwork.org
$httping -U anonymous http://www.beautifulwork.org
PING www.beautifulwork.org:80 (/):
connected to 89.36.208.169:80 (224 bytes), seq=0 time=453.33 ms 
connected to 89.36.208.169:80 (224 bytes), seq=1 time=459.89 ms 
connected to 89.36.208.169:80 (224 bytes), seq=2 time=451.59 ms 
connected to 89.36.208.169:80 (224 bytes), seq=3 time=455.54 ms 
connected to 89.36.208.169:80 (224 bytes), seq=4 time=448.82 ms 
^CGot signal 2
--- http://www.beautifulwork.org/ ping statistics ---
5 connects, 5 ok, 0.00% failed, time 6948ms
round-trip min/avg/max = 448.8/453.8/459.9 ms
$httping -U userfoo http://www.beautifulwork.org
PING www.beautifulwork.org:80 (/):
connected to 89.36.208.169:80 (224 bytes), seq=0 time=449.55 ms 
connected to 89.36.208.169:80 (224 bytes), seq=1 time=462.89 ms 
connected to 89.36.208.169:80 (224 bytes), seq=2 time=446.10 ms 
connected to 89.36.208.169:80 (224 bytes), seq=3 time=445.94 ms 
^CGot signal 2
--- http://www.beautifulwork.org/ ping statistics ---
4 connects, 4 ok, 0.00% failed, time 5721ms
round-trip min/avg/max = 445.9/451.1/462.9 ms
$httping -U userfoo -P withfoo http://www.beautifulwork.org
PING www.beautifulwork.org:80 (/):
connected to 89.36.208.169:80 (224 bytes), seq=0 time=459.03 ms 
connected to 89.36.208.169:80 (224 bytes), seq=1 time=445.85 ms 
connected to 89.36.208.169:80 (224 bytes), seq=2 time=489.32 ms 
connected to 89.36.208.169:80 (224 bytes), seq=3 time=461.37 ms 
^CGot signal 2
--- http://www.beautifulwork.org/ ping statistics ---
4 connects, 4 ok, 0.00% failed, time 5614ms
round-trip min/avg/max = 445.8/463.9/489.3 ms



$httping -f http://www.beautifulwork.org
PING www.beautifulwork.org:80 (/):
connected to 89.36.208.169:80 (224 bytes), seq=0 time=458.52 ms 
connected to 89.36.208.169:80 (224 bytes), seq=1 time=447.23 ms 
connected to 89.36.208.169:80 (224 bytes), seq=2 time=442.29 ms 
connected to 89.36.208.169:80 (224 bytes), seq=3 time=444.83 ms 
connected to 89.36.208.169:80 (224 bytes), seq=4 time=456.58 ms 
connected to 89.36.208.169:80 (224 bytes), seq=5 time=446.09 ms 
connected to 89.36.208.169:80 (224 bytes), seq=6 time=447.35 ms 
^CGot signal 2

--- http://www.beautifulwork.org/ ping statistics ---
8 connects, 7 ok, 12.50% failed, time 3580ms
round-trip min/avg/max = 442.3/449.0/458.5 ms
$

A typical hack with strace command which traces a ping command

ABOUT strace

strace is a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as ptrace.

TYPICAL strace COMMAND RELATED
[bash]
$sudo strace -c -p `pidof ping`
strace: Process 4792 attached
% time seconds usecs/call calls errors syscall
—— ———– ———– ——— ——— —————-
43.34 0.001631 203 8 sendto
24.79 0.000933 116 8 1 recvmsg
16.40 0.000617 56 11 write
13.13 0.000494 70 7 poll
1.44 0.000054 54 1 restart_syscall
0.90 0.000034 34 1 1 rt_sigreturn
—— ———– ———– ——— ——— —————-
100.00 0.003763 36 2 total
$

[/bash]
LINK
https://en.wikipedia.org/wiki/Strace
https://www.tecmint.com/strace-commands-for-troubleshooting-and-debugging-linux/

sample session with “ss” command to show details on network

$ss -t
State      Recv-Q Send-Q                            Local Address:Port                                             Peer Address:Port                
ESTAB      0      0                                 192.168.0.100:57982                                           216.58.197.34:https                
ESTAB      0      0                                 192.168.0.100:56572                                           216.58.196.98:https                
ESTAB      0      0                                 192.168.0.100:51440                                           216.58.220.34:https                
ESTAB      0      0                                 192.168.0.100:56850                                          216.58.196.110:https                
ESTAB      0      0                                 192.168.0.100:42946                                           216.58.220.46:https                
ESTAB      0      0                                 192.168.0.100:42758                                           216.58.197.46:https                
ESTAB      0      0                                 192.168.0.100:32912                                           216.58.220.33:https                
ESTAB      0      0                                 192.168.0.100:40452                                           216.58.220.38:https                
ESTAB      0      0                                 192.168.0.100:51128                                           182.79.251.80:https                
ESTAB      0      0                                 192.168.0.100:38490                                           216.58.220.35:https                
ESTAB      0      0                                 192.168.0.100:37378                                           216.58.196.97:https                
ESTAB      0      0                                 192.168.0.100:41954                                          216.58.196.100:https                
CLOSE-WAIT 1      0                                 192.168.0.100:43954                                          74.125.100.153:https                
ESTAB      0      0                                 192.168.0.100:42908                                           216.58.197.74:https                
ESTAB      0      0                                 192.168.0.100:37384                                           216.58.196.97:https                
ESTAB      0      0                                 192.168.0.100:56818                                          216.58.196.110:https                
ESTAB      1430   0                                 192.168.0.100:51130                                           182.79.251.80:https                
$ss -s
Total: 875 (kernel 0)
TCP:   22 (estab 16, closed 1, orphaned 0, synrecv 0, timewait 1/0), ports 0

Transport Total     IP        IPv6
*	  0         -         -        
RAW	  1         0         1        
UDP	  17        15        2        
TCP	  21        19        2        
INET	  39        34        5        
FRAG	  0         0         0        

$

Capturing TCP Flags with tcpdump. Capture ACK or SYN packets

ABOUT TCP FLAGS

They are control bits that indicate different connection states or information about how a packet should be handled.

FLAGS

CWR – Congestion Window Reduced (CWR) flag is set by the sending host to indicate that it received a TCP segment with the ECE flag set (added to header by RFC 3168).
ECE (ECN-Echo) – indicate that the TCP peer is ECN capable during 3-way handshake (added to header by RFC 3168).
URG – indicates that the URGent pointer field is significant
ACK – indicates that the ACKnowledgment field is significant (Sometimes abbreviated by tcpdump as “.”)
PSH – Push function
RST – Reset the connection (Seen on rejected connections)
SYN – Synchronize sequence numbers (Seen on new connections)
FIN – No more data from sender (Seen after a connection is closed)

TYPICAL COMMAND LINE SESSION (output formatted to cut a single long line into two)
[bash]
$sudo tcpdump -XX "tcp[tcpflags] & (tcp-syn|tcp-ack) != 0"
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on wlp2s0, link-type EN10MB (Ethernet), capture size 262144 bytes
22:08:02.921549 IP debian.local.56418 > 192.0.78.23.https: Flags [.], ack 3664749642, win 501, length 0
0x0000: 0cd2 b591 a80b 6814 0107 361f 0800 4500 ……h…6…E.
0x0010: 0028 3a09 4000 4006 3101 c0a8 0106 c000 .(:.@.@.1…….
0x0020: 4e17 dc62 01bb 200d 551f da6f a44a 5010 N..b….U..o.JP.
0x0030: 01f5 0c15 0000 ……
22:08:02.959138 IP 192.0.78.23.https > debian.local.56418: Flags [.], ack 1, win 78, length 0
0x0000: 6814 0107 361f 0cd2 b591 a80b 0800 4500 h…6………E.
0x0010: 0028 b2cf 4000 3906 bf3a c000 4e17 c0a8 .(..@.9..:..N…
0x0020: 0106 01bb dc62 da6f a44a 200d 5520 5010 …..b.o.J..U.P.
0x0030: 004e 0dbb 0000 .N….
^C22:08:03.227185 IP debian.local.56024 > 182.79.251.94.https: Flags [P.], seq 2644787003:2644788130, ack
4261478870, win 7206, options [nop,nop,TS val 358601242 ecr 4159929275], length 1127
0x0000: 0cd2 b591 a80b 6814 0107 361f 0800 4500 ……h…6…E.
0x0010: 049b 4e0c 4000 4006 74f4 c0a8 0106 b64f ..N.@.@.t……O
0x0020: fb5e dad8 01bb 9da4 3f3b fe01 01d6 8018 .^……?;……
0x0030: 1c26 8f4b 0000 0101 080a 155f d21a f7f3 .&.K……._….
0x0040: 7bbb 1703 0304 6200 0000 0000 0000 2347 {…..b…….#G
0x0050: b28f ea65 e5ad a09c 9d39 7d8a dc7b 6f57 …e…..9}..{oW
0x0060: 81bf 1973 edbb c9f8 77cd b9ea 0c1d fc80 …s….w…….
0x0070: 8725 5b18 0680 0313 85b8 5ec5 28a8 99dd .%[…….^.(…
0x0080: 24cc 78f7 6a2c 0696 d782 9fe8 1523 2e3f $.x.j,…….#.?
0x0090: 5863 674a 60f5 4375 c367 45e4 f445 2ee8 XcgJ`.Cu.gE..E..
0x00a0: 1002 17a3 b425 1898 e35a beb1 2ca0 6bbd …..%…Z..,.k.
0x00b0: 7578 3793 3426 0bdd a0ed 6114 226a d771 ux7.4&….a."j.q
0x00c0: 2581 1975 e4ea 2222 d7b1 6f7e e236 ca98 %..u..""..o~.6..
0x00d0: 6580 43c8 b804 5e25 9c39 c76d 568f f235 e.C…^%.9.mV..5
0x00e0: 84e2 d2de 3c4b 5cde 0f5e 57e7 5441 a4c6 ….<K\..^W.TA..
0x00f0: d96c f94a 76c1 fd07 6070 4df3 8c46 c11f .l.Jv…`pM..F..
0x0100: 4fa5 31cd 3a40 7195 363f 9ee8 0ead 143d O.1.:@q.6?…..=
0x0110: 640f f792 bf20 6b7a 82f1 fe39 c683 f760 d…..kz…9…`
0x0120: 041d bea9 b2d7 fbb6 0b7f c8bd 5124 5fff …………Q$_.
0x0130: 4251 607e 8052 61f9 3329 6ebe 2d5f 2978 BQ`~.Ra.3)n.-_)x
0x0140: 0afe 3d98 7d94 a911 ceaf ad53 56ac c93b ..=.}……SV..;
0x0150: ba35 c8dd d2d0 6bbe 38c0 103d 59a4 589c .5….k.8..=Y.X.
0x0160: 6bde 55ca 6297 44b8 5302 2d1c 0a2c 6d23 k.U.b.D.S.-..,m#
0x0170: a72b 0d69 d25a 4a2e 3c94 439d be2a 35c2 .+.i.ZJ.<.C..*5.
0x0180: 3cde 2094 ef3b 9a09 f408 d23e e148 d49c <….;…..>.H..
0x0190: 1c28 339f facf 4241 632f e797 754b a681 .(3…BAc/..uK..
0x01a0: bced 861c 40a8 ac6f b170 0831 e750 58c5 ….@..o.p.1.PX.
0x01b0: bff1 1312 8b5e 36b7 9b4b 89d0 5a78 2b15 …..^6..K..Zx+.
0x01c0: 32ae 9723 b66f 876b 23b6 4daa c452 a68e 2..#.o.k#.M..R..
0x01d0: 3a18 68c5 468f 93a8 781c 4a16 1ab4 b1f6 :.h.F…x.J…..
0x01e0: 885a 2c5f 38d3 b9ce 830c 20db 83c8 7e1e .Z,_8………~.
0x01f0: cfbd df7f 24aa af9b 03ca 8a53 0513 9c8f ….$……S….
0x0200: ec60 2c22 521c 73c2 7895 d506 dd0c 4314 .`,"R.s.x…..C.
0x0210: 9aac 943c fb0e e3c3 a8ab 774a 5275 6a0d …<……wJRuj.
0x0220: 3475 4e48 c69f 244e 369d 935c c47f 57d3 4uNH..$N6..\..W.
0x0230: ce2f 2785 222c 294c 891b 913e b261 55ad ./’.",)L…>.aU.
0x0240: 9780 4369 b16c baf0 35ec ebe1 ba84 5d8a ..Ci.l..5…..].
0x0250: 6dd0 ada9 a0f5 090f a01e 7eb1 a678 7b8b m………~..x{.
0x0260: c3b0 65e9 0c57 6dcc 4d7f dfcf 7dd5 4b6f ..e..Wm.M…}.Ko
0x0270: c678 a847 1748 6b1e c85a 36e4 f0c5 c018 .x.G.Hk..Z6…..
0x0280: f213 15db e0ff 03e0 16b9 8ca9 2560 0e9f …………%`..
0x0290: f7c9 b334 ee4e dd36 a944 0047 4c3e 22fc …4.N.6.D.GL>".
0x02a0: 3cc3 49e6 020b af88 ddd8 6255 7f08 5243 <.I…….bU..RC
0x02b0: 195e e59e 9355 2069 71f0 0b84 7b0e b965 .^…U.iq…{..e
0x02c0: 5636 4569 574c dd4a 9f80 b39f c993 92c1 V6EiWL.J……..
0x02d0: 5222 7e11 11a8 ebad 0921 b6a3 5c9d 2b12 R"~……!..\.+.
0x02e0: 8c0c 7260 d949 0566 4848 2c8f 65e1 0d72 ..r`.I.fHH,.e..r
0x02f0: bf1a 5bbe 085f 559e 26fa 776d ec23 64f5 ..[.._U.&.wm.#d.
0x0300: 07b6 8484 7dee 5fa0 655d 6e24 2f4d 5c09 ….}._.e]n$/M\.
0x0310: d4ab 4521 33c0 54a6 691e 8622 c012 7648 ..E!3.T.i.."..vH
0x0320: d016 0ae2 9338 6d9a 1e61 c6f8 608d 721e …..8m..a..`.r.
0x0330: 6d8d 4933 c0d2 a387 1f66 ec8b 2ca6 b805 m.I3…..f..,…
0x0340: b30b 3ec4 d2e1 3f6f 1aaa cdbf a9c5 29a8 ..>…?o……).
0x0350: f9b8 76a8 d8d0 beae 6ee5 0314 6b4d 7af4 ..v…..n…kMz.
0x0360: 5626 1cd0 c859 8b5e 9168 ca44 45f0 3b3a V&…Y.^.h.DE.;:
0x0370: a46a 048a 3aa3 6d7f 3be9 069e 8bc5 48b9 .j..:.m.;…..H.
0x0380: 4514 b4a4 2a88 fbfd 89d6 cdb6 d4b3 28b1 E…*………(.
0x0390: c6e9 1aed 3d53 5d2c 8da9 837f ca20 ca08 ….=S],……..
0x03a0: 0bc1 0a44 7055 2452 6cee 6ae4 d955 f559 …DpU$Rl.j..U.Y
0x03b0: 4b9e 75ac 3d00 dda5 1270 675c b5c9 3458 K.u.=….pg\..4X
0x03c0: 18b9 60a0 4493 09fd 6742 bc9c 663a e6ca ..`.D…gB..f:..
0x03d0: ef69 7b3f 0135 4379 6d62 60e9 c686 b49d .i{?.5Cymb`…..
0x03e0: 40f0 c2e4 c04e 33cb ef59 be72 ba93 1b57 @….N3..Y.r…W
0x03f0: 9e5d 7dbd a22a 06cc 992b 078e 7d00 e975 .]}..*…+..}..u
0x0400: b5d8 f6ff daf2 7d44 d47b 7a13 d2d1 f0ef ……}D.{z…..
0x0410: f185 8268 6a9c 68c2 1cb0 967d 733e 3e4c …hj.h….}s>>L
0x0420: f8dc 0aa6 fe5b 0b8b b05d 1b38 8a4e df09 …..[…].8.N..
0x0430: a4e6 b170 c409 a9c6 8dc3 ab38 d116 1939 …p…….8…9
0x0440: 77c3 aafa e95d db83 c37a c099 9d39 0afa w….]…z…9..
0x0450: 04d0 4420 fbd6 f0ca 61f6 17d0 c66a 70bc ..D…..a….jp.
0x0460: 6e56 1f7c fce1 68fa add6 81c6 78e6 c96e nV.|..h…..x..n
0x0470: 34a5 55b1 903a 026c 3f44 dd12 0d84 7d03 4.U..:.l?D….}.
0x0480: 9ab8 668c 7723 79b2 29c3 0cc8 205c 99df ..f.w#y.)….\..
0x0490: 2f4e 6e6f 69e9 27a3 7e51 d729 2da6 6486 /Nnoi.’.~Q.)-.d.
0x04a0: bfdd d0c4 457c ae6e cc ….E|.n.

3 packets captured
139 packets received by filter
132 packets dropped by kernel
$

[/bash]
ABOUT TCP

The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite. It originated in the initial network implementation in which it complemented the Internet Protocol (IP). Therefore, the entire suite is commonly referred to as TCP/IP. TCP provides reliable, ordered, and error-checked delivery of a stream of octets (bytes) between applications running on hosts communicating via an IP network. Major internet applications such as the World Wide Web, email, remote administration, and file transfer rely on TCP. Applications that do not require reliable data stream service may use the User Datagram Protocol (UDP), which provides a connectionless datagram service that emphasizes reduced latency over reliability.

LINKS
https://www.netgate.com/docs/pfsense/firewall/tcp-flag-definitions.html
https://en.wikipedia.org/wiki/Transmission_Control_Protocol
https://serverfault.com/questions/217605/how-to-capture-ack-or-syn-packets-by-tcpdump

Hacking with debian netselect-apt command

$sudo netselect-apt -t 2 -c IN
Using distribution stable.
Retrieving the list of mirrors from www.debian.org...

--2014-08-31 23:00:07--  http://www.debian.org/mirror/mirrors_full
Resolving www.debian.org (www.debian.org)... 140.211.15.34, 128.31.0.51
Connecting to www.debian.org (www.debian.org)|140.211.15.34|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 350858 (343K) [text/html]
Saving to: ‘/tmp/netselect-apt.Pjgwxz’

100%[====================================================================================>] 3,50,858     110KB/s   in 3.1s   

2014-08-31 23:00:11 (110 KB/s) - ‘/tmp/netselect-apt.Pjgwxz’ saved [350858/350858]

Choosing a main Debian mirror using netselect.
(will filter only for mirrors in country IN)
Running netselect to choose 2 out of 4 addresses.       
...........
Only found  1 hosts out of  2 requested.
The fastest 2 servers seem to be:

	http://debian.mirror.net.in/debian/

Of the hosts tested we choose the fastest valid for HTTP:
        http://debian.mirror.net.in/debian/

Writing sources.list.
sources.list exists, moving to sources.list.1409506243
Done.
$

Tinkering with the fping command

$fping   192.168.0.1
192.168.0.1 is alive
$fping   192.168.0.2
ICMP Host Unreachable from 192.168.0.103 for ICMP Echo sent to 192.168.0.2
ICMP Host Unreachable from 192.168.0.103 for ICMP Echo sent to 192.168.0.2
ICMP Host Unreachable from 192.168.0.103 for ICMP Echo sent to 192.168.0.2
ICMP Host Unreachable from 192.168.0.103 for ICMP Echo sent to 192.168.0.2
192.168.0.2 is unreachable
$fping   192.168.0.3
ICMP Host Unreachable from 192.168.0.103 for ICMP Echo sent to 192.168.0.3
ICMP Host Unreachable from 192.168.0.103 for ICMP Echo sent to 192.168.0.3
ICMP Host Unreachable from 192.168.0.103 for ICMP Echo sent to 192.168.0.3
ICMP Host Unreachable from 192.168.0.103 for ICMP Echo sent to 192.168.0.3
192.168.0.3 is unreachable
$fping  -c1  192.168.0.1
192.168.0.1 : [0], 84 bytes, 0.29 ms (0.29 avg, 0% loss)

192.168.0.1 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.29/0.29/0.29
$fping  -c1 -s 192.168.0.1
192.168.0.1 : [0], 84 bytes, 0.27 ms (0.27 avg, 0% loss)

192.168.0.1 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 0.27/0.27/0.27

       1 targets
       1 alive
       0 unreachable
       0 unknown addresses

       0 timeouts (waiting for response)
       1 ICMP Echos sent
       1 ICMP Echo Replies received
       0 other ICMP received

 0.27 ms (min round trip time)
 0.27 ms (avg round trip time)
 0.27 ms (max round trip time)
        0.000 sec (elapsed real time)

$

Hacking with httping for simple speed study

ABOUT httping

httping - measure the latency and throughput of a webserver

A TYPICAL SHELL SESSION
[bash]
$httping http://www.beautifulwork.org
PING http://www.beautifulwork.org:80 (www.beautifulwork.org):
connected to 80.79.116.205:80 (490 bytes), seq=0 time=809.49 ms
connected to 80.79.116.205:80 (490 bytes), seq=1 time=807.21 ms
connected to 80.79.116.205:80 (490 bytes), seq=2 time=788.23 ms
connected to 80.79.116.205:80 (490 bytes), seq=3 time=796.85 ms
^CGot signal 2
http://www.beautifulwork.org ping statistics —
5 connects, 4 ok, 0.00% failed, time 7256ms
round-trip min/avg/max = 788.2/800.4/809.5 ms
$httping -c4 -g http://www.beautifulwork.org
PING http://www.beautifulwork.org:80 (www.beautifulwork.org):
connected to 80.79.116.205:80 (490 bytes), seq=0 time=786.45 ms
connected to 80.79.116.205:80 (490 bytes), seq=1 time=798.73 ms
connected to 80.79.116.205:80 (490 bytes), seq=2 time=806.86 ms
connected to 80.79.116.205:80 (490 bytes), seq=3 time=883.28 ms
http://www.beautifulwork.org ping statistics —
4 connects, 4 ok, 0.00% failed, time 6276ms
round-trip min/avg/max = 786.4/818.8/883.3 ms
$httping -c4 -Gg http://www.beautifulwork.org
PING http://www.beautifulwork.org:80 (www.beautifulwork.org):
connected to 80.79.116.205:80 (1434 bytes), seq=0 time=819.49 ms
connected to 80.79.116.205:80 (1434 bytes), seq=1 time=799.30 ms
connected to 80.79.116.205:80 (1434 bytes), seq=2 time=830.68 ms
connected to 80.79.116.205:80 (1434 bytes), seq=3 time=806.28 ms
http://www.beautifulwork.org ping statistics —
4 connects, 4 ok, 0.00% failed, time 6256ms
round-trip min/avg/max = 799.3/813.9/830.7 ms
$

$httping -c4 -Gg http://www.worldcuplivematches.net
PING http://www.worldcuplivematches.net:80 (www.worldcuplivematches.net):
connected to 119.18.56.76:80 (581 bytes), seq=0 time=6641.52 ms
connect time out
connected to 119.18.56.76:80 (581 bytes), seq=2 time=6047.30 ms
connect time out
http://www.worldcuplivematches.net ping statistics —
4 connects, 2 ok, 50.00% failed, time 75717ms
round-trip min/avg/max = 6047.3/6344.4/6641.5 ms
$

$httping -c4 -Gg http://www.worldcuplivematches.net
PING http://www.worldcuplivematches.net:80 (www.worldcuplivematches.net):
connected to 119.18.56.76:80 (581 bytes), seq=0 time=628.55 ms
connected to 119.18.56.76:80 (581 bytes), seq=1 time=737.22 ms
connected to 119.18.56.76:80 (581 bytes), seq=2 time=629.63 ms
connected to 119.18.56.76:80 (581 bytes), seq=3 time=648.22 ms
http://www.worldcuplivematches.net ping statistics —
4 connects, 4 ok, 0.00% failed, time 5644ms
round-trip min/avg/max = 628.6/660.9/737.2 ms
$

[/bash]