Saturday, January 15, 2011

IP Spoofing in LR

    When you run a scenario, the Vusers on each host machine use the host’s IP address. You can define multiple IP addresses on a host machine to emulate a real- life situation where users sit on different machines.

When testing using Web protocols, by default Vusers on each host machine use the host's (agent's) IP address. Since a particular server keeps serving a specific IP address, load tests would reflect network router caching and other optimizations rather than the real-life situation where different users arrive to the server with different IP addresses. This is especially needed when the hardware configuration under test balances load across a "farm" of several (web or database) servers.
     "IP spoofing" enables each host machine to "spoof" the server into thinking it is using many different IP addresses.
    The IP Wizard program (ipwizard.exe in LR bin) is used to define multiple IP addresses on each load generator host. However, the hosts must use static IP addresses rather than DHCP to dynamically assign addresses.
    Note: IP addresses include two components, a netid and hostid. The submask determines where the netid portion of the address stops and where the hostid begins.
    When a host machine is re-started, routing tables are updated with the new addresses.
    The IP Wizard program creates a batch file (nt_routing.bat for Windows and unix_routing.bat for UNIX machines) and .ips file which updates IP tables.
    To enable multiple IP Addressing At the LoadRunner Controller, pull down menu item Scenario, check "Enable IP Spoofer" . This enables "Multiple IP address mode" in the Options dialog General tab, which appears after "Expert mode" is checked on the Tools drop-down menu. IP allocation should be consistent with the way users are running. If users are running as a process then the IP allocation should be done as a process, and if users are running as a thread then IP allocation should be done as a thread
    After turning IP spoofing on or off, for the setting to take effect, the Load Generator needs to be disconnected and reconnected again.
Application servers and network devices use IP addresses to identify clients. The application server often caches information about clients coming from the same machine. Network routers try to cache source and destination information to optimize throughput. If many users have the same IP address, both the server and the routers try to optimize. Since Vusers on the same host machine have the same IP address, server and router optimizations do not reflect real- life situations.



LoadRunner’s multiple IP address feature enables Vusers running on a single machine to be identified by many IP addresses. The server and router recognize the Vusers as coming from different machines and as a result, the testing environment is more realistic.

Adding IP Addresses to a Host

LoadRunner includes an IP Wizard program that you run on each host machine to create multiple IP addresses. You add new IP addresses to a machine once and use the addresses for all scenarios.



The following procedure summarizes how to add new IP addresses to a host:
Run the IP Wizard on the host machine to add a specified number of IP addresses.

Re- start the host machine.

Update the server’s routing table with the new addresses, if necessary.
Enable this feature from the Controller.
Refer to see Enabling Multiple IP Addressing from the Controller
Using the IP Wizard:
The IP Wizard resides on each host machine. You run this process one time to create and save new IP addresses. The new addresses can be a range of addresses defined by the Internet Assignment Numbers Authority. They are for internal use only, and cannot connect to the internet. This range of addresses are

the default used by the IP Wizard.

To add new IP addresses to a host machine:

Invoke the IP Wizard from the LoadRunner program group.


If you have an existing file with IP address settings, select Load settings from file and choose the file.

If you are defining new settings, select New Settings .

Click Next to proceed to the next step. If you have more than one network card,choose the card to use for IP addresses and click Next .The optional Web server IP address step enables the IP Wizard to check the server’s routing table to see if it requires updating after the new IP addresses are added to the host.


To check the server’s routing table directly after adding the addresses, enter the server IP address. 
Click Next to see a list of the machine’s IP address(es). Click Add to define the range of addresses. 

IP addresses include two components, a netid and hostid. The submask determines where the netid portion of the address stops and where the hostid begins.



Select a class that represents the correct submask for the machine’s IP addresses.8Specify the number of addresses to create. Select Verify that  new IP addresses are not already in use to instruct the IP Wizard to check the new addresses. If some addresses are in use, the IP Wizard will only add the addresses not in use.
Click OK to proceed.

After the IP Wizard creates the new addresses, the summary dialog box lists all of the IP addresses.


10 Click Finish to exit the IP Wizard. The IP Wizard Summary dialog box is dispalyed.