IP spoofing of LoadRunner tricks (recommended)

Source: Internet
Author: User
Tags hp loadrunner



IP spoofing is also a very useful feature that LoadRunner comes with.



need to use IP Reasons for Deception :
1, when an IP access is too frequent, or the traffic is too large, the server will deny access requests, this time through IP spoofing can increase the frequency of access and traffic to achieve the effect of stress testing.
2, some servers configured load balancing, using the same IP can not detect the actual performance of the system. IP spoofing in LR by invoking different IPs can largely simulate the ability to actually use multi-IP access and test server equalization processing.
3, some websites will restrict the same user to the same IP landing. For a more realistic simulation, LoadRunner allows running virtual users to access the same site using different IPs.






How IP spoofing is set up





Open HP LoadRunner---->tools---->IP Wizard






What's the situation?! We need to configure a fixed IP for our own computer, configure the way of fixed IP, you understand!






Enter the formal configuration process below:



The first step:






Create new setting creates a fresh setting



When you first use IP spoofing or have freed the added IP, you will need to select this item to create a new setting.



Load Previous settings fro read IP list file



To read an IP address from a list of previously set IP addresses



Restore Original Setting release the IP already set



Releases the IP address that has been added.



Select the default check: Create new setting (creating a newer setting), click "Next"






Step Two:






Let the IP address of the input server, LoadRunner update the routing table through that address.

After a new IP address is added to the client computer, the server needs to add the address to the routing table so that it can identify the route that is returned to the client. If the server and client have the same subnet mask, IP class, and network, you do not need to modify the server's routing table.



If there is a router between the client and the server computer, the server needs to identify the path through the router. Ensure that the following routes are added to the Server routing table: routes from the WEB server to the router, and all IP addresses from the router to the load generator computer.



Here you can do nothing to add, click "Next".






Step Three:






The default display of the local IP address, of course, we also need to add more IP. Click "Add" to enter the IP add page.



Fourth Step:






class C, class B, Class A indicates whether we want to use the Class A, Class B, or Class C IP address. don ' t use any of these to do nothing, it will empty the default IP with the subnet mask.



(c class can only simulate 255 IP, if you need more, then you need to use Class A or Class B)



From the IP input box, enter the start IP



number to input box, which means how many IP addresses we need to use for spoofing



(My configuration above is starting from 110, generating 5 sequentially)



Submask Enter the correct subnet mask based on the IP type



Select "Verify that new IP addresses is not already used" and click "OK".






The IP Wizard automatically generates the IP address as set and lists the IP that is already occupied. Click "Finish"



Fifth Step:






Click the "Save as" button, you can save the IP we set as a file, and then set it later, in the first step, we can choose the second option (Load previous settings fro), from the file import IP.



Click "OK", the IP wizard began to help us into the IP.



At the command prompt, enter the ipconfig command to verify:









Sixth step:



Open LoadRunner---> Controller, select Scenario--->enable IP spoofer, this tick indicates that IP spoofing is allowed.












Create a test script (IP spoofing)








After the configuration above, do you really know how to use IP spoofing? Or do you really understand IP spoofing? How can you prove that you have used IP spoofing?


Action ()
{
   // Verify IP spoofing code
    char * ip;
        ip = lr_get_vuser_ip ();
    if (ip)
        lr_output_message ("The IP used by the current virtual user is:% s", ip);
    else
        lr_output_message ("[enable IP spoofing] option is not enabled!");


     lr_start_transaction ("Baidu homepage"); // Set transaction start

    web_url ("www.baidu.com",
        "URL = http: //www.baidu.com/",
        "Resource = 0",
        "RecContentType = text / html",
        "Referer =",
        "Snapshot = t3.inf",
        "Mode = HTML",
        EXTRARES,
        "Url = http: //s1.bdstatic.com/r/www/img/i-1.0.0.png", ENDITEM,
        "Url = http: //s1.bdstatic.com/r/www/img/bg-1.0.0.gif", ENDITEM,
        "Url = / favicon.ico", "Referer =", ENDITEM,
        "Url = http: //suggestion.baidu.com/su? Wd = & cb = window.bdsug.sugPreRequest & sid = 1440_2031_1945_1788 & t = 1362056239875", ENDITEM,
        "Url = http: //suggestion.baidu.com/su? Wd =% E8% 99% AB% E5% B8% 88 & p = 3 & cb = window.bdsug.sug & sid = 1440_2031_1945_1788 & t = 1362056247256", ENDITEM,
        "Url = http: //suggestion.baidu.com/su? Wd =% E8% 99% AB% E5% B8% 88% 20 & p = 3 & cb = window.bdsug.sug & sid = 1440_2031_1945_1788 & t = 1362056247969", ENDITEM,
        "Url = http: //suggestion.baidu.com/su? Wd =% E8% 99% AB% E5% B8% 88% 20% E5% 8D% 9A% E5% AE% A2% E5% 9B% AD & p = 3 & cb = window.bdsug.sug & sid = 1440_2031_1945_1788 & t = 1362056251016 ", ENDITEM,
        LAST);

     lr_end_transaction ("Baidu Home", LR_AUTO); // Set the end of the transaction

       return 0;
}


