1 Introduction

1.1 Goals

1.2 Assumptions

Your router is sending netflow records to one of your PCs, and that PC is running NfSen to collect this data. If you are working in a pair, then you should both point your web browser to whichever PC is receiving the flows:

http://pcX.ws.nsrc.org/nfsen/nfsen.php

2 Generate some traffic

Firstly, we need to generate some traffic passing through your router. On either of your PCs (it doesn't have to be the one running NfSen), login and type the following commands:

$ cd /tmp
$ wget http://noc.ws.nsrc.org/downloads/BigFile
$ rm BigFile

It will take around 5 minutes before this shows as a spike in NfSen.

3 Exploring flow records

Now let's use NfSen to explore the traffic flows in the network, with the aim of finding out who was been downloading the most data. Look carefully at the output generated at each step - ask an instructor to explain if you don't understand what you see.

The NfSen home page shows a matrix of graphs: flows per second on the left, packets per second in the middle, bits per second on the right. Click on the top-right graph (bits per second, one day view) to get to the Detail page.

3.2 Select time window

Change from "Single Timeslot" to "Time Window":

Selecting time window
Once you have done this, the vertical selector arrow and line in the graph window can be split.

Split vertical selector
Pull the left half of the arrow to the left and the right half to the right, to select the time period of interest. Then you should see some summary statistics appear in the table below the graph, for the time period you have selected:

Summary statistics

Summary statistics

3.3 List individual flows

Select "List Flows", make sure none of the "Aggregate" boxes are checked, and then click process. This will display some flows at the beginning of the time period.

List flows

List flows

Increase the limit from 20 flows to 100 flows. Notice that much network traffic consists of large numbers of very small flows - for example a DNS query/response will be two flows, one from client to DNS server, and one back again.

By selecting "bi-directional" you can get NfSen to associate the inbound and outbound flows into a single line:

Bi-directional flows

Bi-directional flows

However it's still too much work to wade through this looking for interesting traffic. Uncheck the "Bi-directional" box before continuing.

3.4 Flows to/from one host

If we know which host we want to examine, we can apply a filter to show only those flows to and from that host. Do this by entering "host 10.10.X.Y" in the filter box, and then pressing process again. (Replace 10.10.X.Y with the address of one of your PCs)

Flows to and from one host

Flows to and from one host

This is a little better, but we would still have to wade through lots of small flows to find anything significant. We need to take a different approach.

4 Largest flows

The next thing we can do is to get NfSen to sort the flows by number of bytes. Remove any filter from the Filter box; select "Stat TopN", stat "Flow Records", order by "Bytes". Ensure all the aggregate boxes are all unchecked, then press process

Find top flows by bytes

Find top flows by bytes

Output: top flows by bytes

Output: top flows by bytes

This is a definite improvement, as the flows with the largest number of bytes are shown first. However there's a problem - we are still looking at individual flows. It's possible that many small flows to the same host would add up to a large amount of traffic, but we wouldn't see them at the top of this list.

5 Inbound traffic grouped by receiver IP address

What we want to see is a single line for each host in our network, showing the total amount of traffic delivered to that host.

To do this, Stat "DST IP Address", order by "bytes".

Group flows by DST IP Address

Group flows by DST IP Address

This is now much closer to what we want: there is one line for each destination IP address, and they are ordered by total bytes, largest first.

But there is still one problem - can you see what it is? We are seeing a mixture of inbound flows (where the destination IP is inside our network) and outbound flows (where the destination IP is on the Internet). We are only interested in the inbound flows, so apply a filter which shows only traffic to your group's network: "dst net 10.10.X.0/24" (replacing X with your group number)

Flows to local network, grouped by DST IP Address

Flows to local network, grouped by DST IP Address

Output: Flows to local network, grouped by DST IP Address

Output: Flows to local network, grouped by DST IP Address

At last we have what we want. The first record you see should tell you the local machine which has downloaded the most data in the period selected.

5.1 Outbound traffic grouped by sender IP address

Question: what changes would you have to make to this query to find out which machines in your network are uploading the most data to the Internet?

6 Analysing traffic to a single host

Now that we know which host has downloaded the most data, we might want to see where it has been downloading from.

Let's start by looking at the top flows to that host. Change the filter to "dst host 10.10.X.Y" (the IP address you just found). Then select Stat "Flow Records", order by "bytes", and process.

Largest flows to one host

Largest flows to one host

You should now see the flows inbound to that host, largest first. But again, we're only seeing large individual flows; a collection of small flows may add together to a large amount of traffic.

Since we are only looking at flow records to one particular destination IP address, we can group these records by source IP address.

Flows to one host, grouped by SRC IP address

Flows to one host, grouped by SRC IP address

Output: Flows to one host, grouped by SRC IP address

Output: Flows to one host, grouped by SRC IP address

And now we have one row for each IP address this host has been downloading from, with the total number of bytes downloaded from each IP, largest total first.

6.1 IP address information

By clicking on an IP address, you will get some information from reverse DNS and whois.

Whois information

Whois information

7 Additional exercise: aggregating flows

NfSen offers some other ways to summarise the flows, using the Aggregate checkboxes. In this example we'll look again at traffic inbound to your network.

When you click one or more of the Aggregate boxes, NfSen combines all flows that share the same values of the attribute(s) you have selected.

To start this exercise, set the filter to "dst net 10.10.X.0/24" (X = your group). Select "Stat TopN", Stat "Flow Records", order by "bytes". Then try the following aggregates, remembering to click process after each one.

How would you change the filter to look at outbound traffic, rather than inbound traffic?

If you have a router with a full BGP table, you can aggregate netflow records by AS number. This is a useful way to find out what networks you are exchanging the most traffic with.