 We've got three Linux machines a client router and server inside virtual box set up in a small Internet let's have a look at the command net stat on those machines and We'll see the different options that this provides us net stat actually provides many different sets of information network connection information network statistics We know that I have config for example shows us statistics for a particular interface Simple things like receive bytes receive packets and so on net stat has a Number of different options or modes minus. I mode shows us interface information So similarly information to I have config but in a tabular format But net stat shows us other information for example. We know the routing Table can be viewed using the route command the minus end to show the numeric addresses net stat has a net stat has a minus R for routing table information and it's identical information to the route command So as as the case with Linux a lot of times you can do the same thing or similar things using different tools and That's because of historical reasons. So people who develop different tools to do similar things. They have different trade-offs So that information we've normally seen one other another useful option for net stat. We created that is To show statistics of the TCP IP stack and That just prints out statistics and I'll first scroll up and show you those it shows IP statistics packets received IP packets received internet control message protocol Statistics ICMP like ping messages different message types and Then TCP and UDP transport layer statistics And this will change as you run your machine and there's different communications taking place TCP segments received sent out UDP packets received and Some extension information about TCP and IP which are not included by default So if you want to see information about packets sent then net stat minus s is A good starting point So as we've seen nets that has different modes like interfaces routing table statistics If we look at the man page you can go through and read about those different modes So the routing table Interfaces there's other things like groups masquerade For Network address translation statistics and The other useful one is to see TCP and UDP connections or sockets Let's have a look at that Net stat minus t for TCP minus n for numeric addresses This shows active TCP connections ongoing or established in this case That my client is involved with Importantly, it's showing that my IP address 10 dot 0 dot 2 dot 15 which is my net interface and port number 22 Which is my secure shell server? Has an established TCP connection with 10 dot 0 dot 2 dot 2 and port 34735 and a second Connection also with a secure shell server So with net stat minus t we can see Current connections to our server or connections from our from our Machine out to other servers and this is useful if we're running TC secure shell servers web servers and other servers on a machine You can see the servers that we're running or that we're listening on using a minus L option This is saying that my machine has a server listening on port 22 It also supports TCP or IP version 6, which is the second row of this one is saying I've got a secure shell Server waiting to receive packets on port 22 if I was running a web server, then maybe I'd have another entry on listening on port 80 There's a similar option for UDP Communications although that's recorded at slightly different and in my case. I have nothing happening with UDP. So there's no interesting information shown there so Read through the net stat man page and try some of those options to view information primarily the minus t option Minus you a common Routing table if you don't want to use the route command interfaces some additional information and the statistics and If you scroll through it explains a lot of the information included in the net stat output