Transferred from: http://blog.csdn.net/zm_21/article/details/25810263
Wanem Introduction
As the company in some cases need to simulate the real network environment, such as delay, packet loss, jitter, etc., although the use of the TC under Linux can also achieve this function, but TC has a command line interface is not conducive to configuration, the use of bridging mode is not convenient for remote management defects, so in the spirit of sharing, Now we recommend a network simulation tool--wanem. Wanem full name is WAN emulator, is an open source wide area network simulator, which is also based on TC, its main functions are as follows:
Can be used to simulate a wide area network, including bandwidth, latency, packet loss, jitter
Advanced features are: Random reset connection, the probability of repeating packets, according to the probability of packet chaos and probability of instantaneous disconnection of the network, according to protocol random disconnection, and can be targeted for different protocols, different hosts, different networks and even different applications to simulate.
The advantages are as follows:
Wanem for all functions on a single-NIC device
Wanem support from the CD-ROM boot, do not need to install it to the hard disk can also be used, and even run on the virtual machine, when the bridge host network card can be used, very convenient
Supports fully graphical interface configuration for easy setup
Multiple rules can be set, different rules different users use non-interference, convenient for centralized test environment
Rules to apply settings only if you need to adjust the routing table
: http://wanem.sourceforge.net/
To configure the interface for Wanem's Advanced mode:
Description
Packet Limit: Used to set the queue size of the package, default is 1000, when the queue exceeds 1000, the package will be discarded
Symmetrical network: Symmetric networks, when checked for Yes, the rules for applying the network will take effect in the direction of the packet back and forth
Choose BW: Select bandwidth from the Quick list
Specify BW: Custom Bandwidth
Delay: A one-way delay is set here. Jitter, jitter, Correlation, correlation, to set the correlation between the delay time of this package and the time of the previous package
Loss: Packet loss rate; Correlation, correlation, a large number of drops that occur at a certain probability, but the average packet loss rate does not exceed the value defined by Loss
Duplication: A heavy packet rate that generates multiple copies of a package at a certain probability and reaches the target at random times. Correlation, correlated, similar to loss.
Packet reordering: Packet reordering rate, according to the probability of the order of the packet upset, Gap used to determine the number of packet reordering, not set closer to the real environment
Corruption: Wrong packet rate, noise generated by probability, i.e. malformed package
Idle timer Disconnect: A free disconnect timer that disconnects the protocol defined by the type at set time when the network is idle.
Random Disconnect: Randomly disconnected by type, MTTF, average time before expiration, two extrema defined with low and high, MTTF, average pre-recovery time
IP Source Address: matching Source IP addresses
IP Source subnet: Subnet of source IP address
IP dest Address: matching Destination IP addresses
IP dest Subnet: A subnet that matches the destination IP address
Add a rule set: adding an article
Apply settings: Apply settings.
Booting from CD Wanem
Place the Wanem LiveCD into the optical drive and set the computer to boot from the CD-ROM, and use a virtual machine to mirror the disc.
Enter this interface and press ENTER directly into the system boot, or press F2, F3 see the system Advanced parameters
Start interface
When the do want to configure all interfaces via DHCP (y/n) appears, input Y will enable all interfaces to configure the IP address via DHCP, enter N to manually configure the IP address, and enter the IP address configuration interface.
Next the system prompts to set the SSH password, here SSH user name is: perc, password customization, empty can not use SSH
After the password is set up to enter the Wanem console, the console prompt is: [email protected], and the login banner will prompt wanem configuration address:http://< The machine's IP address >/wanem, Enter the state command to view all interface information, Note that the link is case-sensitive and is not properly case-insensitive to the Web configuration interface.
Help can be obtained from the console input in Wanem. Provides commands to view or set the functionality of the system using commands.
In the Wanem console input Exit2shell can enter the Linux shell, in this shell can use the Linux command, such as if you do not know the IP address of the interface, you can enter Ipconfig–a to view, In this example, the IP address of the interface eth1 is 192.168.0.44. If you want to re-enter the Wanem console, enter Wanem in the shell.
Configuring Wanem through the Web
Open the browser, enter the Wanem management address http://< The machine's IP address >/wanem, here is http://192.168.0.44/WANem (note case), you can log in Wanem.
Function Navigation:
About:
Wanalyer: Wan Learning tool that automatically simulates the network environment by learning the packet loss, delay, jitter of the target host
Basic mode: Only bandwidth and latency can be set
Advanced Mode: You can set complex network rules, such as rules based on different interfaces, different hosts, different network segments, and even different applications.
Select interface
Save/restore: Backing up and recovering data
Help: Helping.
Wanem position in the network
Use of Wanem
The approximate process of using wanem is to first create a network rule in wanem and then adjust the routing table on the device under test, so that the default next hop for the network traffic for the device under test is wanem.
Configuration instance
The following instances are in the simulated network environment, assuming that the Wanem server is located at the IP address of 192.168.3.54, the peer device IP is 192.168.3.51. All operations on the device revert to the default setting after re-enabling the NIC, so there is no risk.
Windows as a tested machine
If we want to make all outgoing (different network segments) of the Windows machine as shown in the above simulator, we just need to change the default routing table for Windows as follows:
First delete the default route: Use the command route delete 0.0.0.0
Then add a default route pointing to Wanem:route add 0.0.0.0 mask 0.0.0.0 192.168.3.54
After that, all traffic to different segments is applied to the network rules set above.
If we want to have Windows apply rules to the specified host, to host 192.168.3.51 as an example, the steps are as follows:
Add a route table to the directory host, the next hop for the Wanem server: route add 192.168.3.51 Mask 255.255.255.255 192.168.3.54
This applies the rule, as shown in the example diagram below, and you will find that the effect is closer to the actual situation :
Linux as a test machine (similar to the case of Windows, I only list commands)
Test all outgoing traffic to Linux
Add a default route: Route add default GW 192.168.3.54
Testing Linux to refer to the traffic defined by the machine
Add a route to the path: Route add–host 192.168.3.51 GW 192.168.3.54
Ippbx as a test machine
Test IPPBX all outgoing traffic
Remove the default route (set the original gateway to 192.168.0.1): Routedelete "0.0.0.0", "192.168.0.1"
Add default route (IP address of wanem): Routeadd "0.0.0.0", "192.168.3.54"
Test IPPBX traffic to the specified host
Add a specified route: Routeadd "192.168.3.51", "192.168.3.54"
iad as a test machine
Test the IAD for all outgoing traffic
Remove default route first: Route delete
Add default route to Wanem:route add to default 192.168.3.54
Test the IAD's traffic to the specified host
Route add 192.168.3.51 255.255.255.255 192.168.3.54
origin:http://blog.163.com/hlz_2599/blog/static/142378474201341342720443/
Network emulator Wanem using the configuration graphics tutorial