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 (192.168.10.0/24) and the same gateway (192.168.10.1 - my router).

sudo docker network create -d macvlan -o parent=eth0 --subnet=192.168.10.0/24 --gateway=192.168.10.1 --ip-range=192.168.10.199/32 test1

this works well

sudo docker network create -d macvlan -o parent=eth0 --subnet=192.168.10.0/24 --gateway=192.168.10.1 --ip-range=192.168.10.200/32 test2

This produces errormessage

Error response from daemon: failed to allocate gateway (192.168.10.1): 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 (192.168.10.199/29) 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:

networks:
  test1:
    external: true

services:
  yourservice:
    container_name: yourservice
    image: yourservice
    networks:
      test1:
        ipv4_address: 192.168.10.200