15

I need to build a device emulator which can communicate over real IP address

I need to create as many instances I can for the device. With one IP and MAC address for each emulator instance

Can can any one guide me how this can be achieved?

6
  • What language? What platform?
    – Seth
    Feb 24, 2010 at 20:05
  • are you asking about virtual network interface?
    – Anycorn
    Feb 24, 2010 at 20:05
  • Yeah, what platform? I'm working on an interface for NS-3 in Java. Feb 24, 2010 at 20:06
  • Many tools can do this. Google "network capture replay". Why are you trying to do this, and at what protocol level?
    – TFD
    Mar 1, 2010 at 6:30
  • well i need to create a test environment for multiple virtual devices that acquire ipaddress from dhcp Mar 2, 2010 at 4:27

9 Answers 9

24
+75

Five or six years ago, I was stuck writing a network emulation layer for a PS2 game. I was told that all the classic behaviors of an internet connection had to be displayed; realistic loss characteristics, packet reordering, latency, rush-induced packet loss. Essentially, I was told to implement the internet in a couple weeks.

I suggested just bouncing all our game traffic off a remote echo server. When I was told that it was absolutely forbidden to send development traffic out over public wires, I simply created a server that everyone pointed their PS2 devkits at that would store every packet it received and send a doppleganger (full of an id for the original packet plus a bunch of random garbage to make it the same size) out to the echo servers I ran. When the doppleganger was received, I would pass the original packet on to its original destination.

Boom. Internet simulation with all the thorns in less than 8 hours.

UPDATE:

Given the success of the answer here, I reimplemented the game echo service a while back. It seemed that github might be a better place to stash it, so here it is: If it works for you, great! If not, let me know. I expect its current state to be shaky at best.

4
  • 1
    Sir, this is an epic solution.
    – Emiswelt
    Jul 18, 2011 at 13:25
  • 1
    That's an excellent solution to the problem! I'd have trouble convinving the powers that be that none of the development traffic was actually escaping. Sep 2, 2011 at 7:35
  • I suppose the only downside is to make the test conditions repeatable in the future. Sep 2, 2011 at 7:36
  • If you want to save yourself a great deal of work AND prevent leaking of development traffic, you can simply accept an inbound connection, encrypt it all, send it to the remote echo server, and decrypt it all when the echo is received. MBAs tend to think that they understand that "encryption" means "problem solved." Not having to locally store all the data is a lot harder than encrypting. Sep 4, 2011 at 4:26
1

Virtual PC 2007

http://www.microsoft.com/downloads/details.aspx?FamilyID=04d26402-3199-48a3-afa2-2dc0b40a73b6&DisplayLang=en

.

Virtual Machine Network Driver

http://www.microsoft.com/downloads/details.aspx?FamilyID=dc8332d6-565f-4a57-be8c-1d4718d3af65&displaylang=en

.

VMware Player: Windows

http://www.vmware.com/products/player/

2
  • setting up virtual machines for 1000s of devices will be too costly. also most of the devices doesn't event run Linux or Windows Mar 5, 2010 at 7:18
  • You can add virtual ethernet adapters to this virtual machines. Mar 5, 2010 at 16:37
1

Add a Range of Virtual IPs in Windows

See the February 21st, 2006, 1:18 pm post reply by gil.elessar

.

For your reference:

Netsh commands for Interface IP

Netsh commands

You can use commands in the Netsh Interface IP context to configure the TCP/IP protocol (including addresses, default gateways, DNS servers, and WINS servers) and to display configuration and statistical information.

2
  • ok that can be possible solution but what about the mac-addresses. Is there is any what that i can have different mac-address for each of the ipaddresses? Mar 5, 2010 at 7:23
  • mac-addresses (also called physical address) is a device address to which network packets are sent to. Above solution is creating Virtual IP's for same device. Mar 5, 2010 at 16:36
1

A simple idea woul be to used User-Mode Linux (UML), a port of the Linux kernel in user space. It allows multiple virtual Linux systems (known as guests) to run as an application within a normal Linux system (known as the host).

It very light, in CPU and memory. For instance I'm using more than 10 UML in the same time on a "not-too-recent" PC, using Netkit, a network simulator based on UML. UML is light because it's a native application, not heavy virtualisation (vmware, virtualbox, qemu) neither para-virtualisation (xen).

As the network interfaces are implemented to be able to connect to other UML machines (using uml_switch), you can have any MAC address you want. If you need to connect these UML machines to your system or external hosts, you can create virtual devices using TUN/TAP.

PS: If you're on Windows, you can try CoLinix, port of Linux Kernel for M$ OS, I don't know if it has same characteristics than UML.

1

You could try using loopback adapters. Using this you can set any IP or mac address. Works great for emulating various network connections.

0

you need to study the datalink layer in depth in the part of coding -- then you can understand the how it get mac address and the communication b/w mac and ip

1
  • will this technique even on fake ip and macaddresses?(fake in sense that no physical NIC exeists. ) Mar 5, 2010 at 7:11
0

depending on what kind of device you need, you may be happy with a number of virtual PC engines, the overhead is high (whole PC is emulated instead of just a network interface) so you won't end up with 1000 machines, but this is an "out of the box" solution - and each virtual PC can have a number of virtual network cards.

3
  • well the emulation the device is not the problem at all what the actual challenge that i am facing is that how will i acquire or set the ipaddress of a emulator such that that communicates over LAN just like real NIC or nay ip enabled device. Mar 2, 2010 at 4:38
  • The host computer (on which the virtual machines work) has its standard network card set up as forwarding connections from virtual machines transparently. And as you set up the OS on a virtual machine, you set it up just like usually within that OS (can be even via DHCP) - it can be Linux, Windows, whatever. Then the multiple virtual machines, with multiple virtual network cards (each with own IP and MAC) communicate through the physical network card. And so you end up with one Windows PC running 10 Linuxes each with 8 network cards, for 80 virtual network cards on one physical one.
    – SF.
    Mar 2, 2010 at 8:57
  • setting up virtual machines for 1000s of devices will be too costly. also most of the devices doesn't event run Linux or Windows. Mar 5, 2010 at 7:18
0

I suggest you better not start reinventing the wheel. There are hardware as well as software solutions for this particular problem. They are also very well suited to network load (and throughput)-tests.

The downside is such devises are quite expensive.

2
0

Cisco pakcet tracer allows you to emulate network traffic with an gui. Im surpised no one mentioned that (its limited to cisco devices but the standard is same across devices so it would be learning commands for your specific device).

Try doing a google search because under normal circumstances its only available to ccna students but I kept a copy because my teacher let me.

Or you might find someone posted a copy from their class somewhere on the internet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.