gbc
gbc

Reputation: 8555

Simulate multiple IP addresses for testing

I need to simulate multiple embedded server devices that are typically used for motor control. In real life, there can be multiple servers on the network and our desktop software acts as a client to all the motor servers simultaneously. We have a half-dozen of these motor control servers on hand for basic testing, but it's getting expensive to test bigger systems with the real hardware. I'd like to build a simulator that can look like many servers on the network to test our client software.

How can I build a simulator that will look like it has many IP addresses on the same port without physically having many NIC's. For example, the client software will try to connect to servers 192.168.10.1 thru 192.168.10.50 on port 1111. The simulator will accept all of those connections and run simulations as if it were moving physical motors and send back simulated data on those socket connections.

Can I use a router to map all of those addresses to a single testing server, or ideally, is there a way to use localhost to 'spoof' those IP addresses? The client software is written in .Net, but Python ideas would be welcomed as well.

Upvotes: 7

Views: 14151

Answers (4)

ubiquibacon
ubiquibacon

Reputation: 10667

You can add alias IP addresses to a single network interface using the following command as admin. Run once for every IP address you need. The command assumes your network interface is named "Ethernet 1", so adjust as necessary:

netsh interface ipv4 add address "Ethernet 1" "192.168.10.1"

Remove an IP address by changing add to delete.

Show IP addresses with the command:

netsh interface ipv4 show addresses

You can do the same things through the GUI as well:

  1. Go to Network Connections
  2. Right click your adapter and select Properties
  3. Double click Internet Protocol Version 4 (TCP/IPv4)
  4. Click Advanced
  5. Click Add in the IP addresses section to add IP addresses

Upvotes: 0

Sky
Sky

Reputation: 111

A. consider using Bonjour (zeroconf) for service discovery

B. You can assign 1 or more IP addresses the same NIC:

On XP, Start -> Control Panel -> Network Connections and select properties on your NIC (usually 'Local Area Connection').

Scroll down to Internet Protocol (TCP/IP), select it and click on [Properties].

If you are using DHCP, you will need to get a static, base IP, from your IT. Otherwise, click on [Advanced] and under 'IP Addresses' click [Add..] Enter the IP information for the additional IP you want to add.

Repeat for each additional IP address.

C. Consider using VMWare, as you can configure multiple systems and virtual IPs within a single, logical, network of "computers".

-- sky

Upvotes: 6

Byron Whitlock
Byron Whitlock

Reputation: 53871

You should set up a virtual network adapter. They are called TAP/TUN devices. If you are using windows, you can easily setup some dummy addresses with somthing like this:

http://www.ntkernel.com/w&p.php?id=32

Good luck!

Upvotes: 6

tuergeist
tuergeist

Reputation: 9391

Normally you just listen on 0.0.0.0. This is an alias for all IP addresses.

Upvotes: 2

Related Questions