Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

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.

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

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

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.

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top