May 3, 20251 yr Hello, I am trying to replicate the Unraid behavior of the MACVLAN interface option (picture below), that is listed under each container, inside Portainer. The goal is, to have the same option when deploying a Portainer stack as with Unraid when starting a docker and selecting a Custom adapter, which in my case is Custom: br0.10, so a macvlan adapter that connects to the bride br0.10 which also is a parent of eth0.10 from the tagged VLAN 10. Unfortunately the network creation in Portainer (which is using the same docker socket from my understanding) is not as trivial. In the two step process of Creating a configuration and creating the network itself, I tried multiple combinations for subnet, ip range and gateway. -> The gateway seems to be the main problem: if I set 192.168.10.1 as a gateway, I get the error that the gateway can't be assigned twice. I saw a similar problem here: Link, What is the correct IP to use as a gateway ? It seems to be a virtual docker gateway, but what is it used for in the macvlan scenario and why is it not the same as my network gateway. -> If I set a different gateway, I am able to create a container via a stack, but the container has no internet connection and can't ping other containers even in the same subnet (which the macvlan containers created via Unraid directly can !) Unraid Docker (Portainer as an example): Portainer: My exact configuration in Portainer: - name: examplenetwork_config - driver: macvlan - parent network: br0.10 - subnet: 192.168.10.0/24 - IP range: 192.168.10.40/29 (that is actually the range I want to assign for this stack, Unraid shouldn't assign anything near there with 192.168.10.128/26 set in the Unraid docker settings.) - gateway: 192.168.10.1 And when trying to create the network with: - name examplenetwork - driver: macvlan - configuration: examplenetwork_config I get the following error: "Failure Unable to create network: failed to allocate gateway (192.168.10.1): Address already in use" When changing the config to: - name: examplenetwork_config - driver: macvlan - parent network: br0.10 - subnet: 192.168.10.0/24 - IP range: 192.168.10.40/29 - gateway: 192.168.10.40 I can create the network, but as already mentioned it can not reach anything. What am I doing wrong here ? I also don't understand where my error is in the thought process, because in Unraid directly it works flawlessly. Is "Custom: br0.10" really a macvlan bridge, how else would each container get it's own IP ? Any help or even tips would be appreciated. Edited May 3, 20251 yr by blacklight
May 3, 20251 yr Community Expert Reveiw your docker network inspect and take a look... https://docs.docker.com/reference/cli/docker/network/inspect/ this has to due with unraid generation of the default macvlan/ipvaln custom br0 docker network... You essential have to stop using autostart and use user script to mimic what these function would do as at startup with preserver docker networks. You would delta the unriad default macvaln/ipvlan and recreate it adding ipv6 and other support... which can break unraid docker templates and networks... -I made a feature request due to similar issues... As the abilty for unraid to not autocreate any docker networks... let presser and custom make them at boot... to maintain custom network especial with the use of vlans... SO, my bet, is that before you instaleld and used protaner if you run the docker network inspect commands you will see that unraid disables ipv6 networks in the docekr cross talk... the new one made with protainer has ipv6 enabled true... unraid has sadly broken and removed ipv6 due to network bridge complication and borken bridge issues. they did this to ensure ipv4 communication works. when you edited and made a vlan docker network protainer added extra settings per its programming and made a ipv6 able but unriad systemctl doesn't have ipv6 abilities any more (outside of initail netwrok interface obtraining a ipv6 address... and Unriad won't forwarded the traffic over the bridge interface... Usually when ipv6 is implemented or supersedes ipv4 and thus all network traffic tries on ipv6 and thus fails... you may need to run this script and additional to add for the br0.vlan # #!/bin/bash # Delay before starting sleep 10 # Apply sysctl settings apply_sysctl_settings() { echo "Applying sysctl settings..." sysctl -w net.ipv6.conf.all.forwarding=1 sysctl -w net.ipv6.conf.br0.accept_ra=2 sysctl -w net.ipv6.conf.br0.accept_ra_rt_info_max_plen=64 sysctl -w vm.overcommit_memory=1 echo "Verifying sysctl settings..." sysctl net.ipv6.conf.all.forwarding sysctl net.ipv6.conf.br0.accept_ra sysctl net.ipv6.conf.br0.accept_ra_rt_info_max_plen sysctl vm.overcommit_memory } apply_sysctl_settings Edited May 3, 20251 yr by bmartino1 typo - data
May 3, 20251 yr Community Expert to fix this don't use protainer to make docker networks.. make sure unraid docker setting have preserver user defined: and run the docker netowkr create comand in unraid before portainer starts... as unriad need to make the docker network to properly use it... docker network create -d macvlan \ --subnet=192.168.10.0/24 \ --ip-range=192.168.10.40/29 \ --gateway=192.168.10.1 \ -o parent=br0.10 \ examplenetwork_config Notes: -d macvlan: specifies the driver --subnet: the full subnet of VLAN 10 --ip-range: limits usable IPs for this network --gateway: your VLAN 10 gateway -o parent=br0.10: uses the custom VLAN interface Unraid has examplenetwork_config: the name of the Docker network https://docs.docker.com/reference/cli/docker/network/create/ this will give you the docker network named examplenetowrk_conf per your info at the top...
May 12, 20251 yr Author I tried to test what you suggested, but I get the same problem with the docker command in the Unraid CLI as with Portainer. root@Icarus:~# docker network create -d macvlan \ --subnet=192.168.10.0/24 \ --ip-range=192.168.10.40/29 \ --gateway=192.168.10.1 \ -o parent=br0.10 \ base_test_network Error response from daemon: failed to allocate gateway (192.168.10.1): Address already in use Despite the fact that I rebooted the system and turned portainer autostart off (so it didn't start at all during this cycle), the "Gateway already in use" problem remains. On 5/3/2025 at 9:55 PM, bmartino1 said: you may need to run this script and additional to add for the br0.vlan # From what I understand, this is an additional problem right ? I didn't do anything about the autostart/ipv6 problem. Is this mandatory to be able to create the custom network at all ? The thing is that I am little anxious to start messing around with automatically created network settings in Unraid. I did this in the past and it sometimes took weeks for me to get the system running again, because I am simply not that proficient in networking. I wouldn't mind to create this custom networks in the CLI instead of inside portainer directly, but I want to try to avoid messing with the autostart procedures, if possible. Any idea why I can't create the network in the CLI (assuming your 2 posts are not directly dependent on each other) ?
May 12, 20251 yr Community Expert 2 hours ago, blacklight said: I tried to test what you suggested, but I get the same problem with the docker command in the Unraid CLI as with Portainer. root@Icarus:~# docker network create -d macvlan \ --subnet=192.168.10.0/24 \ --ip-range=192.168.10.40/29 \ --gateway=192.168.10.1 \ -o parent=br0.10 \ base_test_network Error response from daemon: failed to allocate gateway (192.168.10.1): Address already in use Despite the fact that I rebooted the system and turned portainer autostart off (so it didn't start at all during this cycle), the "Gateway already in use" problem remains. From what I understand, this is an additional problem right ? I didn't do anything about the autostart/ipv6 problem. Is this mandatory to be able to create the custom network at all ? The thing is that I am little anxious to start messing around with automatically created network settings in Unraid. I did this in the past and it sometimes took weeks for me to get the system running again, because I am simply not that proficient in networking. I wouldn't mind to create this custom networks in the CLI instead of inside portainer directly, but I want to try to avoid messing with the autostart procedures, if possible. Any idea why I can't create the network in the CLI (assuming your 2 posts are not directly dependent on each other) ? you may need to run a script that deletes the unraid default docker network... as Quote Error response from daemon: failed to allocate gateway (192.168.10.1): Address already in use tell me that a docker network already exist and is unable to gateway route off network to access the internet/intranet network as the default made can conflict and get in the way do to internal sub routing and ip access to a interface. You already have a docker that needs to be removed first using 192.168.10.x Quote From what I understand, this is an additional problem right ? I didn't do anything about the autostart/ipv6 problem. Is this mandatory to be able to create the custom network at all ? as stated. ipv6 is disabled by default yes this would be mandatory to use ipv6 over the bridge No it is not required to make custom docker networks. Edited May 12, 20251 yr by bmartino1
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.