Ethernet Shield W5100 does not connect to the Blynk server via Switch, only with router

hi guys, i have the same problem…when connect Arduino directly at router it’s ok, all perfect…but when i use an ethernet switch and connect the same board with the same sketch, it’s impossible to connect at the server.
How can i fix?

Don’t use switch or find a quality shield that works… no other magical fixes available…

I think you might be on to something there. My W5100 shield works okay when plugged-in to a Netgear GS605 or GS608 switch, which are described as “Layer 3 Light” - whatever that means, but doesn’t work when plugged-in to a D-Link DGS-102D switch which is Layer 2.

Pete.

Sorry @Gunner, I know it’s 265 days since the last reply, but I think an explanation could help, not just for the W5100, but connection problems in general. And @PeteKnight kinda gave me a go-ahead :wink:

First of all, there is no “one solution” that’s applicable. Different hardware, different settings, different firmware, different boards etc makes the total possible configurations probably in the unsigned long long range.

First of all is to understand the difference between a router and a switch, what they do and don’t.

  • A switch works in the Data link layer of the OSI model. Also called Layer 2 since it’s the second layer. For short I’ll use “L2”. Communication in the L2 segment between nodes are done using MAC-addressing. The PDU (Protocol data unit) in L2 is the frame. When a node wants to send a packet to an unknown node (IP) on the same network, it sends out a broadcast message. The node with the corresponding IP answers with its MAC-address, which is then used for addressing. Mapping IP’s to MAC’s is done with the Address Resolution Protocol (ARP).

.

  • A router (Residential gateway might be a better definition) works in the Network layer, or Layer 3. When a computer wants to communicate with something outside its own subnet, or can’t determine a destination address, the data is sent to the default gateway, i.e. the router. Routing is done between two network addresses (IP). The PDU in L3 is packet.
    .
    Depending on the hardware, it could be set to Gateway mode where NAT is enabled or Router mode where NAT is disabled. NAT must be enabled!
    .

The initial problem for the poster with a switch behind the router might have worked if subnet mask, default gateway and DNS server was specified. Without those, the poor thing doesn’t know with whom to communicate. Due to the (possible) absence of a hardwired MAC, manually setting it would be a good idea.

The lack of DHCP response could be attributed to an old/simple router (Residential gateway might be a better definition). I’ve read that some (old) routers can’t assign more then one DHCP-lease per port. So if two computers are connected switch->router, I guess the first booted gets the lease.

Using one default gw, one subnet and no VLAN (unless you really know what you’re doing), I can’t see why the W5100 shouldn’t work connected thru a switch. Doing it myself ATM just to be sure! :slight_smile:

Good explanation, would have been better in a current FAQ topic, but leaving it here for now.

But I am still closing this drawn out multi-participant topic. If anyone reading this still has relevant issues, please create a new topic with explicit details about your issue… not just a “Me Too” :wink: Thank you.