0

Can someone possibly explain (within the size of a stackoverflow answer) the code required in order to emulate a network interface? I just know that there is virtualization software out there like Qemu that does this specific type of hardware emulation, but have no idea how this would work. Lots of books will show you how to create a program that listens on a TCP socket, but not create a host that gets its own IP address.

T. Webster
  • 9,605
  • 6
  • 67
  • 94

2 Answers2

2

VirtualBox is open source. As a VM, with networking support, it should be sufficient to demonstrate to you what to do, along with a working implementation. https://www.virtualbox.org/wiki/Downloads

Randy Howard
  • 2,165
  • 16
  • 26
  • This will answer my question, although I'll have to look through a lot of source code. I may need to ask another question, but my intention is to either create or find the source for the most minimal virtual host that can interact with a network with the most common, basic commands like ipconfig – T. Webster Mar 31 '13 at 05:14
0

It's really depends what do you mean and what do you want to achieve. If you want emulate some real hardware you need via hypervisor's primitive emulate the most aspects mentioned in datasheet of corresponding adapter, if you want introduce some service, e.g. DNS or HTTP service visible in internal network: you need port teach some user land stack (e.g. LWIP or Slirp, or part if you need UDP only or lower) to communicate with hypervisor's internal network.

vvlevchenko
  • 884
  • 7
  • 5