INSTALL.PF_RING 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. An up to date version of this document is available online at:
  2. https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Installation_with_PF_RING
  3. #Install DKMS
  4. apt-get install dkms
  5. #We need subversion for checking out the PF_RING code we need flex and bisonfor libpcap
  6. apt-get install subversion flex bison
  7. #Install the debs needed for suricata.
  8. apt-get install libpcap-dev libyaml-dev zlib1g-dev libcap-ng-dev libnet1-dev libpcre2-dev
  9. #In the exmple we will build from the GIT repo so we will need some extra packages
  10. apt-get install git-core automake autoconf libtool
  11. #Go to /usr/src/ we will need to be here to build our modules
  12. cd /usr/src/
  13. #Checkout the PF_RING code
  14. svn --force export https://svn.ntop.org/svn/ntop/trunk/PF_RING/ PF_RING_CURRENT_SVN
  15. #Create the DKMS build directory and copy files over for the main PF_RING module
  16. mkdir /usr/src/pf_ring-4
  17. cp -Rf /usr/src/PF_RING_CURRENT_SVN/kernel/* /usr/src/pf_ring-4/
  18. cd /usr/src/pf_ring-4/
  19. #Create a file called dkms.conf and place the following into the file.
  20. nano dkms.conf
  21. PACKAGE_NAME="pf_ring"
  22. PACKAGE_VERSION="4"
  23. BUILT_MODULE_NAME[0]="pf_ring"
  24. DEST_MODULE_LOCATION[0]="/kernel/net/pf_ring/"
  25. AUTOINSTALL="yes"
  26. #Build and install the module we don't build a deb as currently this appears to be broken in Ubuntu-10.04
  27. dkms add -m pf_ring -v 4
  28. dkms build -m pf_ring -v 4
  29. dkms install -m pf_ring -v 4
  30. #if you issue the following command you can see that pf_ring should now be installed as DKMS module
  31. dkms status
  32. #Now lets go through the steps to build a e1000e PF_RING aware driver.
  33. mkdir /usr/src/e1000e-pf_ring-1.3.10a
  34. cd /usr/src/PF_RING_CURRENT_SVN/drivers/intel/e1000e/e1000e-1.3.10a/src/
  35. #We copy this over so that DKMS can find it for driver rebuilds
  36. cp -Rf /usr/src/PF_RING_CURRENT_SVN/drivers/intel/e1000e/e1000e-1.3.10a/src/* /usr/src/e1000e-pf_ring-1.3.10a/
  37. cp -f /usr/src/PF_RING_CURRENT_SVN/kernel/linux/pf_ring.h /usr/src/e1000e-pf_ring-1.3.10a/
  38. #Fix the path to pf_ring.h
  39. cd /usr/src/e1000e-pf_ring-1.3.10a/
  40. sed -i -e 's/\.\.\/\.\.\/\.\.\/\.\.\/\.\.\/kernel\/linux\/pf\_ring\.h/pf\_ring\.h/' netdev.c
  41. #Create a file called dkms.conf and place the following into the file.
  42. nano dkms.conf
  43. PACKAGE_NAME="e1000e-pf_ring"
  44. PACKAGE_VERSION="1.3.10a"
  45. BUILT_MODULE_NAME[0]="e1000e"
  46. DEST_MODULE_LOCATION[0]="/kernel/drivers/net/e1000e/"
  47. AUTOINSTALL="yes"
  48. #Build and install the module we don't build a deb as currently this appears to be broken in Ubuntu-10.04
  49. dkms add -m e1000e-pf_ring -v 1.3.10a
  50. dkms build -m e1000e-pf_ring -v 1.3.10a
  51. dkms install -m e1000e-pf_ring -v 1.3.10a
  52. #Now lets go through the steps to build a e1000 PF_RING aware driver.
  53. mkdir /usr/src/e1000-pf_ring-8.0.30
  54. cd /usr/src/PF_RING_CURRENT_SVN/drivers/intel/e1000/e1000-8.0.30/src/
  55. #We copy this over so that DKMS can find it for driver rebuilds
  56. cp -Rf /usr/src/PF_RING_CURRENT_SVN/drivers/intel/e1000/e1000-8.0.30/src/* /usr/src/e1000-pf_ring-8.0.30
  57. cp -f /usr/src/PF_RING_CURRENT_SVN/kernel/linux/pf_ring.h /usr/src/e1000-pf_ring-8.0.30
  58. #Fix the path to pf_ring.h
  59. cd /usr/src/e1000-pf_ring-8.0.30
  60. sed -i -e 's/\.\.\/\.\.\/\.\.\/\.\.\/\.\.\/kernel\/linux\/pf\_ring\.h/pf\_ring\.h/' e1000_main.c
  61. #Create a file called dkms.conf and place the following into the file.
  62. nano dkms.conf
  63. PACKAGE_NAME="e1000-pf_ring"
  64. PACKAGE_VERSION="8.0.30"
  65. BUILT_MODULE_NAME[0]="e1000"
  66. DEST_MODULE_LOCATION[0]="/kernel/drivers/net/e1000/"
  67. AUTOINSTALL="yes"
  68. dkms add -m e1000-pf_ring -v 8.0.30
  69. dkms build -m e1000-pf_ring -v 8.0.30
  70. dkms install -m e1000-pf_ring -v 8.0.30
  71. #Make the dir structure to hold are PF_RING enabled userland Apps.
  72. mkdir -p /opt/PF_RING/{bin,lib,include/linux,sbin}
  73. #Build and install the userland lib.
  74. cp -f /usr/src/PF_RING_CURRENT_SVN/kernel/linux/pf_ring.h /opt/PF_RING/include/linux/
  75. cd /usr/src/PF_RING_CURRENT_SVN/userland/lib
  76. ./configure
  77. sed -i -e 's/INSTDIR = \${DESTDIR}\/usr\/local/INSTDIR = \${DESTDIR}\/opt\/PF_RING/' Makefile
  78. cp -f pfring_e1000e_dna.h /opt/PF_RING/include
  79. make && make install
  80. #Build and install the PF_RING enabled libpcap
  81. #PF_RING enabled libpcap
  82. cd /usr/src/PF_RING_CURRENT_SVN/userland/libpcap-1.1.1-ring
  83. ./configure
  84. sed -i -e 's/\.\.\/lib\/libpfring\.a/\/opt\/PF_RING\/lib\/libpfring\.a/' Makefile
  85. sed -i -e 's/\.\.\/lib\/libpfring\.a/\/opt\/PF_RING\/lib\/libpfring\.a/' Makefile.in
  86. ./configure --prefix=/opt/PF_RING && make && make install
  87. #Build and install tcpdump using the PF_RING enabled version of libpcap
  88. cd /usr/src/PF_RING_CURRENT_SVN/userland/tcpdump-4.1.1
  89. ./configure LD_RUN_PATH="/opt/PF_RING/lib:/usr/lib:/usr/local/lib" --prefix=/opt/PF_RING/ --enable-ipv6 && make && make install
  90. #Pull down the latest version of suricata from the git repo and build with PF_RING support.
  91. cd /usr/src/PF_RING_CURRENT_SVN/userland/
  92. git clone git://phalanx.openinfosecfoundation.org/oisf.git oisfnew
  93. cd oisfnew
  94. ./autogen.sh
  95. ./configure --enable-pfring --with-libpfring-libraries=/opt/PF_RING/lib --with-libpfring-includes=/opt/PF_RING/include --with-libpcap-libraries=/opt/PF_RING/lib --with-libpcap-includes=/opt/PF_RING/include LD_RUN_PATH="/opt/PF_RING/lib:/usr/lib:/usr/local/lib" --prefix=/opt/PF_RING/
  96. make && make install
  97. #Make config and log directories for a more complete getting started see https://www.inliniac.net/blog/2010/05/10/setting-up-suricata-0-9-0-for-initial-use-on-ubuntu-lucid-10-04.html
  98. mkdir /etc/suricata
  99. cp suricata.yaml /etc/suricata/
  100. cp classification.config /etc/suricata/
  101. mkdir /var/log/suricata
  102. #Setup options for when we intialize the module (here is the output from modinfo)
  103. #parm: num_slots:Number of ring slots (uint)
  104. #parm: transparent_mode:0=standard Linux, 1=direct2pfring+transparent, 2=direct2pfring+non transparentFor 1 and 2 you need to use a PF_RING aware driver (uint)
  105. #parm: enable_tx_capture:Set to 1 to capture outgoing packets (uint)
  106. #parm: enable_ip_defrag:Set to 1 to enable IP defragmentation(only rx traffic is defragmentead) (uint)
  107. echo "options pf_ring transparent_mode=0 num_slots=32768 enable_tx_capture=0" > /etc/modprobe.d/pf_ring.conf
  108. #start up suricata with PF_RING support currently these options don't have very much effect with the AutoMode but see src/runmodes.c for more more options.
  109. /opt/PF_RING/bin/suricata --pfring-int=eth0 --pfring-cluster-id=99 --pfring-cluster-type=cluster_flow -c /etc/suricata/suricata.yaml
  110. #To check the status of PF_RING
  111. modinfo pf_ring && cat /proc/net/pf_ring/info
  112. #If you need to uninstall PF_RING or rollback your PF_RING aware drivers to their previous state you can do so with the following commands.
  113. dkms remove -m e1000e-pf_ring -v 1.3.10a --all
  114. dkms remove -m e1000 -v 8.0.30 --all
  115. dkms remove -m pf_ring -v 4 --all