I need to use a static MAC address and static IP, and I need to use two networks, one local, and one MACVLAN.
In docker compose, if I set the MAC address at the container level, neither of the networks use the requested MAC.
If I set the MAC address at the MACVLAN level, I get an error starting the container.
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: failed to add interface veth93a7698 to sandbox: error setting interface "veth93a7698" MAC to "1d:ab:98:82:eb:51": cannot assign requested address: unknown
I have seen multiple issues in google with assigning MAC addresses, and assigning properties to multiple networks.
I am hoping there is a way to assign a MAC to a MACVLAN netowrk when also using a local network?
Multiple IP’s can be associated with a MACVLAN network and every endpoint will get a unique MAC address, that is what a MACVLAN network does. The physical MAC of the parent network is irrelevant, as it is not used.
I want to use a specific MAC address and a specific IP for the specific network.
If you post a complete example (as in complete compose file and anonymized .env file), I can try it tomorrow.
The example you shared in your first post is incomplete, which prevented me from testing it right away. I know there is not much missing, but we experienced it often that problems are hidden in parts not being shared with us.
@pmglx06 please stop posting unformatted code blocks and screenshots of text. I formatted your first post, please edit it and look what I changed. Unformatted posts are hard or even impossible to read.
Please, format your post according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.
Example code block:
```
echo "I am a code."
echo "An athletic one, and I wanna run."
```
I get the same result, If I use the mac address from your example. Though, if I use a different mac, it indeed works.
I used: 02:42:05:96:eb:99 and it worked right away.
It depends on the mac address whether it works or not:
10:ab:98:82:eb:51 → ok
11:ab:98:82:eb:51 → error
12:ab:98:82:eb:51 → ok
13:ab:98:82:eb:51 → error
14:ab:98:82:eb:51 → ok
15:ab:98:82:eb:51 → error
16:ab:98:82:eb:51 → ok
17:ab:98:82:eb:51 → error
18:ab:98:82:eb:51 → ok
19:ab:98:82:eb:51 → error
1a:ab:98:82:eb:51 → ok
1b:ab:98:82:eb:51 → error
1c:ab:98:82:eb:51 → ok
1d:ab:98:82:eb:51 → error
1e:ab:98:82:eb:51 → ok
I have no idea what makes it a valid or invalid mac address…
You can assign any hexadecimal character to every position of a mac address, except the 2nd character in the first block, like the example from above shows.
As far as I understand the issue is the I/G bit, used to indicate unicast or multicast.
It must be set to unicast (bit set to 0), which allignes with the hexadecimal numbers that worked.
I agree, the error message could be more clear about the issue, and at least indicate that multicast mac addresses are not allowed.
update: I we only want LAA unicast, then the 2nd character in the first block can be only these ones: