How to create two MACVLANs on same adapter with same gateway

I am trying to create two MACVLANs on the same adapter (eth0) in the same subnet ( and the same gateway ( - my router).

sudo docker network create -d macvlan -o parent=eth0 --subnet= --gateway= --ip-range= test1

this works well

sudo docker network create -d macvlan -o parent=eth0 --subnet= --gateway= --ip-range= test2

This produces errormessage

Error response from daemon: failed to allocate gateway ( Address already in use

i found this problem a couple of times on the net but unfortunately no solution. I guess i should extend the ip-range ( but i have no clue how to bind the two macvlans (test1 and test 2) then to a specific ip-adress.

I would appreciate your suggestions.

There is no usecase for two docker networks using the same gateway, as they wouldn’t be isolated after all. So as you said, you simply extend the range of the existing network. Then you assign an ip to your service, e.g. in your compose files:

    external: true

    container_name: yourservice
    image: yourservice