In the last article, we discussed how we can create a simple tool that can alert us when the system is having a sudden increase in network traffic. In this article, we will see that if a system is getting abnormal network traffic, then how we can analyze the traffic even further to see if the traffic is coming from some particular IP address.
So, let’s start.
Analyzing network traffic by source IP addresses
This time, we would need something more than a simple shell script. We would need to take the help of some scripting language which is much more powerful.
Let’s first discuss the idea using which we would be analyzing network traffic. Then probably, we can decide on what scripting language we can use here.
How to solve the problem?
Our job is to analyze the network traffic in the system for certain intervals. And in each interval, we need to report on how much traffic is coming from which IP.
To solve the purpose, we need to find a utility that will give us a list of IP addresses from which packets are coming. We can redirect it to an output file. The next module will take the file as input and analyze and report how much traffic has come from each IP.
The tools and scripting language
There are a couple of tools that can give us a list of IP addresses from which network packets are coming. We would here use tcpdump and tshark.
For Linux, you can install tshark easily.
# sudo apt-get install tshark
If you type the following command in the terminal, it will give you a list of IP addresses from which network traffic is coming in each 15-second interval.
# sudo tshark -i eth1 -T fields -e ip.src -a duration:15
As I said earlier, we would be redirecting it to a file. And the next module can take the file as input …








































0 Comments