more G-Labs products

Author Topic: Android App: local/internet IP address  (Read 3665 times)

January 30, 2015, 05:41:28 PM
Read 3665 times

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I don't know how hard this would be, but it would be really nice if the Android app could store 2 IP addresses.  The first would be a internet based address and the second a local intranet IP address.  At that point, the Android device would check what it's IP address was.  If it had the same intranet IP (192.168.x.x or 10.0.x.x), it should try to connect to the HG server on the local intranet IP.  If outside of that domain (connected to either 3G/4G or some other WiFi) then it should use the internet IP.

The only snag I see (which could be overriden with either a check box or by turning off WiFi of the device) would be if you are at a different location (coffee shop, book store, etc) that uses the same local IP that you do for your HG network (e.g., 192.168.0.x).

I would think the local IP could be optional.

February 01, 2015, 07:04:44 AM
Reply #1

Eric_S

  • *
  • Information
  • Newbie
  • Posts: 22
It could also be dealt without a check box by falling back to WAN if LAN port is not found or login to LAN port is unsuccessful.

Not real sure why it would be needed though since if you were on LAN no packets would go out to the WAN anyway. Packets would only go to the gateway and turn around right back to the LAN.

February 01, 2015, 05:07:45 PM
Reply #2

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
It takes some time to fail a connection.  Maybe a dialog that said "connecting to LAN" and a button that said "skip" to just go to the WAN address.

I did a quick search and found that this can be accomplished locally if I can enable NAT loopback/reflection in my router.  Unfortunately, I'm currently unable to find any way with my DSL modem to enable loopback.  Lots of posts online and yet no solution yet.  It's a Westell brand which appears to be bad in this case.

February 02, 2015, 11:52:23 PM
Reply #3

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
I use this method to have the same configuration for local access and internet access :
http://www.homegenie.it/forum/index.php?topic=319.msg1819#msg1819

On a dd-wrt router, it can be configure in "Services" -> "DNSMasq" :
Code: [Select]
address=/<DNS Internet>/<local @IP>

February 03, 2015, 12:01:40 AM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I knew I submitted a feature request in the past, but I couldn't find it.  Yes, if you want to go the dynamic DNS path, this would work just fine.  I couldn't locate a service that was free last I looked.  I already have a code that emails me the new IP address if it changes, so I just need to copy that when I lose power (the only time it does change).

I could do something with my DD-WRT router, but the modem contains the external IP, so I would have to change the forward address each time the external IP changed.  Maybe there's a way, but since this is the only web server I run, it seemed like a lot of work for minimal benefit.  If others had a similar request, it might be bumped up Gene's priorities.  If I'm the only one, I'll figure it out one way or another.   ;D

February 03, 2015, 12:36:18 AM
Reply #5

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
my dd-wrt is too behind a modem but it can work easily.
no-ip.com offer free dns name on internet.

on dd-wrt : "setup" -> "DDNS" Then you can do "use external ip check".

February 03, 2015, 03:39:13 AM
Reply #6

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I looked at different DDNS options a while back and thought they all had drawbacks.  The noip page shows it requires reactivation every 30 days.  Unless there's a way to make the DDWRT do that for me, I don't want to forget and loose connectivity when I really need it.  Also, it says ads will be seen which sounds terrible.  But, I don't really know what that means since I'm only planning on using HG with this.

February 03, 2015, 06:12:10 AM
Reply #7

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
no-ip.com : Every month, I have to reactivated when I receive an email 7 days before the end. And I just have to click "I'm not a robot" or a captcha and click "do not remove". Do it take around 5 seconds. If you don't want to do that no-ip propose to pay 15$.
Moreover, I don't have any ads (They can't add ads if they only use dns resolution).

Another way, perhaps, is to use a
  • DNS provide and update by your ISP (but you have to change it if you change ISP).
  • if you have synology, syno provide DNS and update. But you can use it for every
If you find another DNS free provider without drawbacks, tell me please :).
« Last Edit: February 03, 2015, 06:14:06 AM by nolio »

February 03, 2015, 07:28:31 AM
Reply #8

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I solved the issue.  I found a guide to place the modem in bridge mode which allows my router (that supports loopback) to use the WAN IP.  I am now able to use the same external WAN IP either on the LAN or not.

February 17, 2016, 04:34:31 PM
Reply #9

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
My ISP has recently implemented new security "features" which requires my modem to be taken out of bridge mode (loopback).  They claim this is to make sure I am protected from the evil internets by giving them a back door into my modem to allow them to remotely change things.  I'm not sure of any other way to get my external IP address to redirect back to HG from inside the network other than a dynamic DNS service.  However, my office filters out all DNS providers I've looked at so far (probably for security reasons).

Does anyone have any other suggestions?

February 17, 2016, 06:44:34 PM
Reply #10

saue0

  • **
  • Information
  • Jr. Member
  • Posts: 40
I did it by adding a local DNS on my Raspberry. and havin a domain ".ca"
The only fallback is that GoDaddy do not support Dynamic IP, so wen my ISP change my IP , I have to go and change it manually.

My local dns use the same Domain name. so even my Mail Server ans HTTP server work fine from inside and outside whit the same host name.

February 17, 2016, 07:41:19 PM
Reply #11

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
So you map your external IP to a LAN IP?  Which DNS software are you using on the RPi?  I assume that you have to tell the router that it should check the RPi DNS as well, correct?

February 18, 2016, 03:09:21 AM
Reply #12

saue0

  • **
  • Information
  • Jr. Member
  • Posts: 40
From the externe, i simply do port forwarding, HG is only accessible from the port 443 by  my web server (apache) .I redirect it to the real port by proxy. For the moment, my rooter do not point to the dns on the raspberry, i force the dns on my devices.  Still experimenting with all this, The DNS software is BIND 9.9 , and i am using WEBMIN to configure all of this on my pi.

February 18, 2016, 05:11:00 AM
Reply #13

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I spent a bunch of time working on this and for some reason I was able to get bridge mode to work again.  It wouldn't surprise me if it stops again in 6 weeks...