24.10 macvlan gateway already in use

I have upgraded to 24.10 and want to use a macvlan to set container IP addresses. From either the Truenas CLI or Portainer (installed via Truenas app store), I’ve been unsuccessful. It is unclear to me if this is a PEBKAC or a problem with Truenas or something else.

On my network, I have only the single, default VLAN. My gateway is at 192.168.1.1 and my networks subnet is 192.168.1.0/24. 192.168.1.200 is the IP address of the truenas server.

What I want is my docker containers to have static IP addresses in this range.

Using the truenas shell:

$ sudo docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=eno1 my-macvlan-net
[sudo] password for admin: 
Error response from daemon: invalid pool request: Pool overlaps with other one on this address space

If I do the same from portainer, using the same value (though create config + creat network using config flow), I get the following when creating the network proper:

Failure
Unable to create network: failed to allocate gateway (192.168.1.1): Address already in use

Within portainer, there is no network shown that uses 192.168.1.1
Within the truenas CLI:

$ ip addr | grep 192.168                                                                                           
    inet 192.168.1.200/24 brd 192.168.1.255 scope global dynamic eno1

My understanding is that subnet and gateway should mirror the physical LAN.

I’m at a bit of a loss here, everything I’ve ready suggests this should “just work”. If I use an incorrect gateway, e.g., 192.168.1.254, I can access the containers at the expected IP, but the containers don’t have internet access.

From what i understand you cant assign addresses to apps in EEL…

I should clarify these are custom apps pulling docker.io compose yml.

My understanding that macvlan’s will work is based on the understanding in these threads

Just what the error message says.
You’re using 192.168.1.0/24 as subnet, and you’re trying to use that as macvlan subnet as well.
Broaden your subnet (192.168.0.0/16 is available playing ground), keep your physical machines on 192.168.1.0/24 and use 192.168.2.0/24 as macvlan.

I have no issues when creating a macvlan for subnet 192.168.0.0/24 even though my main interface is also using 192.168.0.0/24.

Can you check for already existing macvlan docker networks using:

  • sudo docker network ls

Can you check for already existing macvlan docker networks using:
That’s what is odd. There are no other macvlans as far as I know

sudo docker network ls
[sudo] password for admin: 
NETWORK ID     NAME                   DRIVER    SCOPE
c883fdf091e7   bridge                 bridge    local
b1ab4d9183bc   host                   host      local
1423eb210f54   ix-portainer_default   bridge    local
9441984a93e4   macvlan-config         null      local
988f56be7e30   none                   null      local

Using --subnet=192.168.0.0/24 gives me:

sudo docker network create -d macvlan --subnet=192.168.0.0/24 --gateway=192.168.1.1 -o parent=eno1 my-macvlan-net
no matching subnet for gateway 192.168.1.1
--subnet=192.168.0.0/24 --gateway=192.168.1.1

Gateway is out of subnet.

You’re right, was typing the wrong thing sorry. I think /16 and /23 should be correct? Neither work

admin@truenas[~]$ sudo docker network create -d macvlan --subnet=192.168.0.0/16 --gateway=192.168.1.1 -o parent=eno1 my-macvlan-net 
[sudo] password for admin: 
Error response from daemon: invalid pool request: Pool overlaps with other one on this address space
admin@truenas[~]$ sudo docker network create -d macvlan --subnet=192.168.0.0/23 --gateway=192.168.1.1 -o parent=eno1 my-macvlan-net 
Error response from daemon: invalid pool request: Pool overlaps with other one on this address space

docker network create -d macvlan -o parent=ens3 --subnet 192.168.0.0/24 --gateway 192.168.0.254 --ip-range 192.168.0.40/29 macvlan-net

Use the ip-range argument to constrain the addresses handed out by docker to containers. Use the subnet to specify your actual subnet, and thus the gateway should be in the subnet. I believe docker will use .1 if you don’t specify a gateway.

Thank you very much for the pointers. I was able to get it to work with the following:

sudo docker network create -d macvlan --subnet=192.168.0.0/22 --ip-range 192.168.1.208/28 --gateway 192.168.1.1 -o parent=eno1 macvlan
2 Likes