Is there any way to connect to local devices using same IP address for Internet and locally?

I want to connect devices from the internet and locally using the same IP address. Because when I use the local IP then I can’t connect with devices from internet and When I using the Public IP then I can’t connect with devices locally when internet is not working. Is there’s any solution?

You’ll need to share more information about what you’ve done with DDNS (assuming you have a dynamic IP address) and port forwarding.

Pete.

I have just port forwarded my local IP address.

I don’t understand how that’s possible.

Pete.

I am using two ip address. one is local and one is public. public ip works when internet is woking and local works I am connected to local wifi/Internet. Is there any way we could use a single ip some how?

@tzaroon
Do you use your own Local server or Blynk cloud server

local server

I have used my Local Server, proper port forwarding in my router, and a free DNS service like noip.com, then set my App with the DNS redirection address (pointing to my WAN IP) and appropriate port.

Worked perfectly, regardless if my phone was connecting via LAN WiFi, Cellular or public WiFi hotspot (assuming the hotspot wasn’t blocking any ports).

1 Like

That’s the way it works, i use it all the time

But it won’t work when the internet is down, as the NoIP DDNS service won’t be reachable.

Pete.

Hi @tzaroon,

I do understand what are you trying to achieve, and this is of course doable. Only thing that depends is technical side. How do you do implement it. Although there are lots of possibilities, currently I have only three ideas:

  1. In the setup part of the sketch, check wether is blynk server available at local IP. If it is, connect via LAN - it’s faster, if the local IP is not available, connect using public IP.

OR

  1. Get some DNS name for your public IP from dyndns or no-ip for example. In sketches use only DNS name in blynk.connect/blynk.configure. BUT you will also need local DNS server running on some sort of computer, like raspberry pi for example.

OR, and this is very unlikely:

  1. You could add your own routing rules to your router, so that when external server IP is called from LAN, it would be redirected to local IP but, it is very unlikely that your router support this functionality although this seems like the best option.

Good luck, and happy blynking!

True… but a simple allowance in the App for dual WAN/LAN inputs would work wonders.

I had asked about this a long time ago, but it just got :cricket: :cricket: :cricket:

Perhaps Blynk 2.0 will add in this highly sophisticated method that I have enjoyed on other apps for years now :stuck_out_tongue_winking_eye:

Thanks sir giving me the idea … At least now I have something to try.

I didn’t get the no 3 option how could we use the rule like that… because as much I know we have to make the same class for the local ip like public.

The problem isn’t with the device (Arduino, NodeMCU etc) being able to connect to the local server, it’s the Blynk app that needs to be pointed towards the internal IP address (in which case it wont work outside of the network), or at a DDNS service (which wont work when the internet is down).

I think Blynk 2.0 will be 100% cloud based (at least to begin with), so the problem will be solved (sort of, because then nothing will work when the internet is down :grinning:).

Pete

Ah so, well that is doable by getting domain name, and setting up local DNS on LAN. However it is more-less complicated. But definitely possible!

Yes, if you want to set-up your own DNS server and WAN/LAN loopback, but it’s probably not worth the hassle for the few occasions when the internet is down. Probably much easier to log out of the Blynk app and set a new custom server setting when this happens.

Pete.

If you have your own router and can manage it so you can add custom DNS record that override public DNS. I have public domain that is pointed to my WAN IP and the same domain name is overrided in my router to internal IP

1 Like

Hello, can you give more details please? I’m trying and I don’t know how. Thanks

This is a more advanced routing setting, and may not be availible on some consumer cheap “WiFi Routers”.

Because this is very specific setting we do not know how to set it up on your particuliar router and such setting may even be unavailible.