Android, local server, WiFi and hosts - Android Q&A, Help & Troubleshooting

Hi!
I have just built a local server with Pydio (like Dropbox) on NGINX.
I want to access that website and its application when I am connected to my LAN and when I am outside (in the street by example).
The problem is that, if I am outside it is OK, because when I enter the URL it works but when I am on my LAN, url does not work but without including the nameserver and private IP to /etc/hosts.
Does anyone know a global solution to fix it?
Maybe using iptables in the router?
Thanks in advance

Up

Solved. I added this domains to the /etc/hosts of the router OPenWRT

Related

[Q] Wireless tether for root users - DNS redirect

I'm running a Piratebox web server on my phone - Does anyone know if there's a way to adjust DNS and re-direct everyone to my phones web server when they are tethering from my phone?
+1 to this question.
I am currently trying to find a way to get some android devices, which are working as AdHoc clients), and I want an app running on them to connect to a "server" address instead of using a specific, fixed IP address. I meant to do this programatically, by creating a socket to an InetAddress resolution of the "server" address. I assume InetAddress will use the DNS defined on the wireless interface to make this translation, but its Java, and that assumption really depends on the low level impl. of InetAddress.
So yeah, DNS redirect from the DNS server running on the AdHoc host, which by association also runs Wireless Tether for root users. How can we do it?
I have tried some redirections from the hosts file (zone file), location in "system/etc/hosts". My device, like many others, comes preloaded with a bunch of IP-hostname redirections, but these only seem to work locally, e.g.:
gugle.com redirects to 127.0.0.1 (in the hosts: "gugle.com 127.0.0.1")
If I input this address on the AdHoc host, gugle.com will redirect to my http port 80 landing (I have a web server running on the device to test this).
If I input this address on an AdHoc client, it doesnt return anything. I'm guessing the DNS server running on the host does not use the zone file from the OS.
So the question remains - where can we define a redirection from the DNS server that runs on the Wireless Tethering for root users device.

[Q] Samsung Galaxy S2 not resolving particular host names to IP

Hi, guys, here's my problem.
My Galaxy S2 using my own WiFi is unable to retrieve some content from web. This content is:
apps icons in Android Market,
Picasa images,
Accuweather forecasts
and some others.
Other devices using the same WiFi has no problems with it. S2 switched to other ISP than my WiFI also has no problems with it.
While trying to narrow possible causes I've picked an example image, which is problematic to my S2+WiFI combination:
https://lh3.ggpht.com/NpoJbnyQbI1kEIlrWhP_t7lj9lN519RkPB3mxQS2z6pTFjh01R3ISeyYnj4AccBSsQ=w788 (an icon of an app from Adroid Maret, remove space from url).
It won't open on my phone using WiFi, so I checked host availability. I've run on my phone following command:
Code:
[email protected]:/ $ ping lh3.ggpht.com
ping: unknown host lh3.ggpht.com
But on my PC using the very same WiFi:
Code:
C:\Users\Grzegorz>ping lh3.ggpht.com
Badanie photos-ugc.l.google.com [173.194.70.132] z 32 bajtami danych:
Odpowiedź z 173.194.70.132: bajtów=32 czas=27ms TTL=47
Odpowiedź z 173.194.70.132: bajtów=32 czas=25ms TTL=47
I'm stuck, what should I do now?
Have you any ad blockers or DNS stuff running ???
jje
Nope, it's clean Android 4.0.3.
Echo request for lh3.ggpht.com on your phone does not work. On your PC you get a response from 173.194.70.132. Just to make sure your problem is related to DNS (and not to some lower service): did you try to ping the IP address 173.194.70.132 from your phone? Do you get a response?
Yes, the host is reachable from phone using IP dot address, only name resolving does not work.
Ok, looks definitely like some DNS problem. As you already confirmed that your hosts file is fine the only thing I can imagine is your phone using some 'wrong' DNS server for address lookup.
To make (almost) sure you use a set of different DNS servers you could disconnect your phone from the wifi and enable a 3G data connection. Make absolutely sure you are not connected to your wifi. Now again run 'ping lh3.ggpht.com'; do you get a response?
Yes, that is the case.
Another weird thing is that phone on 3G resolves lh3.ggpht.com as 173.194.35.139, while PC on WiFi as 209.85.148.132. My 'hosts' file contains only localhost reference.
When I switch to WiFi while pinging that host, pings keep successful, unless I restart terminal session — after that I get 'unknown host' message.
Is there DNS configuration in Android somewhere?
OK, it seems I fixed it.
My WiFi works in a bigger subnet and hides all connected WiFi devices as as single computer.
I've installed on my Phone app called Set DNS from former Android Market, which allowed me to change both primary and secondary DNS. Initally both addresses were pointing to WiFi router itself which seems to work fine for my PC. I've changed it to DNSes of that bigger subnet I'm connected to. And it did the trick. Hopefully it won't mess settings for other WiFis I use to connect.
Thanks for showing me right direction!

