I have a series of modules (similar to a RPi) that run a Linux flavor each having an Ethernet NIC. I have 4 of these and I want to connect them to a switch to be able to send UDP packets to each one individually from a host connected to the same switch. Each one has its own IP address in the subnet. It seems simple enough to get this to work, the problem is all of them have the same MAC Address (except for the host). This of course causes problems with the switch when sending packets to the modules. Packets to the host are received fine.

I am not able to change their MAC Addresses, only the IP Addresses, although that won't help much given that the switch works based on MAC entries.

With this setup the only way to make sure the UDP packets actually reach the modules every time would be to broadcast them all over the subnet. The problem with this approach is that they don't handle very well the fact of being constantly flooded with packets that initially aren't for them. The time spent handling the packet causes timeouts in the system which renders this solution unfeasible.

Another solution would be to isolate each in one VLAN in order to separate broadcast domains and configure the routing paths accordingly. The problem with this is that I don't have spare equipment that I could use to do this and even if I had, my networking knowledge is limited when it comes to VLANs.

At this point I would need an advice about this problem... maybe a scenario that I haven't thought about yet in which I could get this to work with as few extra hardware as possible?

Thank you in advance!

  • Is the traffic one-way?
    – Ron Maupin
    Commented Nov 29, 2015 at 2:05
  • No. The host sends one packet to a module, that module responds to the host with 1 or more packets depending on what is requested by the host.
    – DNuno
    Commented Nov 29, 2015 at 2:12
  • Then you have a problem. You either need to change the MAC addresses or have them on different layer-2 domains. If they all came with the same MAC address, you should have a claim against the manufacturer. Normally, the network stack can override the BIA, but questions about configuring consumer-grade equipment are off-topic.
    – Ron Maupin
    Commented Nov 29, 2015 at 2:17
  • The manufacturer is willing to replace the modules for free but I have to send them over to the US and that would take time. What would be the basic configuration of a managed switch or router to properly separate them in different VLANs and still allow UDP traffic between them?
    – DNuno
    Commented Nov 29, 2015 at 2:26
  • That depends on the switch make and model. Each manufacturer has different ways to configure its equipment. Some use CLI and some use HTTP or HTTPS.
    – Ron Maupin
    Commented Nov 29, 2015 at 2:28

3 Answers 3


Put every device in a different VLAN:

device 1: vlan 11,
device 2: vlan 12,

Put a different IP network for each device:

device 1:
device 2:

Then put your host in a trunk with all the vlans. Having an interface on your PC to each vlan would do the trick:

int eth0.11: ip address
int eth0.12: ip address

Note: I used /24 networks but you can totally use /31 (or /127 in IPv6).

If your switch can route, then route with it, or you can plug a router too.

There may be a way by configuring the interfaces as point to point interfaces, but I have never done this (and it would be even more awkward).

  • Thank you for your input but as I said in the original post I don't have the necessary equipment to do this.
    – DNuno
    Commented Dec 2, 2015 at 1:14

The core of your problem here (as Ron Maupin pointed out in his comment) is that, since broadcasting everything to every module won't work for you, you need either to change the module MAC addresses or have the modules on separate Ethernet networks. Here are my suggestions.

  1. Check carefully to make sure that you really can't change the module Mac addresses. If they're similar to a Raspberry Pi, does that mean that they're running Linux? If so, most Linux Ethernet drivers offer the ability to change the MAC address via a command such as ifconfig eth0 hw ether 02:01:02:03:04:08. If you can get to a command line, you can try this. If you don't want to do this manually every time the module reboots, you'll also need to figure out if you can make it permanent in some way; the link above provides some suggestions about that.

    If that doesn't work, you'll have to go with separate layer 2 networks, which the next suggestions below do in one way or another.

  2. Connect each module to a separate Ethernet interface on the host. This could be done with a multi-port PCI Ethernet card (which is not terribly cheap), several single-port PCI Ethernet cards plus whatever you have on-board your host, or, if your application is (relatively) low-bandwidth, several USB-Ethernet interfaces. Each would be both a separate Ethernet and a separate IP network, as per the VLAN solution.

  3. Use VLANs as described in Xavier Nicollet's answer. This is not as expensive as it might first seem; a five port VLAN switch such as the NetGear GS105Ev2 (also second-sourced as the TL-SG105E) can be had for well under US $50.

Some of the above suggestions assume you're running Linux on the (non-module) host; if you're not you may be able to deal with this, if not particularly conveniently, by putting a Linux host between the main host and the modules. (You could use virtual machines if you want to avoid extra hardware). Next time, specifying the exact devices and software you're using would be a great help.


In addition to the network-centric answers already present, you should alternatively be able to change the MAC address in Linux using ifconfig:

# ifconfig eth0 down
# ifconfig eth0 hw ether 02:80:48:BA:d1:30
# ifconfig eth0 up
# ifconfig eth0 |grep HWaddr


This needs to be included in the startup procedure, it doesn't survive a reboot.

To avoid any possible duplicates you should use a locally administered MAC (LAA) with the first octet's bit 1 set to 1, i.e. the first octet needs to be divisible by two but not by four (x2, x6, xa, xe).

An alternative way to handle the problem is to use L2 broadcasting at all times - this is an ugly hack, so it should be done on a separate segment for these devices.

On the source (or the router connecting these devices) set up a static ARP entry for each device with its IP address mapped to ff:ff:ff:ff:ff:ff - this way, the switch is used like a hub and every packet is sent to every device. Each packet is received by every device but unless the destination IP matches it gets dropped again. On the devices, routing must be disabled to avoid them trying to forward non-local packets.

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.