7

I have two devices with the same MAC address (don't ask why, I can't solve it by replacing those devices or modifying MACs) connected to one switch. Of course both of them get the same IP from DHCP and I'm unable to communicate with them.

I need some device to connect between switch and one of my devices to modify MAC in the fly... Is it possible?

I have absolutely no control over devices in my network (it is internal network in tape library). More over the MAC addresses of my devices must be from defined pool... It doesn't make problem trivial

6
  • 1
    Can you share any more about the tape library, like brand and model? It may be worth raising this with the manufacturer/supplier, if you have a support contract.
    – Criggie
    Commented Apr 29, 2023 at 1:36
  • 1
    Yes, we are going to ask why. Why can you not change one of them. Name and shame... Commented Apr 29, 2023 at 21:05
  • @Bib I suspect this is a case of OP not having a support contract and thus trying to make do on their own. Perhaps one of theirs accessors or drives has failed, so they took one from a different library (or bought it second-hand on eBay or so) and popped it in, only to discover that it has a MAC conflict. Changing the MAC probably requires reflashing the drive, which is basically impossible without vendor tools. Of course this is all just wild speculation.
    – TooTea
    Commented Apr 29, 2023 at 21:34
  • @TooTea, yes, but aren't manufacturers supposed to ensure BIA are all unique? And if they are not BIA, why can they not change it themselves? Your post is really stretching it. Commented Apr 29, 2023 at 22:18
  • @Bib I obviously don't know what system OP has,but I have worked with enterprise HW that used Ethernet as an internal interconnect between components (probably because it is fast enough and readily supported across architectures). There was no ARP nor any sort of L3 protocol on top. Addresses were like a 3-byte prefix encoding the model number and then perhaps two bytes for physical position (row and column) and a function/subcomponent number (or frame/row/column one byte each). So no discovery or configuration needed, all addresses hardcoded in firmware,which probably makes it much simpler.
    – TooTea
    Commented Apr 30, 2023 at 7:38

6 Answers 6

8

You can't have two devices using the same MAC within the same L2 segment/broadcast domain/VLAN. A duplicate MAC address makes switching unreliable (the switch forwards a frame addressed for the duplicate MAC to the port that it last received a frame on). Also, it disrupts IP-to-MAC address mappings like with ARP or NDP.

Of course both of them get the same IP from DHCP

Apart from using a duplicate MAC address, those devices can be considered broken. RFC 2131 clearly states that a DHCP client is obligated[1] to check the address offered by the server before requesting it:

The client SHOULD[1] perform a check on the suggested address to ensure that the address is not already in use. For example, if the client is on a network that supports ARP, the client may issue an ARP request for the suggested request.

