arduino-libraries / Ethernet

Ethernet Library for Arduino
http://arduino.cc/
252 stars 253 forks source link

Subnet Configuration Problème #269

Closed superkakaboum closed 2 days ago

superkakaboum commented 3 days ago

I'm trying to configure a subnet for my Ethernet shield, but it doesn't work if I wanted it to be in /28.

I don't know why we need to change the W5100.cpp file, but also to change the subnet we had to change line 77 in Ethernet.cpp:

https://github.com/arduino-libraries/Ethernet/blob/63eec8690b38639642b8adcabf9e356b3f97621b/src/Ethernet.cpp#L75-L77

To:

IPAddress subnet(255, 255, 255, 240);

I'm not very good at programming and maybe I don't know how to use the arduino board but I'd like it to work in my arduino code when I set the subnet and whatever I want it to work so I don't have to go into the configuration files.

For the record, I had to carry out a project to retrieve data from an angular sensor via a more or less complex network on gns3, a storage server which would then display the statistics on a web page.

JAndrassy commented 3 days ago

there is void begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet); too

per1234 commented 2 days ago

Closing as invalid since, as @<!---->JAndrassy pointed out, it seems the library already provides the capability you require and the problem is simply that you aren't using the EthernetClass::begin overload that provides that capability.

@superkakaboum if you would like assistance with adjusting your sketch to use the correct EthernetClass::begin overload, or would like any other project discussion or assistance, you are welcome to post over on Arduino Forum:

https://forum.arduino.cc/c/using-arduino/networking-protocols-and-devices/27

I'm sure we'll be able to help you over there.