In this Loadrunner Tutorial, You will learn about lr_disable_ip_spoofing. Before understanding lr_disable_ip_spoofing function, first of all, we need to understand what is IP spoofing. If we talk in terms of Performance testing, IP Spoofing may be considered as a way to allocate multiple IP addresses to multiple Virtual users from a single host machine.
We generally generator load from a single machine using any performance tool for generating a load of large number of users and we know that each machine has one IP, which is unique and different from IP of other systems. Now when similar request will go to the server with same IP, which we may call as Load Generator.
The main purpose of assigning multiple IP addresses to multiple Virtual users is that many a time, web servers block too many requests coming from a single host machine or we may say single client machine.
IP spoofing is very helpful when there is distributed architecture involving several (web or database) servers. IP spoofing may be considered to spoof the server and allow it to think that it is getting requests from too many machines whereas in reality, there is one Load Generator.
So, IP spoofing may be considered an important thing in performance testing, which helps us to emulate real-time scenario . It is not mandatory that we have to use it because It does not happen in most of the cases. But in some of the cases, it happens and server rejects multiple requests coming from a single machine.
This is the scenario when we have to mandatorily enable IP spoofing in LoadRunner. So we can see that IP spoofing plays a very important role in performance testing.
We can do it in two ways. First is by using IP spoofing in the Controller section of Load Runner and another way is by using one function and the name of the function is lr_enable_ip_spoofing. The syntax of this function is is given as below.
int lr_enable_ip_spoofing( );
So, now that we have understood the concept of IP Spoofing and when we are using the function to enable IP spoofing in Virtual User Generator . There may be times when you may also need to disable IP spoofing from the script itself. That will be using another very important function and the name of the function is lr_disable_ip_spoofing.
Let us see the syntax of this function which is given as below.
One thing to be noted here is that, it will only be used at a place where the function lr_enable_ip_spoofing() is used. The format of using this function is as given below.
We can clearly see that first of all Enable IP Spoofing function is used followed by some script and which is followed by Disable IP Spoofing function. This function is used to disable IP spoofing and after using this function, all the requests will appear to be generated from single IP only and no different IP addresses will be allocated to each request.
Overall, we can say that it is a very useful function that is used in LoadRunner to disable IP spoofing.
You should also read all our Loadrunner functions with examples.