Chat freely about anything...

User avatar
By nlqt
#92090 Hello friends.
If this topic has been covered and resolved before, then I apologize.
Since I have read many threads and tried to find a solution but haven't found it yet, so I have to create this thread.
In Windows and iOS 14, WPA2 TKIP mode is warned of risks. So I want to install WPA2 AES or WPA3 mode ut i didn't find the solution.
And, I want to change Radio Type from 802.11g to 802.11n.
(I have used the code below but still not working. )

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>

#include <EEPROM.h>

const char* ssid = "HIEUVAITHANH";
const char* password = "123456789";

const char* host = "WifiReperater2";
const char* updatePath = "/update";
const char* updateUsername = "admin";
const char* updatePassword = "admin";

// Your ESP Wifi
const char* ssid_soft_ap = "SMARTSWITCH 2021 3CH";
const char* password_soft_ap = "switch2021"; // My preference is same as my home ssid password.
int Wifi_SoftAP_Channel = 11;
// ESP 8266 Local Network Configuration
IPAddress local_IP(192,168,4,1);
IPAddress gateway(192,168,4,1);
IPAddress subnet(255,255,255,0);

ESP8266WebServer webServer(80);
ESP8266HTTPUpdateServer httpUpdater;
//-----------------------------------------//
const char MainPage[] PROGMEM = R"=====(

<title>SMARTSWITCH</title> <style> body{ text-align: center; } </style>
<div>
<button onclick="window.location.href='/update'">UPLOAD FIRMWARE</button><br><br>

</div>
<script>
</script>
)=====";
void setup(void){
Serial.begin(115200);
Serial.println();
Serial.println("Booting programs...");
WiFi.setPhyMode(WIFI_PHY_MODE_11N);
WiFi.printDiag(Serial);

EEPROM.begin(512);
// write a 0 to all 512 bytes of the EEPROM
for (int i = 0; i < 512; i++) {
EEPROM.write(i, 0);
}

// turn the LED on when we're done
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
EEPROM.end();

WiFi.mode(WIFI_AP_STA);
WiFi.begin(ssid, password);

while(WiFi.waitForConnectResult() != WL_CONNECTED){
WiFi.begin(ssid, password);
Serial.println("WiFi failed, retrying.");
}
Serial.println(" kết nối internet voi");
Serial.println(ssid);
Serial.print("PASS ");
Serial.println(password);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

WiFi.softAPConfig(local_IP, gateway, subnet);
WiFi.softAP(ssid_soft_ap, password_soft_ap, Wifi_SoftAP_Channel);

MDNS.begin(host);
MDNS.addService("http", "tcp", 80);
httpUpdater.setup(&webServer, updatePath, updateUsername, updatePassword);
webServer.on("/",[]{
String s = MainPage;
webServer.send(200,"text/html",s);
});
webServer.begin();
Serial.println("Web Server is started!");

//=========Chương trình Chính=====//
pinMode(D4,OUTPUT);
//============End=================//
}

void loop(void){
MDNS.update();
webServer.handleClient();
//====Chương trình Chính==========//
digitalWrite(D4,!digitalRead(D4));
delay(500);

//=========End====================//
}

Therefore, I hope you can help me fix the above 2 problems.
I sincerely thank you.
Last edited by nlqt on Mon Aug 30, 2021 2:06 am, edited 1 time in total.
User avatar
By Duppie07
#92123 Hi, this is my code for WPA2 AES connection, and it work on my ESP2866.
---
#include <ESP8266WiFi.h>
#include <WiFiClient.h>

char ssid[] = "name"; // Network Name
char pass[] = "password"; // Network Password
byte mac[6];

WiFiServer server(80);
IPAddress ip(192, 168, 8, 110);
IPAddress gateway(192, 168, 8, 1);
IPAddress subnet(255, 255, 255, 0);

void setup() {

Serial.begin(115200);

Serial.println("Initialising connection");
Serial.print(F("Setting static ip to : "));
Serial.println(ip);

Serial.println("");
Serial.println("");
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.config(ip, gateway, subnet);
WiFi.begin(ssid, pass);

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

Serial.println("");
Serial.println("WiFi Connected");

WiFi.macAddress(mac);
Serial.print("MAC: ");
Serial.print(mac[5],HEX);
Serial.print(":");
Serial.print(mac[4],HEX);
Serial.print(":");
Serial.print(mac[3],HEX);
Serial.print(":");
Serial.print(mac[2],HEX);
Serial.print(":");
Serial.print(mac[1],HEX);
Serial.print(":");
Serial.println(mac[0],HEX);
Serial.println("");
Serial.print("Assigned IP: ");
Serial.print(WiFi.localIP());
Serial.println("");

}

void loop() {


}
User avatar
By nlqt
#92130 thank you. so please guide me how to do it.
I don't know the code that can solve this problem.

schufti wrote:AFAIK there is no WPA3 support on esp8266
for TKIP/AES: it uses the first common mode that is offered. If TKIP is offered it will be used, so disable TKIP on your AP. If you consider it unsafe this should be the first thing to do.