# ESP8266 WIFI\_AP\_STA with internet

**URL:** <https://forum.arduino.cc/t/esp8266-wifi_ap_sta-with-internet/673601>\
**Category:** General Guidance\
**Created:** [September 7, 2020, 3:14pm UTC](https://forum.arduino.cc/t/esp8266-wifi_ap_sta-with-internet/673601 "2020-09-07T15:14:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![matrixall](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@matrixall](https://forum.arduino.cc/u/matrixall)\
**Post date:** [September 7, 2020, 3:14pm UTC](https://forum.arduino.cc/t/esp8266-wifi_ap_sta-with-internet/673601/1 "2020-09-07T15:14:37Z")

</div>

I'm trying to setup an access point with my ESP8266 to broadcast internet with the following code:

```cpp
#include <ESP8266WiFi.h>

WiFiServer server(80);

const char *ap_ssid = "SAP";
const char *ap_password = "11112222";
const char *sta_ssid = "SSIDwithinternet"; 
const char *sta_password = "SSIDwithinternetPASS";

void setup() {
  Serial.begin(115200);
  Serial.println();
  WiFi.mode(WIFI_AP_STA);
  
  Serial.println(" ******************************");
  Serial.print("Connecting to ");
  Serial.println(sta_ssid);
  WiFi.begin(sta_ssid, sta_password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  Serial.println("Configuring access point...");
  WiFi.softAP(ap_ssid, ap_password);
  
  
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);

}

void loop() {
}

```

However, when I connect to the access point with my phone or laptop, there is no internet. Am I missing something here?

The monitor shows the following:

```cpp
Configuring access point...
AP IP address: 192.168.4.1
******************************
Connecting to Connect4G
....
WiFi connected
IP address: 
192.168.100.104

```

---

<div class="post-metadata">

**Author:** ![brcisna](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@brcisna](https://forum.arduino.cc/u/brcisna)\
**Post date:** [September 7, 2020, 3:29pm UTC](https://forum.arduino.cc/t/esp8266-wifi_ap_sta-with-internet/673601/2 "2020-09-07T15:29:53Z")

</div>

hi matrixall,

very new to this stuff,,,Arduino,,,but am guessing you need to setup your esp8266 as a repeater ,,,rather than AP mode, to your exisitng wifi router. If this is your setup,,,you are using? There is a simple sketch for setup repeater mode, FYI.

---

<div class="post-metadata">

**Author:** ![matrixall](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@matrixall](https://forum.arduino.cc/u/matrixall)\
**Post date:** [September 7, 2020, 4:04pm UTC](https://forum.arduino.cc/t/esp8266-wifi_ap_sta-with-internet/673601/3 "2020-09-07T16:04:26Z")

</div>

Thanks for the replay, I'm new indeed. I'm planning to run WIFI\_AP\_STA to be a central AP that fetch data from my website to feed other ESP's (Clients) which control relays and sensors. I'm not sure if the repeater would be able to communicate with clients the same way or maybe even better. Appreciate your help.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 5, 2021, 7:19pm UTC](https://forum.arduino.cc/t/esp8266-wifi_ap_sta-with-internet/673601/4 "2021-05-05T19:19:23Z")

</div>

Closed on May 5, 2021, 7:19pm UTC


