Static IP Possibility

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
yeyeto2788
Posts: 28
Joined: Wed Mar 30, 2016 4:09 pm

Re: Static IP Possibility

Post by yeyeto2788 » Thu Sep 15, 2016 6:35 pm

pythoncoder wrote:

Code: Select all

a = (1,2,3)
creates a 3-tuple (a tuple with 3 elements). If we have a function which expects a 3-tuple as an argument we can call it with either of:

Code: Select all

func(a)
func((6,7,8))
Thanks for clarification. Now it makes sense for me ;) I'm not an expert on programming.

Thanks also everyonefor the help on this.

User avatar
timotet
Posts: 6
Joined: Sun Dec 14, 2014 12:01 am
Location: Bend, Or.
Contact:

Re: Static IP Possibility

Post by timotet » Mon Oct 10, 2016 5:07 pm

Hi Guys,
I am trying to write a tcp server and set it up with a static ip.
Ultimately I would like to have a couple of esp8266 modules as server and client trade info.
I configured it the same way the above post does, but cannot get the client to connect.
I am just using netcat or my phone to try and connect now.
I can get the client to connect every time if I use the router issued ip address.
I have a couple of questions and I'm sure the answers are simple.

1st question is for the ifconfig() tuple.
What is a valid static IP address? Could I use something like '217.0.0.1'?

What should the DNS address be? When I use the router issued ip and use ifconfig() to get info about it
the DNS address is always the same as my internal ip address. Does this matter for this application.
The example in the docs shows '8.8.8.8'.

If I understand correctly I should set it up like this example:

Code: Select all

n = network.WLAN(network.STA_IF)
    n.active(False)
    n.active(True)
    n.ifconfig(('217.0.0.1','255.255.255.0','INTERNAL_IP','DNS_ADDRESS'))
    n.connect('SSID', 'PASSWORD')
Which is what I've done to no avail.
Thanks any help is much appreciated.
Tim

yeyeto2788
Posts: 28
Joined: Wed Mar 30, 2016 4:09 pm

Re: Static IP Possibility

Post by yeyeto2788 » Mon Oct 10, 2016 6:08 pm

timotet wrote:Hi Guys,
I am trying to write a tcp server and set it up with a static ip.
Ultimately I would like to have a couple of esp8266 modules as server and client trade info.
I configured it the same way the above post does, but cannot get the client to connect.
I am just using netcat or my phone to try and connect now.
I can get the client to connect every time if I use the router issued ip address.
I have a couple of questions and I'm sure the answers are simple.

1st question is for the ifconfig() tuple.
What is a valid static IP address? Could I use something like '217.0.0.1'?

What should the DNS address be? When I use the router issued ip and use ifconfig() to get info about it
the DNS address is always the same as my internal ip address. Does this matter for this application.
The example in the docs shows '8.8.8.8'.

If I understand correctly I should set it up like this example:

Code: Select all

n = network.WLAN(network.STA_IF)
    n.active(False)
    n.active(True)
    n.ifconfig(('217.0.0.1','255.255.255.0','INTERNAL_IP','DNS_ADDRESS'))
    n.connect('SSID', 'PASSWORD')
Which is what I've done to no avail.
Thanks any help is much appreciated.
Tim

Hello Tim,

What I did was to look for the DNS Address directly on my router and I found two possible DNS. I tried with the first one and it didn't work, the second one was good enough to connect from my phone on Mobile Network (No WIFI).

You may use also something like this https://ipleak.net/ to detect you DNS, I didn't really test all available values for the IP Address but I think it should be OK as long as it matches the parameters

Code: Select all

(xxx.xxx.xxx.xxx)
.

Maybe someone on the MicroPython Community can clear this out for us (cuz now I'm more curious about it).

Take into account that I'm not an expert on Networking or Micropython.

Regards.

User avatar
deshipu
Posts: 1364
Joined: Thu May 28, 2015 5:54 pm

Re: Static IP Possibility

Post by deshipu » Mon Oct 10, 2016 7:42 pm

timotet wrote: 1st question is for the ifconfig() tuple.
What is a valid static IP address? Could I use something like '217.0.0.1'?
A valid static IP address is any address that your router is set up to route (they usually do 192.168.0.0/24 on the internal network, you can setup additional routes) and that will not be given by the router's DHCP server to any other device (so outside of the configured DHCP range).
timotet wrote: What should the DNS address be? When I use the router issued ip and use ifconfig() to get info about it
the DNS address is always the same as my internal ip address. Does this matter for this application.
The example in the docs shows '8.8.8.8'.
The DNS address should point to any server that has a running DNS service that you would like to use. Routers usually have their own DNS service running, that just forwards all requests to the DNS servers configured on the router, so you can probably use the same address as the gateway here. The 8.8.8.8 address is a DNS service run publicly by Google.

User avatar
timotet
Posts: 6
Joined: Sun Dec 14, 2014 12:01 am
Location: Bend, Or.
Contact:

Re: Static IP Possibility

Post by timotet » Mon Oct 10, 2016 8:46 pm

deshipu
Thanks for the concise answer!

I will try again when I am home.

Post Reply