views:

378

answers:

8
+10  Q: 

network simulator

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?

A: 

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

murali
will this technique even on fake ip and macaddresses?(fake in sense that no physical NIC exeists. )
Abdul Khaliq
A: 

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.

SF.
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.
Abdul Khaliq
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.
setting up virtual machines for 1000s of devices will be too costly. also most of the devices doesn't event run Linux or Windows.
Abdul Khaliq
+1  A: 

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/

Gladwin Burboz
setting up virtual machines for 1000s of devices will be too costly. also most of the devices doesn't event run Linux or Windows
Abdul Khaliq
You can add virtual ethernet adapters to this virtual machines.
Gladwin Burboz
+11  A: 

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.

I would upvote twice if I could, that's genius.
Martin
A: 

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.

Johannes Rudolph
can u provide some examples of such softwares
Abdul Khaliq
http://nsl.csie.nctu.edu.tw/nctuns.html is a popular and sophisticated solution. It's complicated to set up though.
Johannes Rudolph
+1  A: 

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.

Gladwin Burboz
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?
Abdul Khaliq
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.
Gladwin Burboz
+1  A: 

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.

Kartoch
+1  A: 

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

EmpireJones