os:freebsd:trafficgenerator
FreeBSDを用いたTraffic Generatorの構築
とある理由で、FreeBSDでTraffic Generatorを作成しなければならなくなった。
というわけでその記録
2020/08/21 現在、本記事は書きかけです。
Hardwareの諸元
- CPU
- AMD Ryzen7 PRO 4750G
- Motherboard
- ASRock B550M-ITX/AC
- Memory
- DDR4-3200 8G x2
- NIC
- HPE 560SFP+ (82599) 2port
他に、Diskなどもあるが、この辺は影響はほぼないので割愛。
NICは、他に、HUAWEI CN21ITGH(Intel X710)を準備してある。
準備
- FreeBSD 12.1-RELEASEをInstall
- 追加は何も入れない。加えて、srcやlib32などはInstallしない
- freebsd-update を実行して最新にする
- /usr/src以下をsvnを用いて取得する
svnlite checkout https://svn0.us-west.FreeBSD.org/base/releng/12.1 /usr/src
以下、書きかけのメモ
とにかく、netmapの初期試験
どのように構成するにしても、netmapを利用して、NICにDirectにpacketを送り出した上でハードウェア的にどのくらい性能が出せそうかを見積もる必要がある。 また、そもそもNICがnetmapをどの程度利用できるかを確認する必要もあるので、予備試験。
佐藤先生から頂いた、簡易試験用のscript
- netmap_test.sh
#!/bin/sh # ---- Configuration SRCDIR=/usr/src SRCIF=bge0 SRC_ADDR=192.168.100.104 DST_ADDR=192.168.100.2 FUNC=${1-tx} # COUNT=100 LEN=64 THREADS=1 # ---- # Copyright (c) 2020 Hiroki Sato <hrs@allbsd.org> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. LOG=netmap_test-`date +%Y%m%d-%H%M%S`.log err() { echo "ERROR: " $* 1>&2; exit 1; } NETMAPDIR=$SRCDIR/tools/tools/netmap # build pkg-gen first (cd $NETMAPDIR && make obj && make) case $? in 0) # do nothing ;; *) err "building of pkg-gen failed." ;; esac PKTGEN_CMD=`cd $NETMAPDIR && make -V.OBJDIR`/pkt-gen SRC_MAC=`arp -an | awk "/$SRC_ADDR/{print \\$4}"` if [ -z "$SRC_MAC" ]; then err "$SRC_ADDR not found on this host." fi if ping -o -c 2 $DST_ADDR > /dev/null 2>&1; then DST_MAC=`arp -an | awk "/$DST_ADDR/{print \\$4}"` else err "$DST_ADDR did not respond." fi CMD="$PKTGEN_CMD -A -p $THREADS -c 0 -f $FUNC -i $SRCIF -n $COUNT -l $LEN -s $SRC_ADDR -S $SRC_MAC -d $DST_ADDR -D $DST_MAC " ( echo COMMAND: $CMD $CMD ) 2>&1 | tee $LOG echo "--> logfile: $LOG"
試験結果
os/freebsd/trafficgenerator.txt · 最終更新: 2020/08/21 18:44 by seirios