TransWikia.com

Creating a virtual NIC that connects to the same network as physical NIC

Super User Asked by tvc on December 7, 2021

How can I create a virtual interface, that connects to the same network as the physical interface? I tried searching around but all I found is loopback. I need the other end of the wire recognizes this as two interface, so loopback won’t do it. Hypervisors like VMWare have an option to do exactly this (VM and host are recognized as two devices on router’s arp table), but in my situation using a VM is pretty much overkill. I just want another connection, or maybe some apps that can behave as a “virtual switch”.

I’m on Windows, and it should be like this.

Expected_Virtual_Network

Seems like I’m not the only one having this problem. Someone here and here have also asked but there’s no acceptable answer. My apologize, but it is extremely hard to search for this problem.

4 Answers

First you'll need to create an external v-switch using Hyper-V (available on win10. I'm not sure, but I think you'll need the Pro installation).

After creating the v-switch your physical NIC will shift to Hyper-V's management and a virtual NIC (representing that v-switch) will be created (replacing the physical one).

You can add another windows v-NIC to that v-switch by using the Power-Shell command (you have to run it as administrator):

Add-VMNetworkAdapter -ManagementOS -SwitchName <Hyper-V's vSW name> -Name <vNIC name>

For more information check this link: Working with Virtual NIC’s in Windows

Answered by Guest on December 7, 2021

netsh wlan set hostednetwork mode=allow ssid=randomwifiname key=12345678

netsh wlan start hostednetwork

Requires admin privileges, creates a virtual wireless network that has its own interface. You can enable internet sharing, DHCP automatically or static. By default its IP/subnet is completely separate from the usual 192.168.xxx.xxx local interfaces.

Answered by Rib Addi on December 7, 2021

Procedure for Linux:

So originally I'm asked this to be done in Windows. But since the Windows-way will cost me another 2 hours I decided to do this on a linux box. Anyway here's how I did it, thanks to this answer. Hope this will solve someone's problem in the future. In short:

  1. Create a virtual link on your existing interface. You should get a Locally Administered Address (here) to pass in so it won't potentially mess things up (and also a recommended way to do):

    ip link add link eth0 address 56:8A:C0:DD:EE:FF eth0.1 type macvlan

  2. Bring the interface up:

    ifconfig eth0.1 up

  3. And acquire an address:

    dhclient -v eth0.1

Futher reading:

If you insist on a * real virtual * interface, there's a package named vde2 for the purpose of creating virtual switches on linux. Haven't tried that out, but maybe it can helps. It's annoying a little bit that such 'small' tool doesn't exist in Windows.

(Yes, I'm creating a link, not really an interface. But it did get my job done. I'm sorry if my question is misworded, you can edit it to clarify. But in the end of the day it shows up as an interface and traffic did goes thru that interface so probably it is solved?)

Answered by tvc on December 7, 2021

Procedure:

  1. Enable Hyper-V feature in Windows from optionalfeatures.exe or with command prompt using the following command as administrator and restart PC.

    DISM.exe /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V /NoRestart
    
  2. Open Hyper-V Manager from start menu or with run dialog box, type virtmgmt.msc. Go to Virtual Switch Manager > New Virtual Network Switch > Select External type > Create Virtual Switch > OK. It is important to select External type for that virtual network switch. See the article below for further details.

Hyper-V_External_Virtual_NIC

  1. Open Network Control Panel (ncpa.cpl) > Select Virtual Network Interface (with vEthernet name) > Change it's IP and MAC address. IP can be in same subnet of real NIC and of same default gateway.

Further Reading:

Answered by Biswapriyo on December 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP