1 | Network Management Workshop |
---|
2 | NFSen |
---|
3 | |
---|
4 | 0. If not already installed, install the following packages: |
---|
5 | |
---|
6 | # apt-get install rrdtool |
---|
7 | # apt-get install librrds-perl |
---|
8 | # apt-get install librrdp-perl |
---|
9 | |
---|
10 | |
---|
11 | 1. Install nfdump |
---|
12 | |
---|
13 | [Nfdump is the netflow flow collector] |
---|
14 | |
---|
15 | |
---|
16 | # export INIT_VERBOSE=yes |
---|
17 | # export VERBOSE=yes |
---|
18 | # apt-get install nfdump |
---|
19 | |
---|
20 | (the lines with VERBOSE are needed to work around a bug in the |
---|
21 | package installation script) |
---|
22 | |
---|
23 | --- |
---|
24 | Installed tools are : |
---|
25 | nfcapd nfdump nfreplay nfexpire nftest nfgen |
---|
26 | --- |
---|
27 | |
---|
28 | |
---|
29 | NFSen |
---|
30 | |
---|
31 | 1. Now get nfsen |
---|
32 | |
---|
33 | $ wget http://freefr.dl.sourceforge.net/project/nfsen/stable/nfsen-1.3.2/nfsen-1.3.2.tar.gz |
---|
34 | |
---|
35 | 2. Setting up NfSen |
---|
36 | |
---|
37 | $ tar -xzf nfsen-1.3.2.tar.gz |
---|
38 | $ cd nfsen-1.3.2 |
---|
39 | $ cd etc |
---|
40 | # cp nfsen-dist.conf nfsen.conf |
---|
41 | |
---|
42 | Edit the nfsen.conf, and make the following changes: |
---|
43 | |
---|
44 | - set the basedir variable |
---|
45 | |
---|
46 | $BASEDIR = "/var/nfsen"; |
---|
47 | |
---|
48 | - set the users: |
---|
49 | |
---|
50 | $USER = "netflow" |
---|
51 | $WWWUSER = 'www-data'; |
---|
52 | $WWWGROUP = 'www-data'; |
---|
53 | |
---|
54 | - set the buffer size to something small, so we see data quickly |
---|
55 | |
---|
56 | # Receive buffer size for nfcapd - see man page nfcapd(1) |
---|
57 | $BUFFLEN = 2000; |
---|
58 | |
---|
59 | - find the %sources definition, and change it to: |
---|
60 | |
---|
61 | %sources = ( |
---|
62 | 'bb-gw' => { 'port' => '2222', 'col' => '#ff0000' }, |
---|
63 | 'pc1-5-gw' => { 'port' => '2223', 'col' => '#00ff00' }, |
---|
64 | 'pc6-10-gw' => { 'port' => '2224', 'col' => '#0000ff' }, |
---|
65 | 'pc11-15-gw' => { 'port' => '2225', 'col' => '#ffff00' }, |
---|
66 | ); |
---|
67 | |
---|
68 | - set the path for the PREFIX where to find the nfdump tools: |
---|
69 | |
---|
70 | # nfdump tools path |
---|
71 | $PREFIX = '/usr/bin'; |
---|
72 | |
---|
73 | - save the file, and exit. |
---|
74 | |
---|
75 | 3. Create a netflow user on the system. |
---|
76 | |
---|
77 | # useradd -d /var/netflow -G www-data -m -s /bin/false netflow |
---|
78 | |
---|
79 | 4. Initiating nfsen |
---|
80 | |
---|
81 | # cd .. |
---|
82 | # perl install.pl etc/nfsen.conf |
---|
83 | |
---|
84 | [press 'return' when asked where perl is located ] |
---|
85 | |
---|
86 | 5. Starting Nfsen |
---|
87 | |
---|
88 | # cd /var/nfsen/bin |
---|
89 | # ./nfsen start |
---|
90 | |
---|
91 | (You can add the nfsen startup script to /etc/init.d/rc.local or somewhere similar to start it at bootup.) |
---|
92 | |
---|
93 | Watch your browser at http://localhost/nfsen/nfsen.php |
---|
94 | |
---|
95 | 6. Add more sources: |
---|
96 | |
---|
97 | Go back to where you extracted your nfsen distribution. |
---|
98 | |
---|
99 | # cd nfsen-1.3 |
---|
100 | # vi etc/nfsen.conf |
---|
101 | |
---|
102 | %sources = ( |
---|
103 | 'mgmtgw' => { 'port' => '2254', 'col' => '#0000ff' }, |
---|
104 | 'lan1gw' => { 'port' => '2201','col' => '#00cc00' }, |
---|
105 | 'lan3gw' => { 'port' => '2203','col' => '#000000' }, |
---|
106 | 'lan4gw' => { 'port' => '2204','col' => '#ff0000' }, |
---|
107 | 'nocgw' => { 'port' => '2205','col' => '#ffff00' }, |
---|
108 | ); |
---|
109 | |
---|
110 | Save & close. |
---|
111 | |
---|
112 | # perl install.pl etc/nfsen.conf |
---|
113 | |
---|
114 | [press return when asked] |
---|
115 | |
---|
116 | 7. Start NFsen |
---|
117 | |
---|
118 | # /var/nfsen/bin/nfsen stop |
---|
119 | # /var/nfsen/bin/nfsen start |
---|
120 | |
---|
121 | 8. Check it out! |
---|
122 | |
---|
123 | http://localhost/nfsen/nfsen.php |
---|
124 | |
---|
125 | |
---|