Networking
February 25, 2020
Debugging #
Monitor Sockets #
- Get all outbound TCP connections to a HOST:PORT combination
ss -it | grep SOME_PORT_NUMBER
Monitor TCP Connections #
-
Get all TCP connections on a host
netstat -t- Observe the Send-Q and Recv-Q to see how many bytes are waiting to be read/written
-oadds timer info and connection state
-
Get Summary, good starting point to see if there are dropped packets
netstat -s
Monitor TCP Packets #
- Monitor all packets on eth0 in verbose mode
tcpdump -vvi eth0
Benchmarking HTTP requests #
NAT Box #
Port Forwarding #
Local Port Forward Access a port on a remote server accessible via a gateway
ssh -f userName@gateway -L localMachinePort:remoteHost:remoteMachinePort -N
gatewayis the middle server accessible from the hostremoteHostis the server accessible through gatewaylocalMachinePortis the port on your local machine from where the command is runremoteMachinePortis the port on the remoteHost to connect to
References #
TCP Keepalive #
- Purpose of keepalive is;
- detect a peer who has disappeared abruptly
- prevent intermediate components from getting rid of a connection (eg. NAT idle timeout )