2 or more Uno + W5100 not working behind switch with static IP

Hello guys!

I need some help finding the issue, so far in two different networks I've had this problem. I think it's a Switch issue.

On the first network, I set up one of the arduinos with static IP and it works fine, but when I hook up the second one, it's like it doesn't exist. The also odd, but maybe misdiagnosed symptom I saw, is that this happened specifically with one IP in particular, but setting that IP to my computer works fine.

The second network has DHCP also, so I was able to work around it by setting the first arduino as static and the other ones as DHCP (not the solution I needed). Setting my computer as static with one of the IPs I should've used on the other arduinos works fine.

To weed out differences in code, I'm using one source and just comment/uncomment the needed MACs and IPs.

First Network:

EthernetClient client;

// uint8_t myMac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xAA, 0x01}; // CBB-1
uint8_t myMac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xAA, 0x02}; // CBB-2

// uint8_t myIP[]  = {190, 1, 96, 191}; // CBB-1
uint8_t myIP[]  = {190, 1, 96, 192}; // CBB-2
uint8_t myDNS[] = {200, 75, 0, 4};
uint8_t myGW[]  = {190, 1, 96, 4};
uint8_t myNM[]  = {255, 255, 255, 0};

.
.
.

Ethernet.begin(myMac, myIP, myDNS, myNM, myGW);

Second Network:

EthernetClient client;

uint8_t myMac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xAA, 0x01}; // Node-1
// uint8_t myMac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xAA, 0x02}; // Node-2
// uint8_t myMac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xAA, 0x03}; // Node-3
// uint8_t myMac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xAA, 0x04}; // Node-4


uint8_t myIP[]  = {192, 168, 0, 41}; // Node-1
// uint8_t myIP[]  = {192, 168, 0, 42}; // Node-2
// uint8_t myIP[]  = {192, 168, 0, 43}; // Node-3
// uint8_t myIP[]  = {192, 168, 0, 44}; // Node-4

uint8_t myDNS[] = {192, 169, 0, 4};
uint8_t myGW[]  = {192, 168, 0, 230};
uint8_t myNM[]  = {255, 255, 255, 0};

.
.
.

Ethernet.begin(myMac, myIP, myDNS, myNM, myGW);

While writing this, I noticed the DNS on the second network has a typo, but I never leave the network and only address by IP so it shouldn't be a problem.

Any help is much appreciated!

To weed out differences in code, I'm using one source and just comment/uncomment the needed MACs

The MAC address of the Ethernet shield is NOT a function of the network it is connected to.

If you need to change MAC addresses, based on the network, you have a serious problem that is not going to be solved here.

PaulS:
The MAC address of the Ethernet shield is NOT a function of the network it is connected to.

If you need to change MAC addresses, based on the network, you have a serious problem that is not going to be solved here.

Thanks for your reply.

I'm not very savvy network-wise, but since some devices have MAC filtering or don't allow dupes, I'm doing it out of precaution.

Should I test with both devices having the same MAC?

Should I test with both devices having the same MAC?

Yes, indeed.

Wait, wait. What do you mean "both devices"? I thought we were talking about one device on two different networks.

PaulS:
Yes, indeed.

Wait, wait. What do you mean "both devices"? I thought we were talking about one device on two different networks.

Maybe I explained myself poorly in the OP.

I've tried to configure arduino + W5100 with static IP in two different networks. In both networks, such attempt has failed. Since they were more than one, is why I commented on the different MACs.

I'm testing the same on a network I just set up in my office, and I can't seem to get it to work either. Seems I coded something wrong this time.

SOLVED!

If you notice, my Ethernet.begin call has the gateway and netmask reversed :frowning:

That was it, everything works perfectly now.

If you notice, my Ethernet.begin call has the gateway and netmask reversed

I hate when that happens. I pout at my computer for the rest of the day, when it is so stupid that it lets me do that.

PaulS:
I hate when that happens. I pout at my computer for the rest of the day, when it is so stupid that it lets me do that.

It suuuuuucks!