How to simulate the network environment under Linux

Source: Internet
Author: User
Tags linux

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.