Linux network simulation tool

Source: Internet
Author: User

In Linux, netem or bridge is usually used to simulate network instability. In the simulation process, it is best to use a virtual machine. For remote machines,
Two NICs are required for network environment simulation, and three NICs are recommended for bridge simulation. You need to append an Eni for management.


Netem

It is a network simulator that provides some Internet services for testing, such as latency, packet loss, heavy packet, and re-ordering. In the release version of linux2.6,
This package is generally included.

  • Port DELAY command
  1. TC qdisc add Dev eth0 root netem delay 100 MS: 100 ms for port Ting
  2. TC qdisc del Dev eth0 root netem delya 100 ms
  3. TC qdisc change Dev eth0 root netem delay 100 ms 10 ms
    : Indicates the latency range of 100 ms ± 10 ms (90 to 110) for changing the port time)
  4. TC qdisc change Dev eth0 root netem delay 100 ms 10 ms 25%:
    The value range is 100 MS + 10 ms * 25%.
  • Port packet loss command:
  1. TC qdisc change Dev eth0 root netem loss 0.1%: the packet loss rate is 0. 1%
  2. TC qdisc change Dev eth0 root netem loss 0.3% 25%: the packet loss rate is 0. 3%
    25%)
  • Packet Copy command
  1. TC qdisc change Dev eth0 root netem duplicate 1%: Packet copy rate 1%
  • Packet distribution command
  1. TC qdisc change Dev eth0 root netem gap 5 delay 10 MS:
    Packet resends an integer multiple of 5 per grid without delay. Others will delay 10 ms
  • Speed control command: Two commands are completed together
  1. TC qdisc add Dev eth0 root handle 1:0 netem delay 100 ms
  2. TC qdisc add Dev eth0 parent handle 10: TBF rate 256 kbit Buffer
    1600 limit 3000
  • View Rule Information
  1. TC-s qdisc ls Dev eth0
  2. TC qdisc show
  • Delete rule
    TC qdisc del Dev eth0 Root

Bridge

Bridge-utils can simulate a bridge.
In most cases, what we need to build a bridge Firewall is a service with three NICs, two NICs are used for bridging, and the other one is configured with an IP address as the management interface, remote login to the bridge server to manage the Firewall
. (This shows the hub of the two ports on the host)

  1. Brctl addbr mybridge (create Bridge
    Mybridge, and then use ifconfig to view the result. A mybridge port is added)
  2. Brctl addif mybridge eth0
  3. Brctl addif mybridge eth1 (including eth0 and eth1 in mybridge)
  • Then perform the following actions on each port:
  1. Ifconfig eth0 0.0.0.0 promisc
  2. Ifconfig eth1 0.0.0.0 promisc (enable hybrid mode)
  3. Ifconfig mybridge up (start the bridge)

*. Delete the eth0 and eth1 NICs from the bridge.

  1. Brctl delif eth0
  2. Brctl delif eth1
  • Delete bridge br0
  1. Brctl delbr br0

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.