9
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Linuxでパケット受信障害のエミュレーション

Last updated at Posted at 2017-07-04

概要

Linuxでネットワーク障害のエミュレーションをしたいときはtcコマンドを使うが、普通に使うと外向き(egress)のパケットにしかエミュレーションがかからない。内向き(ingress)に対してエミュレーションをかける場合の設定方法について。

手順

IFBモジュールをロードする(IFB: Intermediate Functional Block pseudo-device)

# modprobe ifb

IFB疑似デバイスをリンクアップする

# ip link set dev ifb0 up

tcコマンドでingressを設定

# tc qdisc add dev eth0 ingress

tcコマンドでingressパケットをIFBに飛ばす

# tc filter add dev eth0 parent ffff: protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0

IFBにエミュレーションをかける(例:1%ロス)

# tc qdisc add dev ifb0 root netem loss 1%

参考

9
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?