A Virtual Network Adapter bridged to real network

Hello,
We want to solve the following problem:
We have a server software that communicates with multiple clients using UDP.
It seems to me that the server software requires that each client has a different MAC address. (The server software has access to the OSI Level 2 ethernet frames).
The problem is that the computer that acts as the clients has a single ethernet port, so its network adapter has only a single MAC address.
Now if I install Virtual Machines on the client computer (for example VirtualBox), I can bridge the VM’s ethernet adapters to the real network. Each Virtual Machine has its own unique MAC address, so this setup works (as the server is fooled to think that multiple machines communicate with it).
Now I want to do the same thing without using Virtual Machines.
Is there any ready virtual network driver that can be bridged to the real network, and allow me to send/receive ethernet packets through a MAC address of my choice?
If I want to write such a driver, do you have any recommendations how to do it?
Thank you,
Itai

Winpcap

You don’t need a bridge you need a promiscuous protocol driver.

You will need to handle arp, ip, and udp yourself.

Why does your server claim to communicate with udp but actually expect something from layer 2?

Good luck,
Dave Cattley

Sent from my Windows Phone


From: xxxxx@rafael.co.ilmailto:xxxxx
Sent: ‎8/‎1/‎2013 9:35 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] A Virtual Network Adapter bridged to real network

Hello,
We want to solve the following problem:
We have a server software that communicates with multiple clients using UDP.
It seems to me that the server software requires that each client has a different MAC address. (The server software has access to the OSI Level 2 ethernet frames).
The problem is that the computer that acts as the clients has a single ethernet port, so its network adapter has only a single MAC address.
Now if I install Virtual Machines on the client computer (for example VirtualBox), I can bridge the VM’s ethernet adapters to the real network. Each Virtual Machine has its own unique MAC address, so this setup works (as the server is fooled to think that multiple machines communicate with it).
Now I want to do the same thing without using Virtual Machines.
Is there any ready virtual network driver that can be bridged to the real network, and allow me to send/receive ethernet packets through a MAC address of my choice?
If I want to write such a driver, do you have any recommendations how to do it?
Thank you,
Itai


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

xxxxx@rafael.co.il wrote:

We have a server software that communicates with multiple clients using UDP.
It seems to me that the server software requires that each client has a different MAC address. (The server software has access to the OSI Level 2 ethernet frames).

“It seems to me”? What on Earth does that mean?

For UDP, the MAC address is not important. It’s the IP address that
matters. Is your server doing UDP broadcasts? For UDP, a given IP
address/port number pair can only be owned by one process at a time. We
had a piece of hardware that sent telemetry via UDP broadcasts and ran
into this limitation. I ended up writing a “UDP Repeater” that sucked
on the UDP port and retransmitted it over TCP, because you can have
multiple client apps connect to a single TCP port. Then, the clients
tried to connect to TCP first (hoping the repeater was running), and if
that failed, fell back to UDP.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

You don’t need to write a driver for this; Windows supports it out of the box. You can use the Hyper-V vSwitch to create multiple network interfaces over a single physical interface. Each virtual interface has its own configurable MAC address. Note that even if you’re using vSwitch, you don’t need to actually set up guest VMs or any virtualization; you can just use the switch within the primary OS.

The topology you want to have is this:

[vNIC0] [vNIC1]
\ /
\ /
[vSwitch0]
|
|
[pNIC0]

Where pNIC0 is the physical NIC adapter. vNIC0 and vNIC1 are the two virtual NICs that you create and ultimately send data through.

The Hyper-V GUI can help you create a switch, but it doesn’t have a GUI option to create *multiple* vNICs. So let’s use PowerShell to set this up instead. Assume that your physical NIC is named “myNic”:

Create a switch with its first vNIC over the physical adapter “myNic”

New-VMSwitch myswitch -NetAdapterName myNic

Add a second vNIC to the switch

Add-VMNetworkAdapter -ManagementOS -SwitchName myswitch

Customize the MAC address of the virtual NIC Set-NetAdapter ‘vEthernet (myswitch) #1’ -MacAddress 00-11-22-33-44-55

The vSwitch will act very much like a physical switch, so both virtual NICs get their own MAC addresses, their own IP addresses, neighbor/ARP tables, routing tables, etc., just as if you’d had two physical NICs plugged into a physical switch. From the client application’s point of view, you can “pick” which MAC address to send from by picking the source IP interface to bind on.

Thank you.
Jeffrey’s advice seems to solve our problem.