2-tall
1
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. 
Welcome! Sorry to day you are intermingling the two, they are not the same. I have my router running as a DHCP server which gives my Arduinos there local IP address. The IP addresses you are listing are in: New York City, California, and Rheinland-Pfalz so I do not have a clue how you are getting them unless your router is passing them on to your project. You need your DHCP to give you an IP for your local network. It will probably be 192,168.?.?, the DNS addresses are not accessible without an internet connection.
Juraj
3
if you use begin
with static IP setting, DHCP will be off.
are you on Mbed Core 4.1.1?
2-tall
4
Hi. Sorry, but I'm not mixing the two. The DHCP server on my local router assigns the IP address, gateway & DNS address as you would expect. Calling Ethernet.dnsServerIP() returns the DNS server IP address as set by the DHCP server (192.168.1.2 in my case).
If the device has Internet connectivity and only needs to resolve names on public DNS (e.g., google.com), then you will not see any issues. However, internal names won't resolve even if they are configured on the DNS server configured in DHCP.
When I sniff the traffic using Wireshark I can see that DNS requests go to those 3 IP addresses, not the DNS server configured on my DHCP server and reported by Ethernet.dnsServerIP().
I have no idea where they are coming from as I haven't configured them either in my code or on any network devices. My assumption is that they are hardcoded somewhere either in the Ethernet library (I couldn't find them) or the mbed OS itself, but that is just a guess.
2-tall
5
Yes, Mbed core 4.1.1.
Agreed on the static IP, but it's the only way I could find to correctly set the DNS server. I tried using Ethernet.setDnsServerIP() to set the DNS server again after using DHCP, but this made no difference.