Running the above script in Vugen , the result must be: The [Enable IP spoofing] option is not enabled!



Note: Why to add things in the script, this is also a loadrunner11 comparison of egg pain, when I modified the action cycle, and then run the script with a controller, Passed transactions for display as 0. Of course, the script itself does not have any problems, adding things in the script can prevent this problem from happening.



Ok! Don't worry. Save the script import to the controller run. Open Menu VUser--->run-time settings






Switch to Log option






Tick all logs, or wait a minute you'll wonder why you can only see the log of the first virtual user.



Switch to miscellaneous option






Here, select whether the virtual user runs as a process or as a thread. The problem you may encounter below is to modify it here.



After these steps you can save the script and import it to the controller to run it.












Verifying IP Spoofing





First Step : Select Scenario--->enable IP spoofer, which indicates that IP spoofing is allowed. (as I've said earlier here, here's a reminder)



Step two : Tick "Tools"-"Export Mode"



Step three : "Tools"-"Options"-"General"






Here's another set of performance tests in either a process or a threaded manner. What is the relationship between this and run-time settings?



This option must match the pattern of the current scene, that is, you need to check the threading method when using the local virtual IP test, and you need to check the process mode when using the virtual IP test with the load generator.






Fourth Step :



Run the script to view the virtual user log






On the Script run page, click Vusers ...----> right click on the virtual user and open "show VUser log" in the popup menu to see that each user uses a different IP.



Of course, there is another way to view the logs:



Menu bar: Results---> Results Settings ...






C:\Users\Administrator\AppData\Local\Temp is the directory where you run the script, find the log\ directory below, or view the log.









The error encountered


In the process of running the script found a lot of error requests, so, look for the following error notice found: "Error:socket descriptor not found. Hint:the problem might is solved applying the following: (1) Update run-time Settings to Run VUser as a process. (2) Add the following line to Mdrv.dat, [lr_socks] section: ' Extcmdlineconc=-usingwininet Yes '.



Workaround :
1. According to the error, set "Run VUser as a process" in the miscellaneous item in Run-time setting; (previously taught how to set)



2 、... \program Files (x86) \hp\loadrunner\dat\Mdrv.dat



Find [lr_socks] after adding "Extcmdlineconc=-usingwininet Yes", as follows:




..............
[lr_socks]
ExtPriorityType=hook
WINNT_EXT_LIBS=lr_socks.dll
WIN95_EXT_LIBS=lr_socks.dll
LINUX_EXT_LIBS=liblr_socks.so
SOLARIS_EXT_LIBS=liblr_socks.so
HPUX_EXT_LIBS=liblr_socks.sl
AIX_EXT_LIBS=liblr_socks.so
LibCfgFunc=lr_socks_configure
ExtMessageQueue=0
SecurityMode=On
ExtCmdLineConc=-UsingWinInet Yes
........

 





3, if still error, click on the Diagnostics->configuration item in the menu bar to change the Web page diagnostics item to: Enable (this trick can only say that the eyes do not bother), I think there is a better solution.








mistaken understanding of IP spoofing





Understanding misunderstanding:



1, and generator confused. After adding multiple IPs, you need to add more than one IP corresponding to the generator to use. (The same generator can use a different IP only if it is added to the generator list with one of its IPs.) )



2, on the basis of the previous error, for the same script, create multiple VUser execution groups, and then select the same physical generator with different IP to execute. (In fact, there is no need to select multiple IPs multiple times in the scenario unless you need to run several different scripts on this generator.) )






In fact, just remember two elements to use this feature:



1. Add multiple IPs with IP wizard;



2, in the controller through the Enable IP Spoofing.






There are three points to be aware of when using the IP spoofing feature:



1, the virtual IP is the same generator on the multiple IP, this allocation process by the Controller automatic;



2, for the same generator, you can simulate the number of users more than the number of IP, there will be a phenomenon of IP duplication, otherwise it will randomly assign a different IP.



3, for the same generator, with one of its IP added to the generator can, do not need to use different IP add multiple times.









IP spoofing of LoadRunner tricks (recommended)


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.