Android OS + BIND9 dns on local server

Hi All,
I don't know if it is the proper thread for this, but I've installed a local webserver (CentOS) with BIND9 dns (named) and what is annoying me that my android devices don't resolve the server address. They can only connect through the IP of the server.
Windows pc and iOS devices do resolve the server name.
Devices connect to the server through a wireless AP that is also a DHCP. DNS address is distributed through the AP's DHCP.
Any ideas? Or any workaround for this? The main goal is to reach the local server by its name, so if you guys know an app other than a DNS server I would be grateful for some help.
Thanks a lot
Greg
did you use static ip address and custom dns in advance settings on your android handset? if yes your android should lookup for dns server. anyway maybe, i could be wrong, port 53 is being used for other apps or closed in iptables on your android hanset.
cheers hope it could help
vertrag said:
did you use static ip address and custom dns in advance settings on your android handset? if yes your android should lookup for dns server. anyway maybe, i could be wrong, port 53 is being used for other apps or closed in iptables on your android hanset.
cheers hope it could help
Click to expand...
Click to collapse
Thanks for the quick reply.
The ROM I use is one of Ficeto's base ROM. I9100XXLPQ with supercore kernel. The thing is, in advanced wifi configurations I don't have the possibility to set DNS. DNS information is not even displayed. I only see the IP and I don't have the possiblity to edit it neither. It is something that should be available in all roms or is it just my current rom?
I have no idea if there is something that uses the port 53, but when I connect to my DSL router I can browse the internet. So I assume the DNS in this case should work correctly.
Thanks a lot
Greg
Someone, move this question to Q&A thread..
yes if ur able to browse di internet normally then the dns query look up is fine.. what i nean by port 53 is the port that dns server and client use to communicate each other. take a look of my screenshot im able to change the dns..
Sorry for having posted in the wrong thread.
Well I don't have the same settings available in my current ROM. But I installed a third party app from Play to set the DNS and even if it is displayed correctly in the 3rd party app settings, it doesn't resolve the server's address.
I guess there is nothing else left but to use a packet sniffer (wireshark) to see whats going on between the android's browser and the server.
Will get back with the results.
Thanks
Greg
Greg767 said:
Sorry for having posted in the wrong thread.
Well I don't have the same settings available in my current ROM. But I installed a third party app from Play to set the DNS and even if it is displayed correctly in the 3rd party app settings, it doesn't resolve the server's address.
I guess there is nothing else left but to use a packet sniffer (wireshark) to see whats going on between the android's browser and the server.
Will get back with the results.
Thanks
Greg
Click to expand...
Click to collapse
Did you check the value of property net.dns1? If not just enter
Code:
getprop | grep net.dns
in an ADB shell. The value of the property net.dns1 should be set to the IP address of your DNS server.
If this is not the case just enter
Code:
setprop net.dns1 <your DNS server IP address>
for testing and try to ping one of your internal servers by name. It should work now.
Hi all,
Problem is solved. On a local network you must define the gateway in the DHCP so that the android device sends both IPv6 and IPv4 queries to the DNS server. If it is not defined it sends only IPv6 queries and doesn't fall back to IPv4 when that fails.
Thanks for your help
Greg

[Q] Way to run VPN server and client on one host.

Hello guys,
I'm finding a way to run VPN server and client on one host. Is there any method ?
(sorry but I'm not goot at English......)
I want to control packets on android, for streaming data caching. So I need to block outgoing HTTP request(case of cache hit).
In case of using two hosts, I works perfectly. And in one host, I have thought it will work like following method:
Mark per username who run processes using iptables, and make routing tables which can work through VPN or default gateway.
But I cannot connect to internet. So I checked 'ip route ls table cache' and found that cannot reach default gateway.
(screenshot link: docs.google.com/presentation/d/1Uu7Xm4iKOmE4s9zLUu7TBf_pMd85Gou-rIW_GRONqBQ/pub)
Is there an any way to solve this problem? or some books or docs...
Have a nice day!
Do you use pc?

Always-ON VPN limits all access to gateway services

Hi!
I've got Nokia 7.2 with android 10 and I have interesting issue with android's VPN functionality.
My VPN is l2tp/ipsec PSK. It is working well, but with one interesting aspect.
My VPN server has another services on it's ip (http and etc).
If VPN is used on-demand (manual activating) - all is ok, I can use server's other services.
But if I switch VPN to "always-on" state - server's other services become unavailable.
Browser showing Error "ERR_NETWORK_ACCESS_DENIED"
What is interesting also - i can't ping vpn server's ip from phone. Ping command brings error message "do you want to ping broadcast". It seems like an error in netmask, but ifconfigs between 'on-demand' and 'always-on' are similar.
Phone is not rooted, so I can't check routes (or i don't know how to do it w\o root)
What can advice more experienced users? Where should i look into.
Thanks for any response in advance.

Categories

Resources