Thursday, April 11, 2013

How to use IP spoofing in LR?

IP of client machine's is identity used by Servers and Network devices like routers to recognize them and then to cache the information and optimize themselves.
Sometimes we need to use different IPs to emulate the real world scenarios to make servers and devices see as if users are coming from different sources.

But this task is not as simple as pressing button on vending machine and grabbing your cappuccino .

Click here to know more

Our job here is to fool the devices and it requires three simple steps:

1. Run IP Wizard (Start > Program Files > LoadRunner > Tools > IP Wizard) on LG to add the IPs you want to emulate in scenario.

2. Update the server’s routing table with new IPs, this is done so that servers are able trace back to the client. If client and server are in same network and subnet mask then not need of modification is required.

To update the table edit the batch file in IP wizard summary use route command as below to update:
“route ADD [IPs you want to add] MASK [Your_IP] METRIC1”
“route ADD [IPs you want to add] MASK [Your_IP] METRIC2”
Now run this .bat file on server to update.

3. Enable IP Spoofing (Scenario > Enable IP Spoofer) from Controller, before connecting to LG.

Hey congrats!!!! It’s done


  1. Hi,

    What is lr_enable_ipspoofing() and lr_disable_ipspoofing() functions for?

  2. Hi Mouli,

    Thank you so much for asking.

    The lr_enable_ip_spoofing(); and lr_disable_ip_spoofing(); functions are used in script to implement the IP spoofing. But, until or unless you have not done the above settings, the script will not use different IPs.

    The above explained settings give controller the instruction to take the defined IPs and use them while sending requests to Application under test.

    Hope this solves your query :).

    Stay tuned!! Keep reading the blog and enriching it with your valuable comments!!!


  3. Thank you so much Devendra. So nice to see your reply. I just had theoretical knowledge of LR and PT till september and this is the first LR project I am working on.

    Yesterday I just enabled IP spoofer in the controller and IP's were already configured in the LG machine. The IP spoofing worked perfectly. I did not use lr_enable_ipspoofing() function at all.

    Also when I used lr_enable_ipspoofing() in the code, I got the following message as well:

    You cannot enable or disable ipspoofing from command prompt. I could not understand why I got this message. But the job is done for me from deliverable perspective.

    Your article above really helped. :)