I have an Opta Lite and have been having issues using Ethernet on a local LAN with no Internet connectivity. Using Wireshark I have identified what I believe is an issue with the Ethernet library for Opta when using DHCP because it does not use the DHCP supplied DNS server. As an example the code below will get an IP address, GW, DNS, etc. from DHCP and the Ethernet library functions will report everything as OK. However, it doesn't resolve DNS names. Wireshark shows that DNS requests are being sent to 209.244.0.3, 8.8.8.8 & 84.200.69.80, rather than the DHCP assigned DNS server, non of which are reachable.
#include <opta_info.h>
#include <SPI.h>
#include <PortentaEthernet.h>
#include <Ethernet.h>
OptaBoardInfo *info;
OptaBoardInfo *boardInfo();
EthernetClient client;
void setup() {
// get the Opta board info
info = boardInfo();
// start the Ethernet connection using DHCP & the MAC address from board
Ethernet.begin(info->mac_address)
}
I tried to figure out why it isn't working, but quickly ran out of talent. I have however found that the code below is an effective workaround. The caveat is that I've not yet tested what happens when the DHCP lease expires, so it's possible you may need to repeat the process on renewal.
#include <opta_info.h>
#include <SPI.h>
#include <PortentaEthernet.h>
#include <Ethernet.h>
OptaBoardInfo *info;
OptaBoardInfo *boardInfo();
EthernetClient client;
void setup() {
// get the Opta board info
info = boardInfo();
// start the Ethernet connection using DHCP & the MAC address from board
Ethernet.begin(info->mac_address)
// restart Ethernet connection with static IP using previous DHCP assigned values
Ethernet.begin(info->mac_address,Ethernet.localIP(),Ethernet.dnsServerIP(),Ethernet.gatewayIP());
}
Posted for info in case others have seen the same issue with local DNS, and hopefully someone with more talent than myself can find/fix the problem with the Ethernet library. ![]()