FastNetMon

Monday, 20 April 2015

Генерация до 14.6 MPPS на одном логическом ядре силами MoonGen и DPDK

Итак, для начала Вам нужно собрать и установить DPDK: 2.0.0 версии или старше.

Вытягиваем код и стаскиваем зависимости (LuaJIT):
cd /usr/src
git clone https://github.com/emmericp/MoonGen.git
cd MoonGen/
# Update dependencies
git submodule update --init
Указываем путь к свеже установленному DPDK:
export RTE_TARGET=x86_64-native-linuxapp-gcc
export RTE_SDK=/usr/src/dpdk-16.04
Собираем:
./build.sh
Смотрим номера портов (этот блок выдается при запуске MoonGen без параметров):
Found 7 usable ports:
   Ports 0: D8:9D:67:64:4A:71 (unknown NIC (PCI ID 8086:1521))
   Ports 1: D8:9D:67:64:4A:72 (unknown NIC (PCI ID 8086:1521))
   Ports 2: D8:9D:67:64:4A:73 (unknown NIC (PCI ID 8086:1521))
   Ports 3: 90:E2:BA:4A:D8:DC (82599EB 10-Gigabit SFI/SFP+ Network Connection)
   Ports 4: 90:E2:BA:4A:D8:DD (82599EB 10-Gigabit SFI/SFP+ Network Connection)
   Ports 5: 90:E2:BA:4A:D8:E8 (82599EB 10-Gigabit SFI/SFP+ Network Connection)
   Ports 6: 90:E2:BA:4A:D8:E9 (82599EB 10-Gigabit SFI/SFP+ Network Connection)

Запускаем генерацию SYN флуда (5 - порт из списка выше, 10.0.0.1 - стартовый порт для генерации src, 10000 - скорость):
build/MoonGen examples/l3-tcp-syn-flood.lua 5 10.0.0.1 16000000 10000
В итоге после инициализации получаем отличный флуд:
[Device: id=0] Sent 845365678 packets, current rate 14.83 Mpps, 7594.27 MBit/s, 9967.48 MBit/s wire rate.
[Device: id=0] Sent 860193837 packets, current rate 14.83 Mpps, 7592.01 MBit/s, 9964.52 MBit/s wire rate.
[Device: id=0] Sent 875025963 packets, current rate 14.83 Mpps, 7594.04 MBit/s, 9967.17 MBit/s wire rate.
[Device: id=0] Sent 889854138 packets, current rate 14.83 Mpps, 7591.99 MBit/s, 9964.49 MBit/s wire rate.
[Device: id=0] Sent 904685096 packets, current rate 14.83 Mpps, 7593.43 MBit/s, 9966.37 MBit/s wire rate.
[Device: id=0] Sent 919514890 packets, current rate 14.83 Mpps, 7592.84 MBit/s, 9965.60 MBit/s wire rate.

[Device: id=0] Sent 934345896 packets, current rate 14.83 Mpps, 7593.42 MBit/s, 9966.37 MBit/s wire rate.
Со стороны получателя это выглядит вот так:
10.224.21.215.1025 > 192.168.1.1.1024: Flags [S], cksum 0xc562 (correct), seq 1:21, win 10, length 2015:01:27.116876 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 60)    
10.223.153.106.1025 > 192.168.1.1.1024: Flags [S], cksum 0x41d0 (correct), seq 1:21, win 10, length 2015:01:27.116877 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 60)    
10.224.21.216.1025 > 192.168.1.1.1024: Flags [S], cksum 0xc561 (correct), seq 1:21, win 10, length 2015:01:27.116877 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 60)    
10.223.153.117.1025 > 192.168.1.1.1024: Flags [S], cksum 0x41c5 (correct), seq 1:21, win 10, length 2015:01:27.116878 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 60)    
10.224.21.230.1025 > 192.168.1.1.1024: Flags [S], cksum 0xc553 (correct), seq 1:21, win 10, length 2015:01:27.116878 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 60)    
10.223.153.122.1025 > 192.168.1.1.1024: Flags [S], cksum 0x41c0 (correct), seq 1:21, win 10, length 2015:01:27.116879 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 60)    
10.224.21.233.1025 > 192.168.1.1.1024: Flags [S], cksum 0xc550 (correct), seq 1:21, win 10, length 2015:01:27.116879 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 60)    
10.223.153.129.1025 > 192.168.1.1.1024: Flags [S], cksum 0x41b9 (correct), seq 1:21, win 10, length 2015:01:27.116880 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 60)    
10.224.21.246.1025 > 192.168.1.1.1024: Flags [S], cksum 0xc543 (correct), seq 1:21, win 10, length 2015:01:27.116880 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 60)   
10.223.153.142.1025 > 192.168.1.1.1024: Flags [S], cksum 0x41ac (correct), seq 1:21, win 10, length 2015:01:27.116881 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 60)    
10.224.21.249.1025 > 192.168.1.1.1024: Flags [S], cksum 0xc540 (correct), seq 1:21, win 10, length 2015:01:27.116882 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 60)    
10.223.153.145.1025 > 192.168.1.1.1024: Flags [S], cksum 0x41a9 (correct), seq 1:21, win 10, length 20
Тесты проводились на железе  Intel(R) Core(TM) i7 CPU 950  @ 3.07GHz. На более слабом чипе Intel(R) Xeon(R) CPU E5-2407 0 @ 2.20GHz удалось достичь лишь 12.75 MPPS просто потому что чип медленный.

Content of /etc/rc.local for auto start:
echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
/usr/src/MoonGen/bind-interfaces.sh

No comments :

Post a Comment

Note: only a member of this blog may post a comment.