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.
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.
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
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
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.