Recreating VMWare-like VMNet interfaces

Hello,

I am looking for a programmatic way or even a tool that allows me to achieve the following.

I would like to use a Windows box with a single NIC and create 2 virtual interfaces attached to the same NIC. I would further like to set up IP forwarding using these 2 virtual interfaces so that a subnet using one of these interfaces as a default gateway can route packets out to the other side of the box through the other virtual interface.

Internet <> VirtualInterfaceExternal-Box-VirtualInterfaceInternal <> Intranet

The key here is 1 NIC card and IP-forwarding.

I have been reading up on TUN/TAP drivers, loopback drivers, etc but just can’t figure out how I can use a tool or build a driver to achieve this.

I know conceptually this must be possible as VMWare can create multiple virtual interfaces from a single physical NIC and have those virtual interfaces bridged onto the local LAN with their own mac and IP addresses pretty much like having 3 physical interfaces on the same box.

How do I go about building this without having to install a virtual machine or buying a new NIC card etc?

Vinay

The Tun/Tap approach uses a software-only virtual miniport. It shows up as a
separate network adapter in the Network Control Panel. The driver or
companion software must implement at least some packet handling including
ARP/DHCP spoofing, address management. Implementation of higher-level packet
management depends on how you implement your tunnel. Having done this the
virtual miniport has it’s own MAC address and can be on a separate subnet -
which is probably needed for IP forwarding. A fairly big job.

The WDK includes NDIS 5 and a NDIS 6 virtual miniport samples in the
NetvMini folder. These samples do NOT implement the functionality that you
need, but are a good read.

On NDIS 6 there is a type of miniport called a “tunnel adapter”. I haven’t
tried this, but it is purported to eliminate the need for network layer
spoofing. I don’t know if there is enough documentation on this type of
adapter…

NDIS intermediate filter drivers also publish virtual miniport instances
that appear as separate adapters in the Network Control Panel. Conceivably
these could be bent to fit your needs. However, the NDIS filter virtual
miniports are tied to the same subnet as the physical NIC. So that makes IP
forwarding a little difficult.

Good luck!

Thomas F. Divine
http://www.pcausa.com


From:
Sent: Wednesday, January 11, 2012 11:40 PM
To: “Windows System Software Devs Interest List”
Subject: [ntdev] Recreating VMWare-like VMNet interfaces

> Hello,
>
> I am looking for a programmatic way or even a tool that allows me to
> achieve the following.
>
> I would like to use a Windows box with a single NIC and create 2 virtual
> interfaces attached to the same NIC. I would further like to set up IP
> forwarding using these 2 virtual interfaces so that a subnet using one of
> these interfaces as a default gateway can route packets out to the other
> side of the box through the other virtual interface.
>
> Internet <> VirtualInterfaceExternal-Box-VirtualInterfaceInternal <>
> Intranet
>
> The key here is 1 NIC card and IP-forwarding.
>
> I have been reading up on TUN/TAP drivers, loopback drivers, etc but just
> can’t figure out how I can use a tool or build a driver to achieve this.
>
> I know conceptually this must be possible as VMWare can create multiple
> virtual interfaces from a single physical NIC and have those virtual
> interfaces bridged onto the local LAN with their own mac and IP addresses
> pretty much like having 3 physical interfaces on the same box.
>
> How do I go about building this without having to install a virtual
> machine or buying a new NIC card etc?
>
> Vinay
>
> —
> NTDEV is sponsored by OSR
>
> 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

> I would like to use a Windows box with a single NIC and create 2 virtual interfaces attached to the

same NIC.

MUX IM is the solution. A virtual miniport on top of NDIS protocol which talks to the physical one.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com