How do I assign the same IP and MAC address to multiple interfaces? This is easy on Linux, but I cannot figure out how to do it on OpenBSD. The (virtual) machine is assigned a single IP address by the hypervisor, so changing the IP not an option, and bridging is a no-go as all the peers share a MAC address. All netmasks are /32 for IPv4 and /128 for IPv6.
Each of the interfaces is a point-to-point Ethernet link, and both its IP and MAC address and that of its peer are statically known. All routes are also assigned statically. In short, I need to assign a route based purely on the name of an interface. The -ifp keyword in route(8) seems like it should be used for this, and the kernel sources indicate that it can be used to disambiguate which interface should be selected. However, I was not able to get it to work. I don’t have access to the VM I was using for testing anymore, but if I recall correctly, the C code and shell scripts I was using did the equivalent of the following: # ifconfig xnf0 inet 10.137.0.77 prefixlen 32 # route -n delete 10.137.0.77/32 10.137.0.77 # # this doesn’t work due to a route(8) bug ― I was using C code instead # # I submitted a bug report (with patch) to bugs@ a while back # route -n add -inet 10.137.255.254 -link fe:ff:ff:ff:ff:ff -ifp xnf0 -ifa 10.137.0.77 # ifconfig vether0 create lladdr fe:ff:ff:ff:ff:ff # ifconfig vether0 inet 10.137.0.77 prefixlen 32 # # this doesn’t work due to a route(8) bug ― I was using C code instead # route -n add -inet 10.139.255.254 -link fe:ff:ff:ff:ff:ff -ifp vether0 -ifa 10.137.0.77 # route -n delete 10.137.0.77/32 10.137.0.77 $ route -n show I expect that the route would to 10.139.255.254 would go through vether0, but it goes through xnf0 instead. If I then run: # ifconfig xnf0 -inet $ route -n show the route is gone. Should the above commands have worked? If not, is this just unsupported in OpenBSD? If it is supported, what should I have done differently? I did manage to create a workaround: I can assign each interface a unique alias address from the 169.254.0.0/16 link-local range, and use PF to NAT packets in this range to 10.137.0.77. However, this feels like an ugly hack. For IPv6, I can use the link-local address of each interface as the -ifa argument, so I am much less worried. Thank you for your time and attention. Sincerely, Demi M. Obenour
signature.asc
Description: OpenPGP digital signature