1

I'm creating a completely virtual network between different network namespaces on the same host. I'm going to be telling programs to use IPv6 link-local addresses for networking.

One problem I currently have is that the virtual network devices are assigned an initial link-local address but are set in the 'tentative' state while DAD (Duplicate Address Discovery) is done. I would like to assume that this address will not be replaced or removed from the interface.

How bad of an assumption is this if the devices only interact with other virtual devices running on the same host? Is there any way for the kernel to assign the same MAC address to two different virtual devices?

I could just wait for DAD to complete. But that takes 1.8 seconds, and for this application, that is FAR too long. Ideally a program would be up and running in the new network namespace within 10s of µsecs, though 100s of µsecs would probably be acceptable.

  • 2
    eg for veth.c: eth_hw_addr_random() --> eth_random_addr() --> get_random_bytes() and that's it. There's no collision check (well, DAD is the check). You should assign MACs yourself with your own method if you want to be 101% sure. – A.B Nov 10 '17 at 0:01
  • @A.B - Hmm, that's a possibility. But that's also kind of disappointing to learn. :-/ – Omnifarious Nov 10 '17 at 0:15
  • I'm sure most container (or vm) hypervisor would record the randomly created value or create it themselves, and would check for duplicates. Or it can be checked easily (eg for lxc how difficult would it be to compare all /var/lib/lxc/*/config and see if there are duplicate lxc.network.hwaddr ?). Now if everything is made from scratch, well if it has to be done it has to be done – A.B Nov 10 '17 at 0:28
  • @A.B - Well, in this case I'm writing my own process isolation system in C++ that isn't any of these. And part of the reason I'm doing it is to very quickly dynamically create isolation contexts. The isolation contexts will hide parts of the filesystem, but largely they all have the same read-only view of the filesystem. – Omnifarious Nov 10 '17 at 0:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.