libnetwork icon indicating copy to clipboard operation
libnetwork copied to clipboard

macvlan / ipvlan parent interface (e.g. en0 instead of eth0) broken on Mac OSX

Open claudobahn opened this issue 3 years ago • 15 comments

It appears the docker macvlan / ipvlan drivers expect parent (host) interfaces to follow linux-like interface naming (e.g. eth0 as a prefix) and break when faced w/ Mac OSX interface naming (e.g. en0)

When trying to set up a macvlan on Mac OSX w/ the primary network interface en0 as so: docker network create -d macvlan --subnet=172.16.86.0/24 --gateway=172.16.86.1 -o parent=en0 pub_net

The attempt fails with: Error response from daemon: invalid subinterface vlan name en0, example formatting is eth0.10 see https://github.com/moby/libnetwork/blob/d0951081b35fa4216fc4f0064bf065beeb55a74b/drivers/macvlan/macvlan_setup.go#L110

When trying to set up a 802.1q trunk macvlan as so: docker network create -d macvlan --subnet=172.16.86.0/24 --gateway=172.16.86.1 -o parent=en0.86 pub_net_86

The attempt fails with: Error response from daemon: -o parent interface does was not found on the host: en0 see https://github.com/moby/libnetwork/blob/d0951081b35fa4216fc4f0064bf065beeb55a74b/drivers/macvlan/macvlan_setup.go#L155

The same commands execute without complaint when eth0 instead of en0 is used, but since eth0 doesn't actually exist on the host, the containers are isolated from the network.

This issue was raised in https://github.com/docker/for-mac/issues/3926 but probably didn't get any visibility there. Hopefully it'll get noticed here.

claudobahn avatar Jan 22 '21 21:01 claudobahn

yeah, I recently looked into using macvlans and stumbled upon this..quite surprised this hasnt been fixed yet..

pkishino avatar Feb 18 '21 01:02 pkishino

+1

arrrgi avatar Sep 26 '21 07:09 arrrgi

+1

jkneer avatar Nov 27 '21 16:11 jkneer

+1

domgiles avatar Dec 10 '21 17:12 domgiles

+1

yd-null avatar Dec 29 '21 03:12 yd-null

+1

mgrofsky avatar Feb 07 '22 22:02 mgrofsky

+1

serkanmulayim avatar Apr 07 '22 22:04 serkanmulayim

+1

r4881t avatar Apr 08 '22 19:04 r4881t

+1

tymoor avatar Apr 17 '22 08:04 tymoor

+1

defmost avatar Jun 09 '22 09:06 defmost

+1 Anyone has a solution?

kingozorg avatar Jul 12 '22 11:07 kingozorg

+1

Shogobg avatar Jul 21 '22 08:07 Shogobg

+1

atulagrawal6 avatar Aug 01 '22 05:08 atulagrawal6

Unfortunately, the documentation specifies it not supported (yet?) on Windows and MacOS : https://docs.docker.com/network/network-tutorial-macvlan/ It would be useful to do it, I hope they implement it someday.

DannySauval avatar Aug 07 '22 15:08 DannySauval

+1

mandroid19 avatar Oct 01 '22 09:10 mandroid19

I was supprised that this issue hasn't been solved for such a long time.

summeryqc avatar Feb 24 '23 14:02 summeryqc

Yeah having similar issues with an ubuntu installation - neither network adapter gets a standard name

Trasen avatar Apr 13 '23 16:04 Trasen

since macvlan not supported on MAC OSX, I ended up to use macvlan via multipass on OSX

teyou avatar Apr 15 '23 03:04 teyou

Yeah having similar issues with an ubuntu installation - neither network adapter gets a standard name

same issue here:

just installed docker desktop, on ubuntu 23.04. So this is all newer versions of docker...

The process of installing docker desktop seemed to kill / destroy existing containers, and existing docker network definintions. So when trying to re-create the docker network. With same commands as had always worked before...

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

It has broken / regressed.

dreamcat4 avatar Jun 07 '23 08:06 dreamcat4

I believe that this bug might be related with the following changeset:

https://github.com/moby/libnetwork/commit/3a4b08f0b1869594adb1fdcf94b5cb3b8d544bdc

for sure, the bug occurs here:

~~https://github.com/moby/libnetwork/blob/master/drivers/macvlan/macvlan_network.go#L91~~ https://github.com/moby/moby/blob/master/libnetwork/drivers/macvlan/macvlan_network.go#L70

Maybe if the !parentExists() function (the logic of it) is only recognizing the eth0 naming convention? That would be the bug then? That this bit is not evaluating correctly?

~~https://github.com/moby/libnetwork/blob/master/drivers/macvlan/macvlan_setup.go#L67~~ https://github.com/moby/moby/blob/master/libnetwork/drivers/macvlan/macvlan_setup.go#L70

the ns.NlHandle().LinkByName(ifaceStr)

???

[REASON FOR EDIT] the repo code was moved to other repo now: (but is same exact code)

dreamcat4 avatar Jun 07 '23 09:06 dreamcat4

maybe can you help us understand this bug @arkodg ?

Sorry I am not familiar with go code, and these library functions that is being called out to. However this seems like where the error is happens. For any systems with an interface name... which isn't eth0 style

That the call ns.NlHandle().LinkByName(ifaceStr) may be failing.

BTW this code is duplicated between both the ipvlan and macvlan driver backends, if andthing needs fixing there too. Otherwise perhaps it is the underlying common library function is calling out to and failing to return the correct answer? (that, for example: en0 exists on the host as some real valid interface name).

dreamcat4 avatar Jun 07 '23 09:06 dreamcat4

OK. So here are some candidate bugs for the upstream library (the netlink is maintained by somebody else...)

https://github.com/vishvananda/netlink/issues/791

https://github.com/vishvananda/netlink/issues/755

https://github.com/vishvananda/netlink/issues/438

https://github.com/vishvananda/netlink/issues/325

However just don't have here the visibility (knowledge) to check which specific version of the netlink library my local docker installation was compiled to be using here. And I don't really have this same level of familiarity to go in here and try recompiling this macvlan driver from the git / to try with speculative edits and so on to those critical code path. To test out these theory. And give clearer answers

But until then... my docker is totally broken :(

Of course I can still provide some extra infos (such as specific docker version, exact kernel version). And follow some extra instructions / replace some binaries or .so file. It does not seem too challenging (at least not so far). Any further help is very much appreciated. And it seems "enough"? other people are affected? If indeed this matter was not fixed already?

dreamcat4 avatar Jun 07 '23 10:06 dreamcat4

Seems like this issue was 1st reported all the ways back in 2019 perhaps? (but was never looked at)

https://github.com/docker/for-mac/issues/3447

However this bug seems significant! I would recommend at least some look at it, if not should be considered looking towards critical / important / higher priority. Along those lines

dreamcat4 avatar Jun 07 '23 16:06 dreamcat4

Seems like this issue was 1st reported all the ways back in 2019 perhaps? (but was never looked at)

docker/for-mac#3447

However this bug seems significant! I would recommend at least some look at it, if not should be considered looking towards critical / important / higher priority. Along those lines

Documentation says this is not supported in Mac which sux. no idea why they cant fix it sicne 4 years. Just run into this issue and now looking into how i do i get a workaround with it.

miamilabs avatar Jul 02 '23 09:07 miamilabs

Any fixes?

czcll49 avatar Aug 03 '23 06:08 czcll49

Having the same issue on my Macos Ventura 13.x.x

norayr93 avatar Aug 15 '23 12:08 norayr93

same issue ...

shukla2009 avatar Aug 19 '23 04:08 shukla2009

Seems like this issue was 1st reported all the ways back in 2019 perhaps? (but was never looked at) docker/for-mac#3447 However this bug seems significant! I would recommend at least some look at it, if not should be considered looking towards critical / important / higher priority. Along those lines

Documentation says this is not supported in Mac which sux. no idea why they cant fix it sicne 4 years. Just run into this issue and now looking into how i do i get a workaround with it.

Did you get any workaround ?

enzofrnt avatar Oct 12 '23 06:10 enzofrnt

+1

kajarit avatar Oct 28 '23 22:10 kajarit

+1

nikjuice avatar Nov 13 '23 07:11 nikjuice