This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| network_stuff:tcpdump [2021/06/20 15:48] – jotasandoku | network_stuff:tcpdump [2023/11/02 14:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | **__TCPDUMP__** \\ | + | **__TCPDUMP NOTES__** \\ |
| - | '' | + | [[https:// |
| To write the tcpdump output in pcap format. If we Add capital W, that means rotate: | To write the tcpdump output in pcap format. If we Add capital W, that means rotate: | ||
| tcpdump -ni eth0 -s0 -w / | tcpdump -ni eth0 -s0 -w / | ||
| tcpdump -ni eth0 -w / | tcpdump -ni eth0 -w / | ||
| tcpdump -nni bond1 -w / | tcpdump -nni bond1 -w / | ||
| + | tcpdump -e -r sflow_2022_new.pcap | ||
| After capture, transfer example: | After capture, transfer example: | ||
| - | gk# scp root@slingshot2.nj.grapeshot.co.uk:/ | + | gk# scp root@slingshot2.nj.mycompany1.co.uk:/ |
| - | hm# scp root@gatekeeper.grapeshot.co.uk:/ | + | hm# scp root@gatekeeper.mycompany1.co.uk:/ |
| remote# rm / | remote# rm / | ||
| gk# rm / | gk# rm / | ||
| Line 25: | Line 25: | ||
| tcpdump -nni any portrange 60000-60100 | tcpdump -nni any portrange 60000-60100 | ||
| tcpdump -vv -e -nni any ether proto 0x8809 | tcpdump -vv -e -nni any ether proto 0x8809 | ||
| + | tcpdump -n -i eth0 -A -x dst port 443 and greater 100 # packet lenght | ||
| Line 94: | Line 95: | ||
| ---- | ---- | ||
| - | + | **LIBCAP RELATED UTILITIES** | |
| - | __**TCP NOTES**__ | + | |
| - | * MSS is Announced (not really negotiated but just announced), in the 3 way handshake | + | |
| - | * Window scaling is also announced in the 3 way handshake. The default window size is 64kB which is far too small. That's way w. scaling is ON 99% of the times | + | |
| - | * SACK also announced in the 3 way handshake and also ON 99% of the times. If received 1,2,3 5,6 but not 4, I acknoledge 3 and ' | + | |
| - | \\ | + | |
| - | The ACK number for a packet is the packet' | + | |
| - | + | ||
| - | \\ | + | |
| - | * The __**congestion window**__ is a **sender imposed** window that was implemented to avoid overrunning some routers in the middle of the network path. The **sender, with each segment sent, increases the congestion window slightly**, i.e. the sender will allow itself more outstanding sent data. | + | |
| - | * You can't ' | + | |
| - | * The **__receive window__** is the amount of data the **receiver can take at once without getting overwhelmed**. Managed by the receiver, who sends out window sizes to the sender. The window sizes announce the number of bytes still free in the receiver buffer, i.e. the number of bytes the sender can still send without needing an acknowledgement from the receive | + | |
| - | \\ | + | |
| - | + | ||
| - | ---- | + | |
| - | + | ||
| - | __TCP CONGESTION CONTROL ALGORITHMS__ (Reno, Cubic, Tahoe, more recently, BBR + Vegas, , Westwood) | + | |
| - | [[https:// | + | |
| - | + | ||
| - | * sysctl net.ipv4.tcp_congestion_control | + | |
| - | * sysctl net.ipv4.tcp_available_congestion_control | + | |
| - | * sysctl -w net.ipv4.tcp_congestion_control=bbr | + | |
| - | + | ||
| - | To test performance: | + | |
| - | tc qdisc replace dev enp0s20f0 root netem loss 1.5% latency 70ms # introduces some latency and packet loss | + | |
| - | + | ||
| - | + | ||
| - | WINDOWING: | + | |
| - | * MSS and window scaling is negotiated at the beginning. Normally ~*128 | + | |
| - | + | ||
| - | When a port is not available and the connection is rejected, an ICMP unreachable message is sent and then a RST tcp packet | + | |
| - | + | ||
| - | + | ||
| - | ---- | + | |
| - | __TCP OPTIMIZATION__\\ | + | |
| - | [[https:// | + | |
| \\ | \\ | ||
| - | - **NAGLE**: Aim is to reduce | + | tcprewrite |
| - | - TCP_NODELAY socket option allows your network to bypass Nagle Delays by disabling Nagle' | + | |
| - | - **Delayed ACK**: is basically a bet taken by the destination betting 200 - 500 ms, that a new packet will arrive before the delayed ACK timer expires. | + | |
| - | - To disable Delayed ACKs, use the TCP_QUICKACK socket option. | + | [[https:// |