# ESP8266 AT commands to setup a server

I am trying to setup a simple server in the port :80 with a esp8266 module. I flashed it to the most recent version and it seems to work ... but it is like it doesn't respond to request when I access it through the explorer.

The most annoying part for me is about the +CIFS command It returns the following:

AT+CIFSR

+CIFSR:APIP,"86.186.85.186"
+CIFSR:APMAC,"1a:fe:34:9b:c3:83"
+CIFSR:STAIP,"102.106.51.178"
+CIFSR:STAMAC,"c0:ca:41:00:47:40"


My network is 192.168.1.X , 255.255.255.0, 192.168.1.1

According to this thread I found

Station (STA) is when your ESP is connecting to your home wifi.

Access Point (AP) is when your ESP is broadcasting wifi for you to connect to.

If I execute a ping on the 86.186.85.186 is ok.

Haciendo ping a 86.186.85.186 con 32 bytes de datos:
Respuesta desde 86.186.85.186: bytes=32 tiempo=67ms TTL=51
Respuesta desde 86.186.85.186: bytes=32 tiempo=67ms TTL=51
Respuesta desde 86.186.85.186: bytes=32 tiempo=67ms TTL=51
Respuesta desde 86.186.85.186: bytes=32 tiempo=67ms TTL=51

Paquetes: enviados = 4, recibidos = 4, perdidos = 0
(0% perdidos),
Tiempos aproximados de ida y vuelta en milisegundos:
Mínimo = 67ms, Máximo = 67ms, Media = 67ms


Command sequence:

AT
OK

AT+RST
OK
WIFI DISCONNECT
ets Jan  8 2013,rst cause:1, boot mode:(3,0)

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
SPI Speed      : 40MHz
SPI Mode       : QIO
SPI Flash Size & Map: 4Mbit(256KB+256KB)

rlŽ‚rlŒžâ

AT+GMR
AT version:0.60.0.0(Jan 29 2016 15:10:17)
SDK version:1.5.2(80914727)
compile time:Jan 29 2016 19:07:08
OK

AT+CWMODE?
+CWMODE:2
OK

AT+CWMODE_CUR=3
OK

AT+CWJAP_CUR="XXXX","XXXX"
WIFI CONNECTED
WIFI GOT IP
OK

AT+CIFSR
+CIFSR:APIP,"86.186.85.186"
+CIFSR:APMAC,"1a:fe:34:9b:c3:83"
+CIFSR:STAIP,"102.106.51.178"
+CIFSR:STAMAC,"c0:ca:41:00:47:40"
OK

AT+CIPMUX=1
OK

AT+CIPSERVER=1,80
OK


Am I missing something?

EDIT: Expected result, more or less like (To be clear, I do not use any arduino sketch or whatever. I just use the serial monitor. The behaviour is the same using putty.

I connect to the ESP8266 chip using a usb-to-serial cable.

• Could you explain a little bit more what you expect to happen/what isn't working? It's a little unclear. Also, why 86.186.85.186 and 102.106.51.178? Those should probably be LAN addresses (of the form 192.168.x.x for instance). – uint128_t Mar 5 '16 at 17:15
• @uint128_t I added a picture with an example from the tutorial I am adapting. About the IPs, is that what I don't understand... I thought they should be addresses from my LAN. – blfuentes Mar 5 '16 at 17:45
• Can you post a picture or the text of the exact error you are having. Regarding the IPs, your local network runs on 86.x.x.x and 102.x.x.x? That's very unusual, typically LANs are in 10.0.0./8, 172.16.0.0/12, and 192.168.0.0/16. – uint128_t Mar 5 '16 at 18:03
• There is no special error. Just the "site not found" in chrome/IE/...My local network runs in the 192.168.1.X – blfuentes Mar 5 '16 at 18:10
• Set the relevant IPs to whatever your router uses for LAN. Run those ESP commands. See if you can ping the ESP from your computer. Then direct your browser to the ESP, and see if you get a request in the serial monitor. Don't expect the browser to display a page, you aren't serving any content to the browser; inspecting the HTTP header in the serial monitor is enough to determine a successful connection. – uint128_t Mar 5 '16 at 18:29

You are using IP addresses that are (likely) not LAN addresses. It's very unusual for your local network to run on 86.x.x.x and 102.x.x.x. LAN addresses are typically in 10.0.0./8, 172.16.0.0/12, and 192.168.0.0/16.

Find out what your router is using (you can do this by checking your computer's IP address, on Windows use ipconfig, on Mac use ifconfig). Then pick an address in the same subnet e.g. if your computer is 192.168.1.32, try 192.168.1.200. Note that your choice may collide with another device, if so, change it. You can find all devices on your local network with nmap or similar.

Typically, something like AT+CIPSTA="192.168.1.200","192.168.1.1","255.255.255.0" is what you want.

Once the ESP is configured, see if you can ping the ESP from your computer. Then direct your browser to the ESP's IP address, and see if you get a request in the serial monitor. Don't expect the browser to display a page, you aren't serving any content to the browser; inspecting the HTTP header in the serial monitor is enough to determine a successful connection.

Try these in sequence:

AT+RST

AT+CWJAP="SSID","password"

AT+CIFSR

AT+CWMODE=1

AT+CIPMUX=1

AT+CIPSERVER=1,80

Wait for OK after every command.

Access the IP assigned to ESP8266 by command AT+CIFSR in chrome/IE, it should return the version of chrome and lot of information.

Then send: AT+CIPSEND=0,<string len> replace string len by the length of data you want to send.

For example <html><p>test</p></html> it should be AT+CIPSEND=0,24 then it should return with > in the monitor then send the data <html><p>test</p></html>.

All of these commands can be executed in Arduino Serial Monitor, I assume you are using Arduino as USB-to-TTL Converter.

• this sequence didn't work for me. I got stuck in the same problem. – blfuentes Mar 5 '16 at 20:18