Esp32 cant connect to internet when set ip local

I have a question, while i set esp32 using static ip, its wont connect to internet. I set static ip for local communication between another esp32 using udp it works, but while i add a mqtt to publish, the udp communication still works, but the mqtt doesnt. I have set static local using the network address same as the network address router, also gateway router, and subnetmask, i set wifi mode on esp32 STA.

Check your router dhcp range and set the static one of Esp32 outside of that range.

Same address as the DHCP assigned one, or the same as the router?

If your ip-setup is like on this example and doesn't connect, try what I wrote on post#2

DNS ?

Aight, thankyou

I will try using dns. Thank you

I mean the ip address is different with router, but the network address is same, for example router ip is 192.168.0.1, my ip is 192.168.0.10

You can use most of the settings that's being assigned through DHCP, except the IP address. Well sometimes you can, but lets not get into exceptions. @ZX80 point is certainly valid and I wouldn't be surprised if that's the solution. DNS is normally provided by your router, so

Aight, thank you