You need to put both devices into separate segments or VLANs. That way the devices get different IP addresses via DHCP and can be addressed separately on the IP layer (L3), using an intermediate gateway/router (I'd use an L3 switch).

If intermediate routing isn't possible for some reason then you'd need to segregate those devices all the same, e.g. by using separate NICs (with or without separate switches or VLANs) or a proxy. More extensive alternatives include using a translating bridge made in software.

[1] SHOULD in IETF parlance is an obligation, with reasonable exceptions, see RFC 2119:

3. SHOULD     This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.

5
  • How about using linux server with two eth ports between device and switch and setting up ebtables to replace MAC addresses?
    – Tomasz
    Commented Apr 28, 2023 at 8:56
  • @Tomasz Likely possible, but not really a clean way to deal with the issue (imho) and not on topic here - feel free to add as a potential solution but please don't dive into the Linux details.
    – Zac67
    Commented Apr 28, 2023 at 11:25
  • 1
    @user253751 SHOULD in IETF parlance is an obligation unless there's a very good reason not to do it - see rfc-editor.org/rfc/rfc2119
    – Zac67
    Commented Apr 28, 2023 at 18:03
  • What about throwing one (or both) devices behind a switch - the switch would have a NAT table, and the problem would effectively go away. Is this a possible solution to the problem of two devices having the same MAC address?
    – BenKoshy
    Commented Nov 9, 2023 at 0:03
  • 1
    @BenKoshy NAT happens on L3/L4, a switch works at L2. Putting a router in between duplicate MACs does help as outlined in the answer. NAT doesn't particularly help , it only complicates communication here.
    – Zac67
    Commented Nov 9, 2023 at 5:15
5

There's no proper solution to connect two devices with the same MAC address on the same IP network.

However MAC addresses are only relevant within a layer 2 network. What you could do is create two different VLANs, each associated with a different IP network, and put each device in a different VLAN.

For example

VLAN 101 : 192.168.101.0/24 - Device 1
VLAN 102 : 192.168.102.0/24 - Device 2

Of course you would need a router to allow communication to / from both subnets at the same time. Depending on your infrastructure this can be a router on a stick and / or a virtual router (there's free solution for this).

1

There is no reason why such a device couldn't exist or be created, but I haven't been able to find one. My guess is that this is such a specialized use case that there is not enough demand for anyone to have thought about creating one.

My guess at the solution that would require the least work is to get a raspberry pi with two ethernet ports. You should be able to setup a bridge between the two ethernet connections. This normally would route between them based on MAC addresses detected on each, so you would have to modify the kernel code to interpose a MAC address mapping on one of the ports.

0

Assuming you can't change the switch's configuration. Add a router between the switch and the problematic device, like so:

    +------+   
    |Device|
    +------+
(MAC Address: A)
       |
       |
    +------+
    |Switch|
    +------+
       |
       |
 (MAC Address: B)
    +------+                      +------------------+
    |Router|------(MAC Address: A)|Problematic device|
    +------+                      +------------------+

This way your problematic device will be on another L2 segment and won't collide with your other device.

-1

A NAT device will be the only solution for the described scenario. If you really can't change the MAC address (virtually any modern device with a functioning operating system allows this with a bit of work) and you can't simply replace the device or add to the device (a USB or PCIe or other add-on NIC will have a different MAC address), and you are required to have them appear to be on the same layer 2 network segment, then your only choice is to hide the device.

A small travel router or similar device will let you setup a simple 1 to 1 NAT with access policy to allow all traffic through and the router will hide the duplicate MAC device on its own internal network functionally making it appear to be a different device on the main LAN where the other conflicting device is connected.

This design will prevent some common features from working, things like broadcast based discovery etc. will not work between the 2 devices since they will not technically be on the same broadcast/layer 2 network anymore.

Ideally, the true solution is to replace one of the devices or to find a way to change its MAC address. I would try to add a NIC or replace the device before trying a hack like using a NAT router or trying to put the 2 devices on separate layer 3 networks unless the layer 3 separation is acceptable.

If you can go with the layer 3 separation then do that. That is relatively easy if you have a router or layer 3 switch available to let you create VLAN segmentation or physical segmentation to isolate the 2 devices.

7
  • 1
    NAT is not the only solution here.
    – vidarlo
    Commented Apr 28, 2023 at 20:29
  • Did you have a suggestion then? I specifically said 'for the described scenario' and then mentioned other possible solutions that would apply in similar situations or if other options are available. But under the constraints: Can't replace devices, Can't change MAC addresses, Can't change existing switches, Must add a single device to allow the second device with MAC conflict to access the same LAN segment... what else is there? Commented Apr 28, 2023 at 20:46
  • NAT is not even /a/ /viable/ solution here, since it works at the transport layer while this is a data link layer issue. The only viable solutions would be (a) a switch which was sufficiently smart that it could be told to spoof the MAC of a device attached to a specific port (assuming this was compatible with Spanning Tree etc.) or (b) to interpose a couple of back-to-back Ethernet interfaces between the errant device and the switch. Commented Apr 29, 2023 at 11:53
  • "interpose a couple of back-to-back Ethernet interfaces between the errant device and the switch" That is literally the NAT solution. You put a router with NAT between the second device and the switch. Problem solved, assuming the NAT device does everything you need and the access needs are relatively basic TCP/UDP access as supported on common NAT implementations. Commented May 1, 2023 at 0:30
  • @FrameHowitzer The point is to split the broadcast domain between the devices. You can do that using VLANs, L3 router ports, different NICs, but NAT doesn't help here at all.
    – Zac67
    Commented Nov 9, 2023 at 7:08
-1

If two devices have the same MAC address and are connected to the same switch, it can cause network connectivity issues and can be difficult to determine which device is causing the problem. Here are some steps you can take to solve this issue:

Check the physical connections: Make sure that the cables connecting the devices to the switch are properly connected and functioning. Swap out the cables to see if that resolves the issue.

Identify the devices: Use the switch's port status or network monitoring tools to identify the two devices that have the same MAC address. Once you have identified the devices, you can try to determine which one is causing the issue.

Update firmware: If the devices are network cards or other devices that can be updated, update the firmware to see if that resolves the issue.

Configure MAC address: If the two devices have the same MAC address because they were incorrectly configured or cloned, you can reconfigure or reset the MAC address on one of the devices to a unique address.

Disable one device: If all else fails, you can disable one of the devices to see if that resolves the issue. This can help you identify which device is causing the problem and troubleshoot further.

If none of these steps work, it may be necessary to replace one of the devices to ensure that the network operates properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.