Several solutions commonly used to simulate harsh network environments_tc_fiddler_Dummynet_clumsy

 

1. tc

http://blog.csdn.net/weiweicao0429/article/details/17578011

1 Introduction to Analog Delay Transmission

netem and tc: netem is a network simulation function module provided by Linux 2.6 and above kernel versions. This functional module can be used to simulate complex Internet transmission performance, such as low bandwidth, transmission delay, packet loss and so on, in a local area network with good performance. Many distributions of Linux that use the Linux 2.6 (or above) kernel have this kernel feature enabled, such as Fedora, Ubuntu, Redhat, OpenSuse, CentOS, Debian, and more. tc is a tool in Linux system, the full name is traffic control (traffic control). tc can be used to control the working mode of netem, that is to say, if you want to use netem, you need at least two conditions, one is that the netem function in the kernel is included, and the other is to have tc.

It should be noted that the flow control introduced in this article can only control the action of sending packets, but not the action of receiving packets. At the same time, it takes effect directly on the physical interface. If the physical eth0 is controlled, the logical network card (such as eth0:1) will also be affected. Influence, on the contrary, if you do control on the logical network card, the control may be invalid. (Note: Multiple NICs in a virtual machine can be treated as multiple physical NICs in a virtual machine).


# tc qdisc add dev eth0 root netem delay 100ms

This command sets the eth0 NIC's transmission to be sent with a delay of 100ms. Epay Payment Co., Ltd.


In a more realistic situation, the delay value will not be so accurate, and there will be a certain fluctuation. We can use the following situation to simulate

Latency value with volatility:

# tc qdisc add dev eth0 root netem delay 100ms 10ms

This command sets the eth0 NIC's transmission to be sent with a delay of 100ms ± 10ms (any value between 90 and 110 ms).

The randomness of this volatility can be further enhanced:

# tc qdisc add dev eth0 root netem delay 100ms 10ms 30%

This command sets the transmission of the eth0 network card to 100ms, and at the same time, about 30% of the packets are sent with a delay of ± 10ms. Example: Now ping the 216 machine:

Epay Payment Co., Ltd.

It can be seen that the data fluctuates significantly.

3 Simulate network packet loss:
# tc qdisc add dev eth0 root netem loss 1%

This command sets the eth0 NIC's transmission to randomly drop 1% of the packets. Example: execute on 216

#tc qdisc add dev eth0 root netem loss 10%

It shows that only 13 of 16 packets have been received. You can also set the success rate of packet loss:

# tc qdisc add dev eth0 root netem loss 1% 30%

This command sets the eth0 NIC's transmission to randomly drop 1% of packets with a 30% success rate.

4. Delete the relevant configuration on the network card: Change the add in the previous command to del to delete the configuration:

# tc qdisc del dev eth0 XXXXXXXXXXX (the configuration added by yourself) This command will delete the relevant transmission configuration of the eth0 network card

So far, we have been able to simulate a certain network delay and packet loss in the test environment through TC. The following are more applications and introductions about tc

5 Duplicate simulation packets:
# tc qdisc add dev eth0 root netem duplicate 1%

This command sets the eth0 NIC's transmission to randomly generate 1% duplicate packets. 6 Simulate packet corruption:

# tc qdisc add dev eth0 root netem corrupt 0.2%

This command sets the eth0 NIC's transmission to randomly generate 0.2% corrupted packets. (The kernel version needs to be above 2.6.16)

7 模拟数据包乱序:
# tc qdisc change dev eth0 root netem delay 10ms reorder 25% 50%

该命令将 eth0 网卡的传输设置为:有 25% 的数据包(50%相关)会被立即发送,其他的延迟10 秒。

新版本中,如下命令也会在一定程度上打乱发包的次序:# tc qdisc add dev eth0 root netem delay 100ms 10ms

8 查看已经配置的网络条件:# tc qdisc show dev eth0

该命令将 查看并显示 eth0 网卡的相关传输配置9 附录:TC 流量控制

TC 是一个流量控制的工具,下面转了一篇关于 TC 流量控制的文章。TC 介绍

 

二、fiddler

from:http://www.cnblogs.com/jinjiangongzuoshi/p/5272787.html

  Fiddler的官网上是这样描述它自己的:The free web debugging proxy for any browser, system or platform,即跨浏览器、跨系统、跨平台的免费Web Debug代理服务器。当你的HTTP浏览经过Fiddler时,Fiddler可以监视流量,查看HTTP通讯的各种信息,设置断点查看和修改HTTP数据,甚至可以构造各种测试用的HTTP包以及重放已记录的包等。其官网是http://www.fiddler2.com/fiddler2/,上面详细地介绍了Fiddler到底是什么。

 

三、Dummynet

from:http://www.cnblogs.com/jinjiangongzuoshi/p/5272787.html

利用dummynet的pipe,可以设置一些特定的规则,就可以达到模拟恶劣网络环境的目的,且这些设置对于在操作系统中运行的应用程序来说是透明的、自动生效的,不需要像在使用Fiddler来进行模拟时还需要设置http代理。

 

Fourth, clumsy 

from:http://www.cnblogs.com/jinjiangongzuoshi/p/5272787.html

clumsy can artificially cause unstable network conditions under the Windows platform, which is convenient for you to debug the performance of applications under extreme network conditions.

Introduction

Using the WinDivert library that encapsulates the Winodws Filtering Platform , clumsy can intercept the network data packets received and sent by the system in real time, artificially cause delays, drop packets and tamper with them before sending them. Whether you're trying to reproduce program errors caused by network anomalies, or to evaluate how your application performs under poor network conditions, clumsy can help you achieve what you want at the system level without adding extra code. Effect:

feature:

  • Download and use, no need to install anything.
  • No additional settings are required, no need to modify the code of your program.
  • System-level network control can be applied to any Windows application such as command line, graphical interface, etc.
  • Not only supports HTTP, any TCP, UDP network connection can be handled.
  • Support local debugging (both server and client on localhost)
  • "Hot-plug", your program can always run, and clumsy can be turned on and off at any time.
  • Real-time adjustment of various parameters, detailed control of network conditions.

=

=

=

=

-

-

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326128315&siteId=291194637
Recommended