1

ホストのさまざまなポートで実行される一連のサービスの遅延をシミュレートしようとしています。さまざまなサービスへのさまざまな遅延をシミュレートしたいと思います。できれば、制限なしで、特定のホスト上の多くの可能性があります。

これを行う唯一の方法は、prio qdisc を使用することです。次に例を示します。

IF=eth0
tc qdisc add dev $IF root handle 1: prio bands 16 priomap 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

# this loop is only a sample to make the example runnable; values will vary in practice
for handle in {2..16}; do
 # add a delay for the service on port 20000 + $handle
 tc qdisc add dev $IF handle $handle: parent 1:$handle netem delay 1000ms # example; this will vary in practice
 # add a filter to send the traffic to the correct netem
 tc filter add dev $IF pref $handle protocol ip u32 match ip sport $(( 20000 + $handle )) 0xffff flowid 1:$handle
done

上記のコマンドを実行すると、ハンドル 11 ~ 16 が作成されず、エラーで失敗することがわかります。

注意。上記のアンドゥです。

IF=eth0
for handle in {2..16}; do
 tc filter del dev $IF pref $handle
 tc qdisc del dev $IF handle $handle: parent 1:$handle netem delay 1000ms
done
tc qdisc del dev $IF root

インターフェイスに 10 個を超える netem を追加する方法はありますか?

4

1 に答える 1