When I type "sudo netstat -an", this is part of the output I get:
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.99.202.17:39922 23.82.16.66:29842 TIME_WAIT
I am confused as to what the first line is saying.
Is it saying a server from 23.82.16.66 is connecting to this server through port 29842, or port 39922?
How do I know it's an incoming connection from that IP, as opposed to an outgoing connection from my server to that IP?
I'm running CENTOS 6.7, if that matters.
Best Answer
The Local Address is the address of the machine you are running the NETSTAT commands from so understanding the state of the TCP connections will help you understand if it's incoming or outgoing from a local address perspective.
Another Good Explanation
rfc793: image source
image source
Further Resources