Docker Windows - Cannot create ipvlan on other then eth0 - wsl2 interface mirroring active

Hi everybody!

I run Windows 11 Pro, with Docker Desktop installed. WSL2 is active and I use Ubuntu as the Linux distribution.

My goal is to have my Docker-Containers run with their own IP-addresses in my LAN using IPVLAN. I want to do this with using one of my 4 network interfaces on the server.

What I have read is that WSL2 uses some kind of Hyper-V network wrapper and with standard-settings the network interfaces are not available in WSL2. So I set network mirroring and now my interfaces are also visible in WSL2 / Ubuntu and they also have the same IP like in Windows. So the mapping seems to work.

Now I enter the following command (in Windows and Ubuntu I get the same error):

docker network create -d ipvlan --subnet 192.168.2.0/24 --gateway 192.168.2.1 -o parent=eth3 ipvlan2

I get this error:

Error response from daemon: invalid subinterface vlan name eth3, example formatting is eth0.10

If I use eth0 instead, it is working, but this is my main 10GBit interface I dont want to use here. eth1, eth2 and eth3 are not working.

In Ubuntu ip add sh delivers the following:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet 10.255.255.254/32 brd 10.255.255.254 scope global lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether f0:2f:74:ad:b8:26 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether a0:36:9f:e7:6d:6c brd ff:ff:ff:ff:ff:ff
inet 192.168.1.7/24 brd 192.168.1.255 scope global noprefixroute eth1
valid_lft forever preferred_lft forever
inet6 fe80::21c1:a2b8:1432:b0b9/64 scope link nodad noprefixroute
valid_lft forever preferred_lft forever
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether a0:36:9f:e7:6d:6e brd ff:ff:ff:ff:ff:ff
5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether f0:2f:74:ad:b8:23 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.150/24 brd 192.168.2.255 scope global noprefixroute eth3
valid_lft forever preferred_lft forever
inet6 fe80::30fa:863f:21ca:51eb/64 scope link nodad noprefixroute
valid_lft forever preferred_lft forever
6: loopback0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:4b:35:a0 brd ff:ff:ff:ff:ff:ff

What am I doing wrong? I also updated WSL, rebooted the server, which helps in 99% of the problems :wink: but no luck. And no more ideas. Please give me the final hint to make this work.

thx

Chris

Some more infos:

WSL-Version: 2.5.10.0
Kernelversion: 6.6.87.2-1
WSLg-Version: 1.0.66
MSRDC-Version: 1.2.6074
Direct3D-Version: 1.611.1-81528511
DXCore-Version: 10.0.26100.1-240331-1435.ge-release
Windows-Version: 10.0.26100.4652

Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble

Docker Desktop v4.44.3

Docker Desktop runs its backend as isolated process inside the docker-desktop wsl distribution. The interface that mirrors network traffic is not available inside the isolated docker backend.

Other wsl distros access the docker engine from Docker Desktop through a socket communication. Whatever you do in your Ubuntu distro does not affect the isolated docker engine that run inside the docker-desktop distro.

Neither Ipvlan, nor macvlan work with Docker Desktop.

Last time I tried, it didn’t even work if docker-ce was directly installed in a wsl2 distro: Macvlan, transparent, and host netowork types? - #3 by meyay .

Since neither Ipvlan nor macvlan is compatible with Docker Desktop, what methods are there to enable containers on Windows 11 to obtain independent IP addresses?

Each container already gets its own ip in the container network.
But if you refer to ips from your network: I am not aware of any working option.

Sorry, I didn’t make myself clear earlier. What I meant was ensuring that the container and the local area network (LAN) are on the same IP subnet. For example, on a Linux physical machine, using ipvlan or macvlan allows the container to obtain an independent IP address from the LAN. However, when I tried this on WSL under Windows, it didn’t work—communication isn’t possible. You mentioned earlier that Windows is incompatible with ipvlan or macvlan. Are there any alternative methods? Please let me know.thanks

I already did:

Docker Desktop always run the engine in a vm, and ipvlan and macvlan do not cross the borders of the vm network. With Docker Desktop for Windows the mirrored mode is not visible to the engine.

Even if you run docker-ce in a WSL2 distribution while using the networkMode=mirrored, ipvlan and macvlan still don’t work. The mirrored mode is not a bridge.

An alternative would be whatever vm solution provides a virtual switch that bridges the host network into the vm. I am not using any of those solutions, so there is nothing I can recommend.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.