Unique IP/MAC to w5100?

Hello, I'm a beginner, I have 5 w5100 on my network, to use them the most correct is to use a single MAC and IP for each one? If yes, how can I do this? What would you recommend me? (I have 3 working with the same MAC and IP)

the Ethernet library has relevant methods to set things up

Ethernet.setMACAddress()
Ethernet.setLocalIP()
Ethernet.setSubnetMask()
Ethernet.setGatewayIP()
Ethernet.setDnsServerIP()

or read them out

Ethernet.MACAddress()
Ethernet.localIP()
Ethernet.subnetMask()
Ethernet.gatewayIP()
Ethernet.dnsServerIP()

you can also call Ethernet.begin(mac) if you want to start with a specific Mac address and other versions exist too

	// Manual configuration
	static void begin(uint8_t *mac, IPAddress ip);
	static void begin(uint8_t *mac, IPAddress ip, IPAddress dns);
	static void begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway);
	static void begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet);

Thank you for the tip, this is my code.

Ethernet.begin(mac, ip);
  if (Ethernet.begin(mac) == 0) {
   Serial.println("Failed to configure Ethernet using DHCP");
   if (Ethernet.hardwareStatus() == EthernetNoHardware) {
    Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
   }
  }

would you let him get the IP and/or MAC automatically?

you don't get a MAC address automatically, DHCP will give you an IP.

best indeed is to provide different Mac addresses for your different devices

1 Like

Okay, thanks a lot, I'll try to fix them all.

Last question, is there a way to restart the W5100? as I do begin, there would be a way to restart it (without having to turn off the power)

you mean like a soft reset ?

if you look in the datasheet http://www.wiznet.io/wp-content/uploads/wiznethome/Chip/W5100/Document/W5100_Datasheet_v1.2.6.pdf

there is a reset pin

or you can use bit 7 or the MR register

the question is more why would you want to do this though?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.