Hello,
I have found some good tips about using netstat on : https://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html
One particular tip I’d like to ask is to listen to traffic of a specific IP address, with this:
netstat -nat |grep {IP-address} | awk '{print $6}' | sort | uniq -c | sort -n
I already run the command and don’t know where the output is saved.
How can I find the output file?
Thanks
Regards,
huskylove
Welcome @huskylove
The output is not saved anywhere else. You will get outputs on the screen if matched by grep. That is all. With your command I would say you might only see output as follows:
1 CLOSE_WAIT
6 ESTABLISHED
Try replacing $6 with $5 in awk:
netstat -nat |grep IP | awk '{print $5}' | sort | uniq -c | sort -n
netstat -nat |grep '10.8.0.2' | awk '{print $5}' | sort | uniq -c | sort -n
Now I see:
1 104.16.26.34:443
1 172.217.160.206:443
1 172.217.166.170:443
1 172.217.194.188:5228
2 104.244.42.2:443
2 151.101.65.140:443
5 104.91.84.43:443
7 10.8.0.1:3128
Is that what you want?
oh yes, thanks. I will try this immediately. The problem is I didn’t see any result after the command is executed. That’s why I asked.
Nope, I didn’t see any output. I can use the command for IoT device such as IP Camera, can’t I?
Is this standard Linux box? IoT? Router? The netstat command may not work on IoT or router as those use different version. Try debugging command one by one. Start with
netstat -nat
Do you see output? If so, add next part:
netstat -nat | grep 192.168.2.100
Try out and let me know how it went.
Command netstat -nat returned all active internet connections from my device (Lenovo with Kali Linux) to foreign addresses.
This command didn’t return any output:
I changed the ip address with IP address of the camera, didn’t return anything.
Which tool can I use for listening particular port of an ip camera?
Raj
November 27, 2019, 3:28pm
7
IS the camera using UDP? The -nat
only looks for TCP connection. For UDP add -u
netstat -natu | grep IP
Hi Raj,
the camera is using TCP and UDP.