Как создать vlan подключение на windows 10

В этой статье мы покажем, как настроить тегированный сетевой интерфейс с VLAN в Windows 10/11 и Windows Server 2019 (2022/2016/2012R2). Стандарт VLAN (Virtual

В этой статье мы покажем, как настроить тегированный сетевой интерфейс с VLAN в Windows 10/11 и Windows Server 2019 (2022/2016/2012R2). Стандарт VLAN (Virtual LAN) описан в 802.1Q и предполагает маркировку трафика с помощью тегов (vlanid), необходимую для отнесения сетевого пакета к той или иной виртуальной сети. VLAN используются для разделения и сегментирования сетей, ограничения широковещательных доменов и изоляции сегментов сети для повышения безопасности. В Windows вы можете настроить несколько логических сетевых интерфейсов с разными номерами VLAN на одном физическом интерфейсе несколькими способами.

Содержание:

  • Настройка VLAN интерфейсов в Windows 10 и 11
  • Добавить несколько VLAN ID в Windows Server 2019/2016
  • Как создать несколько VLAN в Windows Hyper-V?

Для использования VLAN необходимо соответствующим образом перенастроить порт коммутатора, куда подключен ваш компьютер/сервер. Порт должен быть переведен из режима access в режим транк. По умолчанию на транк порту разрешены все VLAN, но вы можете указать список номеров разрешенных VLAN(от 1до 4094), которые доступны на данном порту коммутатора Ethernet.

Настройка VLAN интерфейсов в Windows 10 и 11

В десктопных версиях Windows нет встроенный поддержки VLAN. По умолчанию драйвера большинства сетевых адаптеров обрезают в пакетах все VLAN-тэги и внешние VLAN становиться недоступными.

Для некоторых сетевых адаптеров вы можете задать номер VLAN в настройках драйвера:

  1. Запустите консоль диспетчера устройств (
    devmgmt.msc
    );
  2. Разверните секцию Network adapters и откройте свойства вашего сетевого адаптера;
  3. Перейдите на вкладку Advanced и найдите опцию VLAN ID;задать vlan-id в свойствах сетевого адаптера windows
  4. Здесь вы можете задать номер VLAN;
  5. У некоторых сетевых карт сначала нужно включить опцию Packet Priority and VLAN.включить поддержку vlan в драйвере windows

В современных версиях Windows 10 и 11 вы можете задать один тег VLAN для вашего сетевого интерфейса. Для этого используется командлет PowerShell для управления сетевыми настройками. Например, вы хотите задать VLAN 50 для вашего сетевого интерфейса с именем Ethernet1:

Set-NetAdapter –Name "Ethernet1" -VlanID 50

Для некоторых сетевых карт (Intel, Broadcom, HP, Realtek) доступны специальные утилиты, позволяющие создать в Windows виртуальный сетевой интерфейс с VLAN ID. Для этого на компьютере нужно установить специальный драйвер с поддержкой тегированного трафика 802.1Q и официальную утилиту от вендора.

Создаем VLAN интерфейсы в Windows 10/11 на сетевой карте Realtek

Для сетевых карт Realtek вы можете настроить несколько виртуальных сетевых адаптеров с различными VLAN с помощью утилиты Realtek Ethernet Diagnostic Utility. Найдите описание вашего сетевого контролера Realtek на сайте вендора, и проверьте что эта модель поддерживает VLAN. Например, в спецификации сетевого контроллера RTL8169SC(L) присутствует строка:

Supports IEEE 802.1Q VLAN tagging

проверка поддержки vlan 802.1q сетевой картой realtek

Скачайте и установите последнюю версию сетевого драйвера для вашего адаптера Realtek и запустите утилиту Realtec Ethernet Diagnostic Utility (Diagnostic Program for Win7/Win8/Win10/Win11).

Перейдите в раздел VLAN, нажмите кнопку Add и добавьте нужный VLAN ID. После этого в Windows появится новый сетевой интерфейс.

Realtek Ethernet Diagnostic Utility настройка vlan

После того, как вы создали сетевые интерфейсы для ваших VLAN, вы можете задать на них нужный IP из соответствующей подсети.

Добавляем VLAN интерфейсы на сетевом адаптере Intel Ethernet

У Intel для настройки VLAN есть собственная утилита Intel Advanced Network Services (Intel® ANS) VLAN. Ваша модель сетевого адаптера, естественно, должна поддерживать технологию VLAN (например, VLAN не поддерживаются для карт Intel PRO/100 и PRO/1000). При установке драйвера выбейте опции Intel PROSet for Windows Device Manager и Advanced Network Services.

После этого в свойствах физического сетевого адаптера Intel появляется отдельная вкладка VLANs, где вы можете добавить несколько VLAN интерфейсов.

Однако этот способ работает во всех предыдущих версиях Windows (до Windows 10 1809). В последних версиях Windows на этой вкладке присутствует надпись:

Intel(R) Advanced Network (Intel(R) ANS) Teams and VLANs are not supported on Microsoft Windows 10.

Intel(R) Advanced Network (Intel(R) ANS) Teams and VLANs are not supported on Microsoft Windows 10

Intel недавно выпустила обновленные драйвера сетевых адаптеров и утилиту Intel PROSet Adapter Configuration Utility для последних версий Windows 10 и 11. Скачайте и установите последнюю версию драйвера Intel и утилиту Intel PROset.

Запустите утилиту, перейдите на вкладку Teaming/VLANs, нажмите кнопку New, и укажите имя сетевого интерфейса и его VLANID.

Intel PROSet Adapter Configuration Utility

Кроме того, вы можете добавить/удалить/просмотреть список VLAN на сетевых картах Intel с помощью специальных PowerShell командлетов из модуля IntelNetCmdlets. Импортируйте модуль в свою PowerShell сессию:

Import-Module -Name "C:Program FilesIntelWired NetworkingIntelNetCmdletsIntelNetCmdlets" -Scope Local

Вы можете создать нетегированный виртуальный сетевой адаптер (обычно используется с native-vlan-id):

Add-IntelNetVLAN -ParentName "Intel(R) Ethernet Connection I219-LM" -VLANID 0

Чтобы создать сетевой адаптер Intel с конкретным номером VLAN:

Add-IntelNetVLAN -ParentName "Intel(R) Ethernet Connection I219-LM" -VLANID 11

Чтобы вывести список всех виртуальных сетевых адаптеров Intel:

Get-NetAdapter

Удалить VLAN адаптер:

Remove-IntelNetVLAN -ParentName "Intel(R) Ethernet Connection I219-LM" -VLANID 11

командлеты Get-IntelNetVLAN, Add-IntelNetVLAN

Для сетевых карт Broadcom вы можете создавать группы виртуальных сетевых интерфейсов и назначать им VLAN ID с помощью утилиты Broadcom Advanced Control Suite.

Добавить несколько VLAN ID в Windows Server 2019/2016

В Windows Server 2022/2019/2016/2012R2 вы можете настроить несколько VLAN на одном сетевом интерфейсе с помощью встроенных средств (без установки специальных драйверов или утилит). Попробуем настроить несколько разных VLAN на одной физической сетевой карте в Windows Server 2019 с помощью NIC Teaming.

Обязательно убедитесь, что в настройках параметров дополнительных свойств сетевого адаптера не задана VLAN (значение VLAN ID = 0). настройка vlanid в свойствах драйвера

  1. Запустите Server Manager -> Local и нажмите на ссылку «NIC Teaming«;
  2. В секции Teams нажмите Task -> New Team. Укажите имя группы и выберите сетевые адаптеры, которые нужно в нее добавить; создать nic teaming интерфейс в windows server 2016

    Можно создать группу NIC Teaming с помощью PowerShell:
    New-NetLbfoTeam -Name vTeam -TeamMembers "Ethernet1","Ethernet2" -TeamingMode SwitchIndependent -LoadBalancingAlgorithm Dynamic

  3. Теперь в секции «Adapter and Interfaces» можно добавить виртуальные сетевые интерфейсы. Нажмите Tasks -> Add Interface; Добавить VLAN интерфейс
  4. Укажите имя создаваемого интерфейса и номер VLAN; nic teaming добавить vlan в Windows server 2016

    Из PowerShell добавить сетевой интерфейс и задать ему VLAN можно так:
    Add-NetLbfoTeamNic -Team vTeam -VlanID 50 -Name VLAN50

  5. Аналогичным образом можно добавить столько сетевых интерфейсов VLAN, сколько нужно;

    Обратите внимание, что в Windows Server 2022/2019/2016 поддерживает не более 32 сетевых адаптеров (и соответственно уникальных VLAN) для одной группы NIC Teaming.

  6. Для каждого сетевого интерфейса в панели управления сетевыми адаптерами (ncpa.cpl) появится отдельная виртуальная сетевая карта; виртуальные vlan интерфейсы nic teaming в windows server
  7. Теперь вы можете настроить IP параметры всех созданных виртуальных VALN сетевых интерфейсов вручную в свойствах адаптера или с помощью PowerShell командлетов New-NetIPAddress и Set-DnsClientServerAddress:
    New-NetIPAddress -InterfaceAlias my_VLAN_interface -IPAddress 192.168.30.30 -PrefixLength 24 -DefaultGateway 192.168.30.1
    Set-DnsClientServerAddress -InterfaceAlias my_VLAN_interface -ServerAddresses 192.168.1.10

Как создать несколько VLAN в Windows Hyper-V?

Вы можете программно обрабатывать VLANы в Windows через через подсистему Hyper-V (доступно как в Windows Server, так и десктопных Windows 10/11 Pro и Enterprise редакциях). Вы можете создать виртуальный свитч с сетевым адаптером в определённом VLAN.

Для этого нужно установить компоненты Hyper-V:

Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All

Создайте новый виртуальный коммутатор через Hyper-V Manager или с помощью команд PowerShell (см. пример в статье о настройке Hyper-V Server).

Затем для каждого VLAN, который нужно создать, выполнить команды:

Add-VMNetworkAdapter -ManagementOS -Name VLAN50 -StaticMacAddress "11-22-33-44-55-AA" -SwitchName VLAN50Switch
Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName VLAN50 -Access -VlanId 50

В результате у вас в системе появится сетевой адаптер с нужным тегом VLAN.

Если на вашем Hyper-V сервере запущены ВМ, вы можете поместить их в разные VALN. Чтобы переключить виртуальны сетевой адаптер ВМ на Hyper-V в режим Access и разрешить получать трафик только с определенным VLAN ID, используется команда:

Set-VMNetworkAdapterVlan -VMName Test1 -Access -VlanId 21

Вывести список ВМ и назначенных им VLAN:

Get-VMNetworkAdapterVLAN

В Windows Server 2022 с ролью Hyper-V вы не сможете привязать виртуальный свитч к такому тиминг-интерфейсу. Дело в том, что что LBFO NIC Teaming устарел (https://aka.ms/lbfodeprecation) и в Windows Server 2022 предлагается использовать Switch Embedded Teaming (SET).

Рассмотрим, как создать виртуальный адаптер и назначить ему VLAN в Windows Server 2022 Hyper-V с помощью SET.

Создайте виртуальный свитч, подключённый к сетевым адаптерам хоста:

New-VMSwitch -Name "HVSwitch1" -NetAdapterName "Ethernet3","Ethernet4" -EnableEmbeddedTeaming $true

Теперь создайте виртуальны адаптер, подключенный к виртуальному свитчу:

Add-VMNetworkAdapter -ManagementOS -Name "VLAN11" -StaticMacAddress "XX-XX-XX-XX-XX-XX" -SwitchName "HVSwitch1"

Назначьте тег VLAN для вашего виртуального адаптера:

Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "VLAN11" -Access -VlanId 11

Если нужно, чтобы виртуальный адаптер Hyper-V мог принимать пакеты из нескольких VLAN, можно использовать такую команду:

Get-VMNetworkAdapter -Name youradaptername | Set-VMNetworkAdapterVlan -Trunk -AllowedVlanIdList 50-59 -NativeVlanId 0

Параметр -NativeVlanId 0 обязателен. В этом случае мы указываем Hyper-V, что VLAN:0 используется в качестве нативного для нетегированного трафика.

Если вы пытались работать с VLAN под Windows, особенно при попытке получить доступ к VLAN на физическом оборудовании из виртуальных машин под Hyper-V или VMware, у вас, скорее всего, ничего не получилось.

Всё дело в том, что раньше Windows не имел встроенного механизма работы с VLAN, но в последних версиях Windows Server он появился.

Драйвера сетевых адаптеров, по умолчанию, обрезают в пакетах все VLAN-тэги и внешние VLAN становиться недоступными.

В этой статье мы рассмотрим, как настроить windows 10 таким образом, чтобы адаптер не обрезал VLAN-тэги у пакетов, приходящих на заданный интерфейс.

В Windows 10 есть возможность указать VLAN в настройках адаптера, но это вариант, для отдельных случаев и нам он не подходит, если мы работаем с эмуляторами ЛВС, например, GNS3. У нас может быть сколько угодно виртуальных сетей с разными VLANID и каждый раз менять в настройках адаптера VLAN нам не подходит.

В Wireshark эта проблема давно известна, и они создали в своей wiki страницу, на которой описали варианты решения проблемы для нескольких производителей чипов для сетевых адаптеров.

Я использую адаптер — D-Link DUB-E100 USB2.0, и всё описанное ниже, помогло заставить работать VLAN в GNS3.

Настройка адаптера

Сперва нам нужно узнать GUID нашего адаптера, в моем случае это USB-адаптер, для этого запускаем PowerShell с правами админа и запускаем команду:

PS C:WINDOWSsystem32> Get-NetAdapter

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
Ethernet 2                D-Link DUB-E100 USB2.0 to Fast Ether...      14 Up           C8-22-19-11-8D-CB       100 Mbps
Ethernet                  Realtek PCIe GBE Family Controller            8 Up           70-85-44-22-94-82         1 Gbps
VMware Network Adapte...8 VMware Virtual Ethernet Adapter for ...       7 Up           00-50-56-C0-00-08       100 Mbps
VMware Network Adapte...1 VMware Virtual Ethernet Adapter for ...       4 Up           00-50-56-C0-00-01       100 Mbps

Смотрим ifIndex нужного устройства, у меня он равен 8.

Запускаем regedit с правами администратора.

Откройте в нём следующий путь (просто вставьте в строку поиска на самом верху и нажмите Enter):

HKLMSYSTEMCurrentControlSetControlClass{4D36E972-E325-11CE-BFC1-08002bE10318}

В списке справа найдите раздел с номером своего адаптера, в моем случае это 008.

Всё что нам осталось это изменить значения нескольких значений:

MonitorModeEnabled - 1
MonitorMode - 1
*PriorityVLANTag - 0
SkDisableVlanStrip - 1

Как показано на рисунке:

2020-09-02_15-20-27.png

После этого обязательно перезагрузите ПК.

Вот и всё, после загрузки ПК у вас должен заработать VLAN, например, в GNS3.

Единственным недостатком можно назвать появление «мусора» в дампе Wireshark на настроенном интерфейсе, например, такого:

147231	114.119306	172.16.1.253	172.16.1.254	HTTP	1514	[TCP Spurious Retransmission] Continuation
147232	114.122191	172.16.1.254	172.16.1.253	TCP	60	[TCP ACKed unseen segment] 51752 → 3080 [ACK] Seq=433 Ack=400568275 Win=1051136 Len=0
147233	114.122235	172.16.1.254	172.16.1.253	TCP	60	[TCP ACKed unseen segment] 51752 → 3080 [ACK] Seq=433 Ack=400571195 Win=1051136 Len=0
147234	114.122252	172.16.1.254	172.16.1.253	TCP	60	[TCP ACKed unseen segment] 51752 → 3080 [ACK] Seq=433 Ack=400574115 Win=1051136 Len=0
147235	114.122265	172.16.1.254	172.16.1.253	TCP	60	[TCP ACKed unseen segment] 51752 → 3080 [ACK] Seq=433 Ack=400577035 Win=1051136 Len=0
147236	114.122275	172.16.1.254	172.16.1.253	TCP	60	[TCP ACKed unseen segment] 51752 → 3080 [ACK] Seq=433 Ack=400579955 Win=1051136 Len=0
147237	114.122284	172.16.1.254	172.16.1.253	TCP	60	[TCP ACKed unseen segment] 51752 → 3080 [ACK] Seq=433 Ack=400582875 Win=1051136 Len=0
147238	114.122298	172.16.1.254	172.16.1.253	TCP	60	[TCP ACKed unseen segment] 51752 → 3080 [ACK] Seq=433 Ack=400585795 Win=1051136 Len=0
147239	114.122310	172.16.1.254	172.16.1.253	TCP	60	[TCP ACKed unseen segment] 51752 → 3080 [ACK] Seq=433 Ack=400588715 Win=1051136 Len=0
147240	114.122319	172.16.1.254	172.16.1.253	TCP	60	[TCP ACKed unseen segment] 51752 → 3080 [ACK] Seq=433 Ack=400591635 Win=1051136 Len=0
147241	114.122330	172.16.1.254	172.16.1.253	TCP	60	[TCP ACKed unseen segment] 51752 → 3080 [ACK] Seq=433 Ack=400594555 Win=1051136 Len=0
147242	114.122345	172.16.1.254	172.16.1.253	TCP	60	[TCP ACKed unseen segment] 51752 → 3080 [ACK] Seq=433 Ack=400597475 Win=1051136 Len=0

Но его можно и отфильтровать, так что это не такая большая проблема. Именно поэтому я и использую сетевой usb-адаптер, чтобы эксперименты не вредили реальной ЛВС.

Если вы знаете способ избавиться от этой проблемы – пишите в комментариях.

Заключение

Сегодня мы рассмотрели настройку Windows с целью разрешить доступ к физическим VLAN из виртуальных серверов.

Мы узнали Id нашего адаптера и внесли изменения в реестр Windows.

После перезагрузки Windows доступ к VLAN появился.

In this article, we’ll show how to configure a tagged VLAN interface on Windows 10/11 and Windows Server 2019 (2022/2016/2012R2). The VLAN (Virtual LAN) specification is described in the IEEE 802.1Q standard and involves marking traffic with tags (vlanid) so that a network packet may be referred to a particular virtual network. VLANs are used to separate and segment networks, restrict broadcast domains, and isolate network segments to improve security. On Windows, you can configure multiple logical network interfaces with different VLAN ID on a single physical NIC using different tools.

Contents:

  • Creating Multiple VLAN Interfaces on Windows 10 and 11
  • How to Configure Multiple VLANs on Windows Server 2022/2019/2016?
  • Create Multiple VLANs with Windows Hyper-V Role

In order to use VLAN on Windows, you need to reconfigure the physical switch port to which your computer/server is connected to. The port must be switched from access mode to trunk mode. By default, all VLANs are allowed on a trunk port, but you can set the list of allowed VLAN numbers (1 to 4094) available at this Ethernet switch port.

Creating Multiple VLAN Interfaces on Windows 10 and 11

Windows desktop editions don’t natively support VLAN tagging. By default, most network adapter drivers ignore all VLAN tags in network packets and external VLANs become inaccessible.

For some network adapters, you can set the VLAN number in the driver properties:

  1. Run the Device Manager (devmgmt.msc);
  2. Expand the Network adapters section and open the properties of your network adapter;
  3. Go to the Advanced tab and find the VLAN ID option;set vlanid in NIC driver properties
  4. You can set the VLAN number here;
  5. For some NICs, you first need to enable the Packet Priority and VLAN option.enable vlan support in windows driver

In modern versions of Windows 10 and 11, you can set one VLAN tag for a network interface adapter. You can use PowerShell to manage network settings.  For example, you want to set VLAN ID 24 for your network interface named Ethernet0:

Set-NetAdapter –Name "Ethernet0" -VlanID 24

For some NICs (from Intel, Broadcom, HP, Realtek), special tools are available that allow you to create a virtual network interface in Windows with a VLAN ID. To do this, you need to install a special driver on your computer that supports 802.1Q tagged traffic and the official configuration tool from the vendor.

Create Multiple VLANs on a Realtek NIC in Windows 10 or 11

For Realtek NICs, you can configure multiple virtual NICs with different VLANs using the Realtek Ethernet Diagnostic Utility. Find the description of your Realtek network controller on the vendor’s website, and check that this model supports VLAN. For example, the specification for the RTL8169SC(L) network controller has this option:

Supports IEEE 802.1Q VLAN tagging

8021q vlan tagging support in realtek nic description

Download and install the latest network driver for your Realtek adapter and run the Realtek Ethernet Diagnostic Utility (Diagnostic Program for Win7/Win8/Win10/Win11).

Go to the VLAN section, click Add and add the required VLAN ID. After that, a new network interface will appear in Windows.

create vlan on windows 10 using the Realtek Ethernet Diagnostic Utility

After creating network interfaces for your VLANs, you can assign the IP addresses from the corresponding IP network.

How to Setup VLAN on an Intel Ethernet Network Adapter?

Intel has its own Intel Advanced Network Services (Intel® ANS) tool for configuring VLAN interfaces. Your network adapter model, of course, must support VLAN (for example, VLAN is not supported for NICs such as Intel PRO/100 or PRO/1000). When installing the driver, select the Intel PROSet for Windows Device Manager and Advanced Network Services options.

Then a separate VLANs tab appears in the properties of your physical Intel network adapter, where you can create multiple VLAN interfaces.

However, this method works on all previous versions of Windows (up to Windows 10 1809). In modern Windows 10/11 builds, the following message is displayed in the VLANs tab:

Intel(R) Advanced Network (Intel(R) ANS) Teams and VLANs are not supported on Microsoft Windows 10.

Intel(R) Advanced Network (Intel(R) ANS) Teams and VLANs are not supported on Microsoft Windows 10.

Intel recently released new network adapter drivers and the Intel PROSet adapter configuration tool for the latest builds of Windows 10 and 11. Download and install the latest Intel driver and Intel PROset utility.

Run the configuration tool, go to the Teaming/VLANs tab, click the New button, and specify the name of the network interface and its VLANID.

add a new VLAN on Windows using Intel PROSet Adapter Configuration Utility

In addition, you can add/remove/view the list of VLANs on Intel NICs using the PowerShell cmdlets from the IntelNetCmdlets module. Import the module into your PowerShell session:

Import-Module -Name "C:Program FilesIntelWired NetworkingIntelNetCmdletsIntelNetCmdlets" -Scope Local

You can create an untagged virtual network adapter (usually used with native-vlan-id):

Add-IntelNetVLAN -ParentName "Intel(R) Ethernet Connection I219-LM" -VLANID 0

To create an Intel NIC with a specific VLAN number:

Add-IntelNetVLAN -ParentName "Intel(R) Ethernet Connection I219-LM" -VLANID 103

To list all virtual Intel network adapters:

Get-NetAdapter

Remove VLAN interface:

Remove-IntelNetVLAN -ParentName "Intel(R) Ethernet Connection I219-LM" -VLANID 103

IntelNetCmdlets powershell module - list vlans Get-IntelNetVLAN

For Broadcom NICs, you can create groups of virtual network interfaces and assign VLAN IDs using the Broadcom Advanced Control Suite tool.

How to Configure Multiple VLANs on Windows Server 2022/2019/2016?

In Windows Server 2022/2019/2016/2012R2, you can configure multiple VLANs on the same network interface using built-in tools (without installing third-party drivers and tools). Let’s try to configure multiple VLANs on the same physical NIC in Windows Server 2019 using NIC Teaming.

Make sure that no VLAN number is set in the network adapter advanced settings (VLAN ID = 0). disable vlanid in the physical NIC properties on Windows Server 2016

  1. Open the Server Manager -> Local and click the NIC Teaming link;
  2. In the Teams section, click Task -> New Team. Specify the group name and select network adapters to add; windows server 2012 configuring nic teaming

    You can create a NIC Teaming group using PowerShell:
    New-NetLbfoTeam -Name vTeam -TeamMembers "Ethernet1","Ethernet2" -TeamingMode SwitchIndependent -LoadBalancingAlgorithm Dynamic

  3. Then in the “Adapter and Interfaces” section, add virtual network interfaces. Click Tasks -> Add Interface; Nic teaming add interface
  4. Enter the name of the interface you are going to create and a VLAN number; nic teaming on windows server 2016 - adding vlan interface

    You can add a network interface and set a VLAN for it in PowerShell:
    Add-NetLbfoTeamNic -Team vTeam -VlanID 24 -Name VLAN24

  5. In the same way, you can add as many VLAN network interfaces as you need;

    Please note that Windows Server 2022/2019/2016 supports a maximum of 32 NICs (and unique VLANs) per NIC Teaming group.

  6. A separate virtual network adapter will appear in the list of network connections in ncpa.cpl;multiple vlan on windows server with nic teaming
  7. Now you can configure the IP settings for each VLAN interface in the properties of the network adapter or using PowerShell cmdlets:
    New-NetIPAddress -InterfaceAlias your_VLAN_interface -IPAddress 192.168.10.10 -PrefixLength 24 -DefaultGateway 192.168.10.1
    Set-DnsClientServerAddress -InterfaceAlias your_VLAN_interface -ServerAddresses 192.168.100.12

Create Multiple VLANs with Windows Hyper-V Role

You can programmatically handle multiple VLANs in Windows through the Hyper-V subsystem (available in both Windows Server and desktop Windows 10/11 Pro and Enterprise editions). You can create a virtual switch with a network adapter in a specific VLAN.

To do this, you need to install Hyper-V components:

Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All

Create a new virtual switch through Hyper-V Manager or using PowerShell commands (see an example in the article on how to configure Hyper-V Server).

Then run the following commands for each VLAN you want to create:

Add-VMNetworkAdapter -ManagementOS -Name VLAN24 -StaticMacAddress "11-11-AA-BB-CC-DD" -SwitchName vSwitch2
Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName VLAN24 -Access -VlanId 24

So a network adapter with the VLAN you want will appear in Windows.

If you have VMs running on your Hyper-V server, you can put them in different VLANs. To switch the virtual network adapter of a VM on Hyper-V to Access mode and allow it to receive traffic only with a specific VLAN ID, use the command:

Set-VMNetworkAdapterVlan -VMName MyVMName1 -Access -VlanId 30

Display a list of VMs and their assigned VLANs:

Get-VMNetworkAdapterVLAN

In Windows Server 2022 with the Hyper-V role, you won’t be able to bind a virtual switch to such a teaming interface. The fact is that LBFO NIC Teaming is a deprecated feature on Windows Server 2022 (https://aka.ms/lbfodeprecation). Instead of NIC Teaming, it is proposed to use Switch Embedded Teaming (SET).

Let’s create a virtual adapter and assign a VLAN to it on Windows Server 2022 Hyper-V using SET.

Create a virtual switch connected to the host’s physical adapters:

New-VMSwitch -Name HVVLANSwitch1 -NetAdapterName "Ethernet3","Ethernet4" -EnableEmbeddedTeaming $true

Now create a virtual adapter connected to the virtual switch:

Add-VMNetworkAdapter -ManagementOS -Name "VLAN22" -StaticMacAddress "XX-XX-XX-XX-XX-XX" -SwitchName HVVLANSwitch1

Assign a VLAN tag to your virtual adapter:

Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "VLAN22" -Access -VlanId 22

You can enable the virtual Hyper-V adapter to receive packets from multiple VLANs using the command:

Get-VMNetworkAdapter -Name youradaptername | Set-VMNetworkAdapterVlan -Trunk -AllowedVlanIdList 40-69 -NativeVlanId 0

The -NativeVlanId 0 parameter is required. In this case, we tell Hyper-V that VLAN:0 is used as native for untagged traffic.

To use vlans under Windows 10 you need to use powershell and the setup is pretty simple. Open powershell as an administrator type in the following

Set-NetAdapter –Name «Ethernet Adapter Name» -VlanID XXX where «Ethernet Adapter Name» is the name of your ethernet adapter and xxx is the VLAN ID number in this case 99

If your ethernet adapter supports VLANS you will get asked to apply the vlan to the ethernet adapter much like the image below

Otherwise you will get an error like this

If your successful then you can get DHCP if it is enabled on the network or make changes to your IP address with what ever you need.  As you can see below I have a .97.83 address from a DHCP server on VlanID 99

I had 2 different laptops I tested this with a Lenovo Y580 with a Qualcomm Atheros AR8161 PCI-E Gigabit Ethernet Controller (NDIS 6.30), and a Lenovo ThinkPad E570 with a Realtek R8111GUS PCI-E Ethernet Controller.  The Realtek did not seem to support vlan tagging though windows but you can try installing the Realtek diagnostic toolkit and see if you can get vlan tagging enabled.  This was a test just with straight Windows 10.  

I’ve recently learned that MAC OS has the ability to turn the integrated NIC into a trunk port. The manner by which it does this is it creates a virtual NIC assigned to each VLAN that has been defined to flow across the trunk. The following website provides a walkthrough on how to set it up: here.

I’d like to know if this is possible in Windows 10. The intent is to bridge virtual machines running in VMware Workstation on a laptop to separate virtual NICs each configured for different VLANs. Each virtual NIC would then be bridged to a separate vmnic in VMware. The laptop would then be connected to a switch with a configured trunk port.

I’ve learned recently about Intel’s Advanced Network Services feature here. But it doesn’t appear to be supported in Windows 10 as shown on that website

asked May 2, 2019 at 15:27

dutsnekcirf's user avatar

This works in Windows 10 if you download the intel ans drivers.
But only on intel NICs
You can see some info if you type this into Powershell (with ANS installed)

get-help Add-IntelNetVLAN -detailed
  • The syntax is like this, creates two virtual adapters, one for each vLan

    add-intelnetvlan
    
    cmdlet Add-IntelNetVLAN at command pipeline position 1
    
      Supply values for the following parameters:
        ParentName[0]: Intel(R) Ethernet Connection (7) I219-LM
        ParentName[1]:
            VLANID[0]: 109
            VLANID[1]: 117
            VLANID[2]:
    
      VLANID VLANName                                       ParentName
      ------ --------                                       ----------
      104    VLAN104                                        Intel(R) Ethernet 
      Connection (7) I219-LM
    
      107    VLAN107                                        Intel(R) Ethernet 
      Connection (7) I219-LM
    

JW0914's user avatar

answered Aug 22, 2019 at 13:27

Rune Hagen's user avatar

Realtek NIC adapters have an «Ethernet Diagnostic Utility» which works in Windows 10, similar to Intel’s «Advanced Network Services VLANs». You can find it here, listed as «Diagnostic Program for Win7/Win8/Win10», along with drivers for supported Realtek NIC chipsets.

Once installed, to create a virtual network adapter assigned to a VLAN:

  1. Open the «Realtek Ethernet Diagnostic Utility».
  2. Click on the Realtek card.
  3. Click on VLAN.
  4. Click the «Add» button.
  5. Enter the desired VLAN ID and press Return.

A new Ethernet adapter will appear, and you can configure it as any physical adapter: assign an static IP, for example. Using the Realtek utility, you can easily modify the ID or MAC of the virtual adapters, or delete them.

answered Nov 6, 2020 at 10:28

Jose Francisco Lopez Pimentel's user avatar

Not possible in windows 10. You can in Windows Server with NIC Teaming.

answered Jul 16, 2019 at 14:13

MZimb's user avatar

MZimbMZimb

111 bronze badge

1

The TCP/IP Networking Stack in Windows doesn’t natively support vLANs, however OpenVPN created a workaround that can be utilized to create feature-limited vLANs on Windows.

  1. Download and install OpenVPN
  2. Once installed, run C:Program FilesTAP-Windowsbinaddtap.bat
  3. WinKey+ROpen: ncpa.cpl → OK
  4. Right-click on TAP adapter → Properties
    1. Required: ConfigureAdvancedMedia StatusAlways Connected
    2. Internet Protocol Version 4GeneralUse the following IP address
      • Required: IP address & Subnet mask
      • Not Required: Default gateway, Preferred / Alternate DNS server
        (set if using DHCP/DNS server for IP subnet)

Note:

  • This is a feature-limited vLAN and not like vLANs created on BSD/Linux
  • AFAIK, to support vLAN tagging [802.1q], you must use either:
    • NIC hardware supporting tagging
      or
    • Type 1 hypervisor (Hyper-V)

answered Aug 22, 2019 at 14:52

JW0914's user avatar

7

In windows 10 Professional, you can use Hyper-V to create a virtual switch connected to you network adapter, then you can create a Virtual Machine in Hyper-V with a Virtual Network adapter to which ever Vlan you want to access on each. You can also have multiple Virtual switches in a VM to access different Vlans at the same time. So instead of running your VM in VMware you can create them and run them in Hyper-V.

answered May 30, 2022 at 23:55

Jason's user avatar

I’ve recently learned that MAC OS has the ability to turn the integrated NIC into a trunk port. The manner by which it does this is it creates a virtual NIC assigned to each VLAN that has been defined to flow across the trunk. The following website provides a walkthrough on how to set it up: here.

I’d like to know if this is possible in Windows 10. The intent is to bridge virtual machines running in VMware Workstation on a laptop to separate virtual NICs each configured for different VLANs. Each virtual NIC would then be bridged to a separate vmnic in VMware. The laptop would then be connected to a switch with a configured trunk port.

I’ve learned recently about Intel’s Advanced Network Services feature here. But it doesn’t appear to be supported in Windows 10 as shown on that website

asked May 2, 2019 at 15:27

dutsnekcirf's user avatar

This works in Windows 10 if you download the intel ans drivers.
But only on intel NICs
You can see some info if you type this into Powershell (with ANS installed)

get-help Add-IntelNetVLAN -detailed
  • The syntax is like this, creates two virtual adapters, one for each vLan

    add-intelnetvlan
    
    cmdlet Add-IntelNetVLAN at command pipeline position 1
    
      Supply values for the following parameters:
        ParentName[0]: Intel(R) Ethernet Connection (7) I219-LM
        ParentName[1]:
            VLANID[0]: 109
            VLANID[1]: 117
            VLANID[2]:
    
      VLANID VLANName                                       ParentName
      ------ --------                                       ----------
      104    VLAN104                                        Intel(R) Ethernet 
      Connection (7) I219-LM
    
      107    VLAN107                                        Intel(R) Ethernet 
      Connection (7) I219-LM
    

JW0914's user avatar

answered Aug 22, 2019 at 13:27

Rune Hagen's user avatar

Realtek NIC adapters have an «Ethernet Diagnostic Utility» which works in Windows 10, similar to Intel’s «Advanced Network Services VLANs». You can find it here, listed as «Diagnostic Program for Win7/Win8/Win10», along with drivers for supported Realtek NIC chipsets.

Once installed, to create a virtual network adapter assigned to a VLAN:

  1. Open the «Realtek Ethernet Diagnostic Utility».
  2. Click on the Realtek card.
  3. Click on VLAN.
  4. Click the «Add» button.
  5. Enter the desired VLAN ID and press Return.

A new Ethernet adapter will appear, and you can configure it as any physical adapter: assign an static IP, for example. Using the Realtek utility, you can easily modify the ID or MAC of the virtual adapters, or delete them.

answered Nov 6, 2020 at 10:28

Jose Francisco Lopez Pimentel's user avatar

Not possible in windows 10. You can in Windows Server with NIC Teaming.

answered Jul 16, 2019 at 14:13

MZimb's user avatar

MZimbMZimb

111 bronze badge

1

The TCP/IP Networking Stack in Windows doesn’t natively support vLANs, however OpenVPN created a workaround that can be utilized to create feature-limited vLANs on Windows.

  1. Download and install OpenVPN
  2. Once installed, run C:Program FilesTAP-Windowsbinaddtap.bat
  3. WinKey+ROpen: ncpa.cpl → OK
  4. Right-click on TAP adapter → Properties
    1. Required: ConfigureAdvancedMedia StatusAlways Connected
    2. Internet Protocol Version 4GeneralUse the following IP address
      • Required: IP address & Subnet mask
      • Not Required: Default gateway, Preferred / Alternate DNS server
        (set if using DHCP/DNS server for IP subnet)

Note:

  • This is a feature-limited vLAN and not like vLANs created on BSD/Linux
  • AFAIK, to support vLAN tagging [802.1q], you must use either:
    • NIC hardware supporting tagging
      or
    • Type 1 hypervisor (Hyper-V)

answered Aug 22, 2019 at 14:52

JW0914's user avatar

7

In windows 10 Professional, you can use Hyper-V to create a virtual switch connected to you network adapter, then you can create a Virtual Machine in Hyper-V with a Virtual Network adapter to which ever Vlan you want to access on each. You can also have multiple Virtual switches in a VM to access different Vlans at the same time. So instead of running your VM in VMware you can create them and run them in Hyper-V.

answered May 30, 2022 at 23:55

Jason's user avatar

I’ve recently learned that MAC OS has the ability to turn the integrated NIC into a trunk port. The manner by which it does this is it creates a virtual NIC assigned to each VLAN that has been defined to flow across the trunk. The following website provides a walkthrough on how to set it up: here.

I’d like to know if this is possible in Windows 10. The intent is to bridge virtual machines running in VMware Workstation on a laptop to separate virtual NICs each configured for different VLANs. Each virtual NIC would then be bridged to a separate vmnic in VMware. The laptop would then be connected to a switch with a configured trunk port.

I’ve learned recently about Intel’s Advanced Network Services feature here. But it doesn’t appear to be supported in Windows 10 as shown on that website

asked May 2, 2019 at 15:27

dutsnekcirf's user avatar

This works in Windows 10 if you download the intel ans drivers.
But only on intel NICs
You can see some info if you type this into Powershell (with ANS installed)

get-help Add-IntelNetVLAN -detailed
  • The syntax is like this, creates two virtual adapters, one for each vLan

    add-intelnetvlan
    
    cmdlet Add-IntelNetVLAN at command pipeline position 1
    
      Supply values for the following parameters:
        ParentName[0]: Intel(R) Ethernet Connection (7) I219-LM
        ParentName[1]:
            VLANID[0]: 109
            VLANID[1]: 117
            VLANID[2]:
    
      VLANID VLANName                                       ParentName
      ------ --------                                       ----------
      104    VLAN104                                        Intel(R) Ethernet 
      Connection (7) I219-LM
    
      107    VLAN107                                        Intel(R) Ethernet 
      Connection (7) I219-LM
    

JW0914's user avatar

answered Aug 22, 2019 at 13:27

Rune Hagen's user avatar

Realtek NIC adapters have an «Ethernet Diagnostic Utility» which works in Windows 10, similar to Intel’s «Advanced Network Services VLANs». You can find it here, listed as «Diagnostic Program for Win7/Win8/Win10», along with drivers for supported Realtek NIC chipsets.

Once installed, to create a virtual network adapter assigned to a VLAN:

  1. Open the «Realtek Ethernet Diagnostic Utility».
  2. Click on the Realtek card.
  3. Click on VLAN.
  4. Click the «Add» button.
  5. Enter the desired VLAN ID and press Return.

A new Ethernet adapter will appear, and you can configure it as any physical adapter: assign an static IP, for example. Using the Realtek utility, you can easily modify the ID or MAC of the virtual adapters, or delete them.

answered Nov 6, 2020 at 10:28

Jose Francisco Lopez Pimentel's user avatar

Not possible in windows 10. You can in Windows Server with NIC Teaming.

answered Jul 16, 2019 at 14:13

MZimb's user avatar

MZimbMZimb

111 bronze badge

1

The TCP/IP Networking Stack in Windows doesn’t natively support vLANs, however OpenVPN created a workaround that can be utilized to create feature-limited vLANs on Windows.

  1. Download and install OpenVPN
  2. Once installed, run C:Program FilesTAP-Windowsbinaddtap.bat
  3. WinKey+ROpen: ncpa.cpl → OK
  4. Right-click on TAP adapter → Properties
    1. Required: ConfigureAdvancedMedia StatusAlways Connected
    2. Internet Protocol Version 4GeneralUse the following IP address
      • Required: IP address & Subnet mask
      • Not Required: Default gateway, Preferred / Alternate DNS server
        (set if using DHCP/DNS server for IP subnet)

Note:

  • This is a feature-limited vLAN and not like vLANs created on BSD/Linux
  • AFAIK, to support vLAN tagging [802.1q], you must use either:
    • NIC hardware supporting tagging
      or
    • Type 1 hypervisor (Hyper-V)

answered Aug 22, 2019 at 14:52

JW0914's user avatar

7

In windows 10 Professional, you can use Hyper-V to create a virtual switch connected to you network adapter, then you can create a Virtual Machine in Hyper-V with a Virtual Network adapter to which ever Vlan you want to access on each. You can also have multiple Virtual switches in a VM to access different Vlans at the same time. So instead of running your VM in VMware you can create them and run them in Hyper-V.

answered May 30, 2022 at 23:55

Jason's user avatar

Понравилась статья? Поделить с друзьями:
  • Как создать uwp приложение для windows 10
  • Как создать usb диск восстановления windows 10
  • Как создать uefi разделы при установке windows
  • Как создать txt файл на windows 11
  • Как создать tgz архив в windows