I have an Arduino Ethernet PoE. It took me a few days to get the USB2SERIAL adaptor to start playing with it...
I have no problems in connecting it using DHCP.
Ethernet.begin(mac);I can then read the received IP address.
Ethernet.localIP();I can then ping the card from elsewhere on the network using that IP address.
I can renew the DHCP lease with
maintain() and everything continues to work as expected and I can ping it again.
When I try to do the same with a fixed IP address I can't see the card on the network. It doesn't show up in the list of connected devices on the switch / router and I can't ping it.
#include <SPI.h>
#include <Ethernet.h>
void setup() {
// Ethernet's MAC
byte byMAC[] = { 0x90, 0xA2, 0xDA, 0x00, 0xEC, 0x8D };
// Fixed IP address config
byte byDNS[] = { 8, 8, 8, 8 };
byte byGateway[] = { 192, 168, 0, 1 };
byte bySubnet[] = { 255, 255, 255, 0 };
IPAddress ip(196,168,0,50);
// Open serial communications
Serial.begin(9600);
// Wait 3 seconds
delay(3000);
// Some declaring text
Serial.println("\nArduino Ethernet - Ethernet Fixed IP Connection");
Ethernet.begin(byMAC, ip);
// Ethernet.begin(byMAC, ip, byDNS);
// Ethernet.begin(byMAC, ip, byDNS, byGateway);
// Ethernet.begin(byMAC, ip, byDNS, byGateway, bySubnet);
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("Connecting...\n");
// Local IP address
Serial.println("Local IP info : ");
Serial.print("IP address : ");
Serial.print(Ethernet.localIP());
Serial.print("\nSubnet : ");
PrintIP(bySubnet);
Serial.print("\nGateway : ");
PrintIP(byGateway);
Serial.print("\nDNS : ");
PrintIP(byDNS);
}
void loop() {
}
void PrintIP(byte byArr[]) {
Serial.print(byArr[0]);
Serial.print(".");
Serial.print(byArr[1]);
Serial.print(".");
Serial.print(byArr[2]);
Serial.print(".");
Serial.print(byArr[3]);
}
As you can see I've tried just passing it the MAC and the local IP address, then added the DNS, then added the Gateway, then added the Subnet. None of these combinations makes the card show up on my network.