Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 11 months ago.
EthernetInterface MBED-OS 5.3 static IP
It appears there is still no way to set a static IP in the Ethernet Interface. My application must be able to set a static IP, is there anyway to fix this? I just updated to the very latest MBED-OS 5.3 and would hate to go back to MBED 2 to regain this feature. I am using the FRDM-k64 board.
2 Answers
7 years, 10 months ago.
Static IP addresses were re-included around mbed-os-5.2 with the set_network function that Dan is correctly using.
Unfortunately, when IPv6 support was added to the EthernetInterface, a bug was introduced that prevented the network from working with static IPv4 addresses. This left the API in the worst state: disfunctional and misleading.
Sorry about the trouble this caused, the issue is being tracked with a fix up on the mbed-os repo:
https://github.com/ARMmbed/mbed-os/pull/3526
This static IPv4 addresses should be usable again soon.
Hello,
Is it usable again? I'm having problems using static IP. How can I check if I've the newest working version?
posted by 04 Apr 2017Hi,
Static IP or IP via DHCP are acting same for me, I get an error -3004 after one successful transmission (either using UDP or TCP socket - no errors from socket), Any ideas, updates?
posted by 06 Apr 20177 years, 11 months ago.
This has been an issue since 5.x was released. Not sure why it was not included. So far no announcements of static IP being re-included. Mbed? Anyone? Bueller?
After digging through the github repository I figured out how to set a static IP address. Unfortunately I can't seem to create a TCP Server now (This worked when using DHCP).
My Code:
This is what I get on the debug terminal:
Example network-socket TCP Server
set IP status: 0
connect status: 0
IP address is: 192.168.1.100
MAC address is: 8a:42:7d:87:0c:b7
open error: -3004
Error -3004 is "not connected to a network"
posted by Dan Sexton 31 Dec 2016However I can ping the module on it's assigned IP address and it responds to the ping so we know the network is indeed connected.