Can't get Photon to connect to cloud using static ip

I am trying to use a static IP address on a Photon but I keep getting dns errors when it tries to connect to the cloud. Without static it works fine although I have had to go through setup to get it to connect to the cloud again.

Below is the output of photon.bin with and the without static IP. I reserved the static address for the photon with the Midco app. I have the internal and external port assignments set to 5683. Not sure if they should be set in this manner. I believe my credentials are set correctly. As you can see in the logs below I can't even ping the dns server or the google dns server when using static. Does anyone have any suggestions?
Thank you,
Bob
***** When running Photon.bin without Static IP *******
Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
configured credentials:
ssid=Brz73FfZ security=wpa2 cipher=1
available access points:
SSID=Brz73FfZ security=wpa2 channel=6 rssi=-33
SSID=Willie J security=wpa2 channel=6 rssi=-65
SSID= security=wpa2 channel=6 rssi=-66
SSID=CarlofNYC security=wpa2 channel=6 rssi=-58
SSID=G&G security=wpa2 channel=6 rssi=-61
SSID=Versteeg security=wpa2 channel=6 rssi=-73
connecting to WiFi
connected to WiFi!
localIP=192.168.0.119
subnetMask=255.255.255.0
gatewayIP=192.168.0.1
dnsServerIP=192.168.0.1 (often 0.0.0.0)
dhcpServerIP=192.168.0.1 (often 0.0.0.0)
ping gateway=1
ping dnsServerIP=1
ping addr 8.8.8.8=1
device.spark.io=34.199.82.114
0000012922 [wiring] TRACE: TCPClient socket=200076b8
connected to device server CoAP (testing connection only)
connecting to cloud
0000012974 [system] INFO: Cloud: connecting
0000013056 [system] INFO: Cloud socket connected
0000013057 [comm.protocol.handshake] INFO: Establish secure connection
0000013641 [comm.protocol.handshake] INFO: Sending HELLO message
0000013641 [comm.protocol.handshake] INFO: Receiving HELLO response
0000013642 [comm.protocol] INFO: waiting 4 seconds for message type=0
0000013688 [comm.protocol] TRACE: rcv'd message type=0
0000013688 [comm.protocol.handshake] INFO: Handshake completed
0000013710 [comm.protocol] INFO: Sending subscriptions
0000013713 [system] INFO: Cloud connected
connected to the cloud!

*** Running Photon.bin with Static IP ****
Serial monitor opened successfully:
configured credentials:
ssid=Brz73FfZ security=wpa2 cipher=1
available access points:
SSID=2wire 2020 security=wpa2 channel=1 rssi=-70
SSID=G&G security=wpa2 channel=6 rssi=-61
SSID=Brz73FfZ security=wpa2 channel=6 rssi=-30
SSID=Willie J security=wpa2 channel=6 rssi=-62
SSID=CarlofNYC security=wpa2 channel=6 rssi=-57
SSID=NETGEAR81 security=wpa2 channel=5 rssi=-72
SSID=Nila residence security=wpa2 channel=1 rssi=-73
connecting to WiFi
connected to WiFi!
localIP=192.168.1.119
subnetMask=255.255.255.0
gatewayIP=192.168.0.1
dnsServerIP=192.168.0.1 (often 0.0.0.0)
dhcpServerIP=0.0.0.0 (often 0.0.0.0)
ping gateway=0
ping dnsServerIP=0
ping addr 8.8.8.8=0
failed to get device.spark.io from DNS, try 1
failed to get device.spark.io from DNS, try 2
failed to get device.spark.io from DNS, try 3
device.spark.io=0.0.0.0
connecting to cloud
0000036743 [system] INFO: Cloud: connecting
0000051754 [system] WARN: Cloud socket connection failed: -230
0000056754 [system] WARN: Internet test failed: DNS
0000056754 [system] WARN: Handling cloud error: 2
0000056754 [system] INFO: Cloud: connecting
0000071765 [system] WARN: Cloud socket connection failed: -230
0000076765 [system] WARN: Internet test failed: DNS
0000076765 [system] WARN: Handling cloud error: 2

Your combination of static local IP, subnet mask, and gateway are not valid. The gateway must be within your subnet.

Typically with an address of 192.168.1.119 and a subnet mask of 255.255.255.0 your gateway would be 192.168.1.1, not 192.168.0.1.

Or you have a subnet mask of 255.255.127.0, with 9 bits of host which would have the localIP and gateway in the same subnet.

2 Likes

Hello Rick,
Thank you for reply. I somehow put 192.168.1.119 in my code instead of 192.168.0.119, the addy of the static ip I had reserved in the router. Major brain flatulence... After two days of banging my head you saved me from two more of the same.

Thank you, Bob

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.