Configuring virtual IPs in Linux

When you use a computer that is run on the Linux operating system and you want to configure virtual IP addresses so that the virtual IPs can then be configured as virtual clients in tests or as virtual servers in stubs.

Important: The steps for the task that are to be performed on the operating system are only indicative. The steps might vary depending on the version of the operating system. You might be able to use multiple methods to accomplish the task. You might already be aware of such methods. You can perform the task by following the on-screen instructions or by referring to the documentation provided by the operating system provider.

About this task

When you create the multiple virtual IP addresses to use them as virtual clients, you must ensure that the following conditions are satisfied:
  • The IP addresses that you create are legitimate.
  • The IP addresses are available within the same subnet in the network.
  • The IP addresses are blocked for distribution outside of the network.

Procedure

Add a virtual IP address by using the following command:
# ip address add <IP_alias> dev <network interface>
For example, to add the IP alias 10.134.59.4 to the network interface ens192, run the following command:
# ip address add 10.134.59.4 dev ens192
Note: After you complete runs of the tests and stubs that used the virtual IPs, you must remove the virtual IPs that you configured by running the following command:
# ip address del <IP_alias> dev <network interface>
For example, to remove the IP alias 10.134.59.4 from the network interface ens192, run the following command:
# ip address del 10.134.59.4 dev ens192

Results

You have successfully configured virtual IPs on a computer that is run on Linux.

What to do next