Linux Simulation network environment, mainly using the TC command to rewrite the kernel information to simulate the network card packet delay and loss rate.
Divided into three parts:
1 Install the Linux system, you can use the redhat5.x Enterprise Edition, when installing the attention to check the "System Network Settings" tool.
2 to establish a transparent bridge, requires at least 2 physical network ports, if additional management is required, 3.
Establish transparent bridging steps as follows:
NIC is ready, NIC cannot set IP address
A set up the bridge group
#brctl ADDBR Bridgename
b joins the two-layer interface into the bridge group
#brctl AddIf Bridgenamedevice
C Build up the net Bridge
#ifconfig Bridgename up
D Test
#brctl Show to see bridging information
#/user/sbin/brctl Show view bridging information
#ifconfig –a can see the bridging port
#接上网线进行测试
Other commands:
#brctl DELBR Bridgename Delete a bridging group
#brctl delif bridgename Device Remove physical interfaces from bridge groups
3 Simulating network environment with TC command
TC is the flow Control tool under Linux, the basic function module includes queue, classification, filter, through the correlation parameter carries on the flow control, through the ' Man TC ' command to view all the operation information of TC.
Note: The limit interface should be connected to the client side interface.
We often use the queue module, the command format is as follows:
TC Qdisc [Add | del | change | replace | link] Dev dev [parent Qdisc-id | root] [handle Qdisc-id] Qdisc [Qdisc spe- Cific parameters]
Command narration:
#tc qdisc add dev eth0 root netem delay 1000ms all eth0 data Latency 1000ms
#tc qdisc add dev eth0 root netem delay 1000ms 500ms Data Latency range in 1000±500ms
#tc qdisc add dev eth0 root netem delay loss 10% packet loss rate of 10%
#tc qdisc add dev eth0 root netem delay loss 10% 5% packet loss rate range in 10±5%
# TC Qdisc Add dev eth0 root netem duplicate 10% randomly generates 10% of duplicate packages
# TC Qdisc Add dev eth0 root netem corrupt 10% randomly generates 10% of damaged packages
# TC Qdisc Add dev eth0 root netem delay 10ms reorder 25% 50% 25% of packets (50% related) delivered immediately, other delay 10ms
# TC Qdisc View information
#以上命令可叠加使用
This article is from the "CXZ" blog, please be sure to keep this source http://chenxz.blog.51cto.com/614454/897218
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/