DNS forwarding not working - Networking

I've rooted my first android device yesterday (Samsung J530f) for the purpose of system wide proxyfication through a local network socks proxy. In other words, I have a socks5 client running on my PC to which I connect from my android device using a local IP in Socksdroid. The traffic coming from the android device is then proxified through the socks set in the client on my PC.
I have however huge issues with android getting the DNS server remotely, based on the proxy IP. I've tried different DNS related apps including Override DNS and DNS forwarder, but I get some very strange results. In the same browser on different checkers I get DNS servers from different countries, yet none of them are the servers that I manually set in either Override DNS and DNS forwarder. I've tried 3-4 different apps and none of them seem to work in the way intended and give inconsistent and glitchy results, so I start to suspect that there's something that prevents these apps from functioning properly.
The only way that I managed to get DNS to function like intended is to set network.proxy.socks_remote_dns to true in firefox nightly, but then again, it only uses the right DNS in one browser, and not the entire system.
Does anyone have any suggestions on what I could do to get DNS working consistently and properly?
Thx.

Related

wifi network questions on HTC HD2

Hi,
Using a HTC HD2 I am trying to access my home network via WIFI (WPA2/PSK - AES). Some of it works, some of it doesn't and I was hoping some of you would be able to point me in the right direction:
I can connect to intranet pages (for instance utorrent web interface) via IP, but not via hostname.
I cannot connect to network (smb) shares at all, either via IP or hostname.
A program which requires the hostname to work (since I use it over Hamachi VPN as well as locally and don’t want to change the IP based on how I use it) does work over Hamachi and not over WIFI.
I'm quite confused
Any help would be greatly appreciated!
Cheers,
Elco
Sounds like your DNS isn't working. Do you have custom DNS servers configured in the "Name Servers" tab of network card config?
Yhanks for responding!
It should get it from DHCP (though I have tried assigning a static IP and dns, but this gave the same result)
Also, I have another older win mobile device, and with the same setttings it does allow me to access the network shares (by IP and hostname)
I've combed all settings regarding wifi and network, but since they are the same I am guessing it is probably a different at the registry level?
The HTC HD2 does have 2 broadcom wifi adapters mentioned though, a normal one and one with a DHD postfix.
Cheers,
Elco
@Talisman_: same problem here. have you solved it?
Exactly same problem on xperia x2. I just set on manual temporary.
Are you using Hamachi on your phone?
Did you have this problem prior to installing Hamachi?
The reason being is Hamachi installs a network interface which exists whether or not Hamachi is running
You may want to check your Data Connection settings and see if it has applied the "requires a proxy" setting
What are you using as your DNS server though, that is the question.
If it's your broadband router, then chances are it won't be able to serve DNS requests for internal devices (ie computers on your home network).
If that's the case, you'll need a proper DNS server (get an old PC and install Linux) and create a local domain such as home.local, or if you've got a registered domain, you can even set it up the same (domain.com for instance) just tell the DNS server it's the domain master.
It's been yonks since I played around with Linux so I can't tell you how, much easier with Windows Server
Some people advise against using the same public domain name as an internal domain name, but it just means you add A records for any public addressess such as WWW.domain.com or mail.domain.com if it's accessable outside your network as well as inside.
Alternatively, if you're only going to be accessing them via the home network then you could try adding a few hosts to your registry (use the windows calc or similar to convert each IP address number to Hex)
http://windowsmobilepro.blogspot.com/2006/04/etchosts-file-equivalent-in-windows.html
As always, you modify the registry at your own risk.

Setting up Global SSH Tunnel on Android

For anyone interested in data security the ability to encrypt network traffic is obviously important-- especially in light of the myriad of recent well publicized reports of private and government electronic snooping. It is also relevant to mention that to date no one has come close to cracking "TwoFish" encryption which can be used by SSH. With this in mind, consider the following tutorial which describes a method for encrypting all 3g, 4g, and Wi-Fi data, thus beefing up phone and personal data security.
Setting up a global SSH Tunnel on Android phones
This tutorial assumes the reader possesses a fully configured SSH server and rooted phone. In lieu of a server, (eg., the reader only has only a Windows-based operating system), research into CYGWIN is recommended. I use CYGWIN to run my SSH server and I have found that it is the most robust option for Windows users; however, setting this up on Windows can be a daunting task.
Setting up global SSH Tunnel on Android
1. Download 2 apps from the Google Playstore: ConnectBot and ProxyDroid
2. Install ConnectBot and ProxyDroid on your phone.
3. In ConnectBot set up Port forwards for your SSH connection. For "Type" field use "Dynamic (SOCKS)." For “Source Port” use 56001 or any local port not being used. The reasoning behind using port 56001 is this: System Ports (0-1023), User Ports (1024-49151), and the Dynamic and/or Private Ports (49152-65535)
4. Open ProxyDroid and configure as follows:
Host: 127.0.0.1
Port: 56001 (or the port you chose to use in step 3)
Proxy Type: SOCKS5
Global Proxy: Check the box
The above procedure accomplishes several things. First, ConnectBot remotely connects to your SSH server. Next, the ConnectBot connection forwards to the local port 56001. ProxyDroid then redirects all network traffic through the localhost on port 56001. Once you are connected through ConnectBot and ProxyDroid is activated all of your data will be tunneled through the encrypted ConnectBot session. This is an excellent way to set up a global proxy because it does not require manual configuration of any applications to connect through the proxy. You can test the functionality of the connection by opening up your phone browser and performing the Google search: What is my IP. If the proxy is functional you will see the WAN IP of the network of your SSH server. Additional and more thorough testing can be done with packet sniffers such as WireShark.
An application called "SSH Tunnel" is an alternative to accomplishing the above. However, I find ConnectBot and ProxyDroid is more elegant and gives better control-- not to mention being more sophisticated/chic. When correctly performed the ConnectBot and ProxyDroid method encrypts all 3g, 4g and Wi-Fi data on your phone. This is obviously useful for phone access of sensitive materials especially using unfamiliar or alien network connections. With the current proliferation of identity theft via electronic snooping on mobile devices I do not advocate using cellular phones for any banking or electronic transactions without setting up a robust and reliable encrypted connection.
I'm having trouble with this exact setup on Android 4.3 with DNS Proxy (proxydroid) enabled in China. When DNS Proxy is enabled, no traffic will come through at all. If I disable DNS Proxy, it works but without proxied DNS requests, I can't get to Youtube/twitter/FB.
Any ideas?
SSHTunnel for 4.2.2 is a much better alternative than running 2 separate apps and I still use it on my 4.2.2 tablet. But I don't want to downgrade my phone to 4.2.2 just for this
Android 4.3?
strifej said:
I'm having trouble with this exact setup on Android 4.3 with DNS Proxy (proxydroid) enabled in China. When DNS Proxy is enabled, no traffic will come through at all. If I disable DNS Proxy, it works but without proxied DNS requests, I can't get to Youtube/twitter/FB.
Any ideas?
SSHTunnel for 4.2.2 is a much better alternative than running 2 separate apps and I still use it on my 4.2.2 tablet. But I don't want to downgrade my phone to 4.2.2 just for this
Click to expand...
Click to collapse
Unfortunately, I have not done any testing with android 4.3 yet so I'm not sure why the dns request wouldn't be proxied. I'll look into it and get back to you.
DNS proxy on android 4.3
strifej said:
I'm having trouble with this exact setup on Android 4.3 with DNS Proxy (proxydroid) enabled in China. When DNS Proxy is enabled, no traffic will come through at all. If I disable DNS Proxy, it works but without proxied DNS requests, I can't get to Youtube/twitter/FB.
Any ideas?
SSHTunnel for 4.2.2 is a much better alternative than running 2 separate apps and I still use it on my 4.2.2 tablet. But I don't want to downgrade my phone to 4.2.2 just for this
Click to expand...
Click to collapse
So I finally had a chance to upgrade to 4.3 this week. I tested the dns proxy with proxydroid and it seems to be working fine. What rom are you using? I'm on Sacs rom and I would highly recommend it. Heres the link:
http://forum.xda-developers.com/showthread.php?t=2512983
4.4
Dr.Tautology said:
So I finally had a chance to upgrade to 4.3 this week. I tested the dns proxy with proxydroid and it seems to be working fine. What rom are you using? I'm on Sacs rom and I would highly recommend it. Heres the link:
http://forum.xda-developers.com/showthread.php?t=2512983
Click to expand...
Click to collapse
Tested on kitkat and is working fine. Ssh tunnel app not working however.
Dr.Tautology said:
So I finally had a chance to upgrade to 4.3 this week. I tested the dns proxy with proxydroid and it seems to be working fine. What rom are you using? I'm on Sacs rom and I would highly recommend it. Heres the link:
http://forum.xda-developers.com/showthread.php?t=2512983
Click to expand...
Click to collapse
I use pacman rom on nexus 4.
thank you for this tutorial!
I have been looking for a new way to setup SSH tunneling since the app "ssh tunnel" from the Google Play store stopped working with Android 4.2+
I can't wait to try this out..
I have two phones both SGS4's one running CM 10.2 and the other stock on 4.3 so i will try both of them out and report back here how it works out.
Thanks again for the tutorial!
-droidshadow
Thank you Dr.Tautology
Thank you Dr.Tautology
I was searching a big time for the solution you gave me.
First I was using SSHtunnel app from google play and it worked on my note 3 SM-N9005 (rooted) with jb 4.3. After upgrade to 4.4.2 kitkat (rooted) I could connect but there was no changing to my home ip in the browsers that I use with surfing by example to whatmyip . I also have a tablet "nexus 7" 2012 version upgraded also to 4.4.2 and on this device SSHTunnel is functional and the ip is changing??? I did not understand. Now I was searching for alternatives for my galaxy note 3 and I've found ssh connectbot and proxydroid. After I added the settings that I always used with dyn socks5 port 11723 on both programs.... -> connection to my DD-WRT router (with connectbot) was also possible. I also booted proxydroid and again after running chrome or firefox I still had the same ip so it didn't work.... Now I've found your post and read that the socks5 port must be above 49152. I changed the ports on both programs to 56001 in ('connectbot and proxydroid) and BAM! Connected with my home IP from outside my home :laugh:
The weird thing is that it worked on JB 4.3 with socks5 port 11723.
Now my woking SSH tunnel config -> Host = home-ip:7500 (default port = 22 in DDWRT)
user to connect to DD-WRT router = Root
password = Router password
dyn proxy socks5 port = 56001 as you suggest.
I have an app from my isp that I only can use with my home ip so I had to be home and connect by wifi. Now it's possible again with tunneling
Now the only thing that I have to do is thank you. :victory:
Never thought that the port number should be the problem.
Best regards DWroadrunner
I managed to set this up using SSH Tunnel for android. However I would like to use SSH Autotunnel as it's supposed to handle network changes better and is also more light weight. Does anybody know what type of private key this programm accepts? I have had no luck using putty keygen and the id_rsa I created in ubuntu does not seem to work either.
Glad to help!
DWroadrunner said:
Thank you Dr.Tautology
I was searching a big time for the solution you gave me.
First I was using SSHtunnel app from google play and it worked on my note 3 SM-N9005 (rooted) with jb 4.3. After upgrade to 4.4.2 kitkat (rooted) I could connect but there was no changing to my home ip in the browsers that I use with surfing by example to whatmyip . I also have a tablet "nexus 7" 2012 version upgraded also to 4.4.2 and on this device SSHTunnel is functional and the ip is changing??? I did not understand. Now I was searching for alternatives for my galaxy note 3 and I've found ssh connectbot and proxydroid. After I added the settings that I always used with dyn socks5 port 11723 on both programs.... -> connection to my DD-WRT router (with connectbot) was also possible. I also booted proxydroid and again after running chrome or firefox I still had the same ip so it didn't work.... Now I've found your post and read that the socks5 port must be above 49152. I changed the ports on both programs to 56001 in ('connectbot and proxydroid) and BAM! Connected with my home IP from outside my home :laugh:
The weird thing is that it worked on JB 4.3 with socks5 port 11723.
Now my woking SSH tunnel config -> Host = home-ip:7500 (default port = 22 in DDWRT)
user to connect to DD-WRT router = Root
password = Router password
dyn proxy socks5 port = 56001 as you suggest.
I have an app from my isp that I only can use with my home ip so I had to be home and connect by wifi. Now it's possible again with tunneling
Now the only thing that I have to do is thank you. :victory:
Never thought that the port number should be the problem.
Best regards DWroadrunner
Click to expand...
Click to collapse
Hey DWroadrunner,
That's great news! I'm very happy that my post helped you, as my intention was to provide all the necessary information to do this in one place. It's not always the case that a user port wont work, but unless you are big on port level security it's not easy to determine if/when the port is being used. This is probably why 11723 did work for you, however it's always better to go with a dynamic/private port range. Also, if you want a simple way to improve the security of your ssh server change the default port from 22 to something else. You'd be surprised how many attempts to connect will be made by attackers on a daily basis.
Regards,
DocTaut
droidshadow said:
I have been looking for a new way to setup SSH tunneling since the app "ssh tunnel" from the Google Play store stopped working with Android 4.2+
I can't wait to try this out..
I have two phones both SGS4's one running CM 10.2 and the other stock on 4.3 so i will try both of them out and report back here how it works out.
Thanks again for the tutorial!
-droidshadow
Click to expand...
Click to collapse
Let me know if this is working on CM. I have tested on stock 4.3 with no issues.
Any luck yet?
rintinfinn said:
I managed to set this up using SSH Tunnel for android. However I would like to use SSH Autotunnel as it's supposed to handle network changes better and is also more light weight. Does anybody know what type of private key this programm accepts? I have had no luck using putty keygen and the id_rsa I created in ubuntu does not seem to work either.
Click to expand...
Click to collapse
Hello,
I've used auto tunnel a handful of times. Just wanted to check to see if you figured out what key it accepts. I will test it out when I get a chance.
Dr.Tautology said:
Hello,
I've used auto tunnel a handful of times. Just wanted to check to see if you figured out what key it accepts. I will test it out when I get a chance.
Click to expand...
Click to collapse
Hi, the developer send me a mail saying that autotunnel should accept both private key types. None of them worked for me, though. He also suggested to try and paste the content of the private key into the bracket. I might give that a try. Edit: I can confirm copying and pasting the private key works. But it does not seem to transfer traffic via the the server, at least not the 3g traffic while using chrome. Edit 2: Turns out SSH Autotunnel does not use a socks proxy. Therefore secure browsing is not an option. The app is for secure pop3/ftp-server/smtp-server connections only. Thanks go to Matej for his kind support.
I've been using OpenVPN but I'd prefer to use ssh, as I have several ssh servers around the world, plus their pipes are bigger than my home line I have openvpn running on.
I have yet to get SSH Tunnel (apk) to work reliably; it randomly stops working and it's just a dead connection.
Using ProxyDroid unfortunately requires me to launch ConnectBot, connect ssh, then start the proxy. It'd be nice if ConnectBot could bring up the connection automatically, or ProxyDroid could do it. What I do right now is VPN unknown wifi connections and I can automate that with Tasker. I might look to see if I can automate connecting with ConnectBot then enable the ProxyDroid connection.
You can use ssh tunnels also with Drony if some proxy with authentication is involved. Works also on non rooted devices.
Automation
khaytsus said:
I've been using OpenVPN but I'd prefer to use ssh, as I have several ssh servers around the world, plus their pipes are bigger than my home line I have openvpn running on.
I have yet to get SSH Tunnel (apk) to work reliably; it randomly stops working and it's just a dead connection.
Using ProxyDroid unfortunately requires me to launch ConnectBot, connect ssh, then start the proxy. It'd be nice if ConnectBot could bring up the connection automatically, or ProxyDroid could do it. What I do right now is VPN unknown wifi connections and I can automate that with Tasker. I might look to see if I can automate connecting with ConnectBot then enable the ProxyDroid connection.
Click to expand...
Click to collapse
I think a simple bash script could be used to automate this task. I'm going to look into it; seems like an interesting/useful project.
Dr.Tautology said:
I think a simple bash script could be used to automate this task. I'm going to look into it; seems like an interesting/useful project.
Click to expand...
Click to collapse
I think so, it's just firewall settings etc.. Unfortunately for me, I need stuff that doesn't support SOCKS so I've gone back to looking into a faster OpenVPN service.
But this is good for browsing and things that use http etc.
Dr.Tautology said:
I think a simple bash script could be used to automate this task. I'm going to look into it; seems like an interesting/useful project.
Click to expand...
Click to collapse
hi have you figured out an automated script for this task via tasker, iv tried to create something but ended up no where lol.
Hi my collage wifi connection is proxy based
Whenever i surfed internet on that connection only some basic application are connected through that connection
But many 3rd party apps doses't connect by that connection like games
Any solution like connection tunnel apps or else
I don't want to root my device
Thanks
sam.jaat said:
Hi my collage wifi connection is proxy based
Whenever i surfed internet on that connection only some basic application are connected through that connection
But many 3rd party apps doses't connect by that connection like games
Any solution like connection tunnel apps or else
I don't want to root my device
Thanks
Click to expand...
Click to collapse
Do you have to login to the proxy or is it an open proxy? If it's open, you could see if you can find a OpenVPN server that listens on 80 or 443. Then use any OpenVPN client on Android and you can add/update config to match the directions here: https://openvpn.net/index.php/open-source/documentation/howto.html#http

No DNS Server / port forward to port 53 on Android 4.4.2 w/root & WiFi Tether Router

No DNS Server / port forward to port 53 on Android 4.4.2 w/root & WiFi Tether Router
I tried everything I could think of before posting this. If this is the wrong location for this kind of issue please let me know.
Anyway...
I have a rooted phone (Samsung Galaxy Avant) running the stock Android 4.4.2 that came with the phone and I use WiFi Tether Router to provide my other devices with an internet connection. Everything works perfectly and I get very fast LTE service both on my desktop and laptop (using a user agent switcher on my browser). However, I need to do some custom DNS routing and I am running into some issues.
What I want:
1.) When a browser on a device that is tethered to my phone through WiFi Tether Router requests a website then the DNS should run through the default DNS I specify (either Google's 8.8.8.8/8.8.4.4 or OpenDNS or my mobile provider's DNS servers) and load the website from the public internet.
2.) When a browser on a tethered device requests my-example-domain.com or my-other-domain.com I want the DNS to resolve to an IP of my choosing. In this case (for now, but I want to be able to change it), I want it to resolve to the IP address of my phone that is providing the tethering. The local IP address of the phone is is 192.168.11.254, which is the Default Gateway address when running Wifi Tether Router. I have a web server running on the phone on port 8080 and I want it to receive the requests for my two domain names
I want nearly all traffic from tethered devices to resolve through public DNS servers, but for those two specific domains I want the DNS to be handled by the DNS server running on the phone. I want those specific requests to resolve to the same phone that is providing the tethering and to have the web server running on the phone serve the files.
I have most of this working correctly except for one issue. Here are the details.
I am using three devices:
Galaxy Avant to provide tethering "phone"
Windows Laptop "laptop"
Windows Desktop "desktop"
Scenario 1 - Using Google DNS on phone:
In WiFi Tether Router under DHCP Settings I have:
HTML:
IP Address: 192.168.11.0 (0 is disabled and can't be changed)
DNS 1: 8.8.8.8 (google)
DNS 2: 8.8.4.4 (google)
When either of the Windows computers connects via wifi they receive the following:
HTML:
Default Gateway: 192.168.11.254
IP Address: 192.168.11.1XX
The laptop has a dynamic IP and DNS assigned by the DHCP in Wifi Tether Router on the phone.
The desktop has a static IP of 192.168.11.102 with its DNS pointing to the phone at 192.168.11.254 for DNS 1 and 192.168.11.0 for DNS 2 (I know the second one is invalid, but Windows requires two)
Under this scenario both the laptop and the desktop can access live websites through their browsers.
I'm assuming that the DNS is running through Google's 8.8.8.8 since that is the primary DNS for Wifi Tether Router and both computers are getting their DNS from the phone.
Scenario 2 - DNS running on Windows Desktop:
In WiFi Tether Router under DHCP Settings I have:
HTML:
IP Address: 192.168.11.0 (0 is disabled and can't be changed)
DNS 1: 192.168.11.102 (desktop)
DNS 2: 192.168.11.102 (desktop)
Both Windows computers still receive the following:
HTML:
Default Gateway: 192.168.11.254
IP Address: 192.168.11.1XX
Since the DNS 1 and DNS 2 settings for WiFi Tether Router now point to 192.168.11.102 (desktop) instead of 8.8.8.8/8.8.4.4 (Google) the DNS is now handled by the desktop.
The desktop is running Simple DNS Plus which is configured to point my-example-domain.com and my-other-domain.com to the IP address of the phone at 192.168.11.254.
There is a web server running on the phone.
Both computers can still access live websites through their browsers and both computers can access the web server running on the phone by visiting my-example-domain.com:8080 or my-other-domain.com:8080
The only records I have defined in Simple DNS Plus on the desktop are for my two domains, so I'm assuming that the rest of the DNS requests are getting passed back to the phone to be handled by the phone's default DNS servers since WiFi Tether Router no longer knows about Google's DNS (because it is now pointing at the desktop to resolve DNS instead). The DNS settings for the wifi network adapter on the desktop are pointing at the phone's 192.168.11.254 address still (which seems like it should create some sort of loop since the phone and desktop both point at each other, but it doesn't? Maybe someone can clear this part up for me), so even though my-example-domain.com and my-other-domain.com are being redirected by the DNS server on the desktop to the IP of the phone where the web server is listening, every other DNS request must be going back to the phone and resolving there since the phone is the desktop's only source of internet and the live websites actually resolve. The desktop must be either sending the request back to the phone to resolve or using the phone's data, but either way the desktop is forwarding the domains that it is supposed and leaving the rest up to the DNS on the phone somehow. I'd like to have a better idea of how this actually works.
In my head it's doing the following:
Request for my-example-domain.com or my-other-domain.com from laptop:
Checks DNS on WiFi Tether Router on phone > Forwards all DNS to Simple DNS Plus on Desktop > Points and resolves to web server on phone
Request for any other domains from laptop:
Checks DNS on WiFi Tether Router on phone > Forwards all DNS to Simple DNS Plus on Desktop > No record found for host > Returns DNS request to WiFi Tether Router on phone > Resolved by default DNS of phone
Scenario 3 - DNS running on Phone:
I installed the "DNS Server" app from Ice Cold Apps on the phone and created a DNS server instance, but I am not allowed to choose port 53 so I chose to have it assign random port (40747). If I try to set the port for the DNS Server to 53 I receive an error saying "The port you entered is not valid, try another one (this normally happens because Android doesn't allow a server on that port or another app is using the port)."
I created a rule that points my-example-domain.com and my-other-domain.com to the IP address of the phone at 192.168.11.254. The rules are very simple, you can only provide a domain name and an IP address for the DNS Server to route it to, nothing more.
In the DNS Server settings there is a checkbox for "Use a DNS server for requests" which is checked by default with a box attached to it for "DNS Server IP" which is set to 8.8.8.8:53 by default, which is Google's DNS on port 53.
There is another checkbox (that I unchecked) which says "Use a web DNS server for requests" with a box attached to it for "Web DNS server url" that is pre-populated with a PHP url from China
There isn't much documentation for these apps, so I assumed that it was ok just to use the Google servers from the first setting and skip the unfamiliar web DNS server stuff. I'm guessing those settings are supposed determine where the DNS Server app checks for hosts you didn't explicitly define with a rule. For example, if someone types one of my two domains name it should forward, but any other name should be checked with that provided DNS server. I could be totally wrong about this, so some clarification would be nice.
In WiFi Tether Router under DHCP Settings I have:
HTML:
IP Address: 192.168.11.0 (0 is disabled and can't be changed)
DNS 1: 192.168.11.254 (phone)
DNS 2: 127.0.0.1 (phone)
There is no option for port for the DNS so it's checking port 53 on my phone, but the DNS server wasn't allowed to start on 53 so it's listening on 40747 instead. This means I need to forward port 53 to port 40747 so that the DNS requests sent to DNS Server on port 53 by WiFi Tether Router will be answered.
I installed the "Port Forward Ultimate" app from Ice Cold Apps on the phone. There is only one setting, a checkbox which says "Force using internal iptables (advanced)". I left it unchecked initially, but found that the port forwarding server will not start unless that box is checked (and it doesn't matter what ports I'm trying to forward, without that box checked it simply will not start).
I created the following rule in the port forwarding app:
HTML:
Source port: 53
Destination port: 40747
I left the "Forward to external host" box unchecked and the accompanying "Forward to host/IP" box empty.
I started Port Forward Ultimate, DNS Server, and WiFi Tether Router.
Both the desktop and the laptop connect to WiFi Tether Router, but neither of them can access live websites and neither of them resolve my-example-domain.com or my-other-domain.com
I first thought that maybe the port forwarder couldn't bind to 53, so to test I changed my port forwarding settings to:
HTML:
Source port: 53
Destination port: 8080 (the port the web server is running on the phone)
When I visit 192.168.11.254:53 in Internet Explorer 9 from the desktop or laptop it works just fine (Chrome and Firefox won't let you browse websites on port 53, they show show a security error, but IE works). I see the website from the web server that is running on port 8080 on the phone, so port 53 is bound and forwarding to 8080, but when I try to forward 53 to 40747 (the port of the DNS server on the phone) it doesn't work. I've tried the DNS server on various ports (40747, 1029, etc). I made sure the port forwarder set to forward 53 to the port of the DNS server. I also made sure WiFi Tether Router set to use the phone (192.168.11.254) as the DNS, but live websites won't load and the the rules I have in the DNS server app on the phone do not cause my-example-domain.com or my-other-domain.com to resolve to either the phone itself on 192.168.11.254 or to the desktop web server running at 192.168.11.102 (I've tried setting it to forward to both).
I can forward port 53 directly to the web server on the phone or to the web server on the desktop (by checking "forward to external host" and providing the IP of the desktop), but when I set 53 to forward to the DNS server on the phone then the DNS server never does its job, as if it isn't even receiving requests.
When I run nmap on the phone at 192.168.11.254 with DNS and port forwarding enabled on the phone I get:
HTML:
PORT STATE SERVICE VERSION
53/tcp filtered domain
With port forwarding off I get:
HTML:
PORT STATE SERVICE VERSION
53/tcp open domain dnsmasq 2.62
When I run nmap on 40747 (or 1029 or any of the ports I've tried for the DNS server) with DNS running on the phone I get:
HTML:
PORT STATE SERVICE VERSION
1029/tcp filtered ms-lsa
WiFI Tether has no problem handing off the DNS to the Simple DNS Plus running on the desktop, but when it tries to hand the DNS off to DNS Server running on the phone it doesn't resolve.
Perhaps there is some kind of conflict I don't understand, like maybe when the DNS setting in WiFi Tether Router tries to connect to 192.168.11.254 on port 53 and is supposed to get forwarded. I do know that at all times I can access 192.168.11.254:8080 from the desktop as long as the web server is running and I am tethered to my phone.
Lastly, there is a checkbox in the DHCP settings for WiFi Tether Router which says "DNS Redirect" that when checked displays two IP address boxes for DNS 1 and DNS 2 under a header that says "Redirect DNS To". I'm not sure what this is, but it could be important. The only other two options under DHCP are "Use Internal DHCP" and "Use Alternative DHCP Config".
All I want is for most requests from tethered devices to go through standard DNS while the domain names I add host records for in the DNS Server on my phone will resolve to the IP addresses I specify, whether those IP addresses are external or the IP of the phone itself where the web server is running.
I have most of this working, including being able to hand off the DNS from WiFi Tether Router to one of my computers to do the routing, but I want to have it all self-contained on my phone as a standalone setup.
The web server is working, the tethering is working, the tethering handing off the DNS is working, the DNS on the desktop correctly routes the domains to the phone and the rest of the requests to live DNS, and the port forwarding appears to be working when forwarding 53 to my web server, so I'm just kind of stuck.
I've been working on this for 12 hours and I've hit a wall.
It could have something to do with needing to forward both UDP and TCP in the port forwarding, although there's no direct option for that except a box to create custom scripts that modify iptables, which I've tried but had no luck with. Or maybe Wifi Tether Router binds port 53 and is conflicting with the port forwarding / DNS server.
I'm open to any ideas as to why running WiFi Tether Router through the DNS on my phone with port forwarding doesn't work, but running WiFi Tether Router through DNS on my desktop does (especially since the DNS on the desktop correctly points my two domain names back to the phone for the web server to answer and also resolves live websites, both tasks that are receiving and sending requests through the phone); your input will be greatly valued.
The goal of this entire effort has been to create portable and private prototypes of browser-based applications that I've developed for still-to-go-live domain names and be able to run them entirely from my phone on any device that I tether (without modifying the hosts file on the tethered device) so that I can do on-the-fly demos even in areas with spotty data service. In addition, I can load up my SD card with media assets and personal content such as images, audio, and video and have everything available instantly in the web applications when I demo. I can also ensure that the only way to see particular applications I'm developing or access demo data is if you are directly tethered to my device. I can run full database software, application servers, and everything else directly from my phone and make changes to the apps instantly. All I need now is this one little DNS fix and I'm set.
Thanks!

Static DNS Entries are ignored and google DNS is forced

Hello everyone,
So I've been doing some work on my A1. Managed to root it via Magisk and something strange happened after that, though now i don't even know if it's related to root or the newest software update. But here is what I've found.
I have a home DNS server with some local network DNS entries.
I also have a DHCP which is providing home DNS server IP along together with 8.8.8.8 as secondary DNS to DHCP clients.
On my phone, i have set a static IP address but pointed DNS servers, as first server to be my home server and secondary to be 8.8.8.8 (as if i were to get these settings via DHCP).
All works well. I am able to get to my devices by looking them up like "pc.lan" or "printer.lan" ... In the first 5 minutes OR LESS!
After that SHORT period expires, my phone no longer queries my local DNS. I couldn't see which server is he trying to reach, i was afraid that i have rooted my phone badly and somehow installed malware onto it which is overwriting my DNS settings.
TBH i even checked /etc/resolv.conf and noticed that i do not have my entries there, but onle 8.8.8.8 and 8.8.4.4. Even after editing that file i still have no luck (maybe it's not reading that file).
So I've done little snooping and sniffing. Moved PCAP file to PC and looked it up in wireshark and there i saw something interesting!
Basically, he was querying google's 8.8.8.8 over port 853 (TLS) and completely ignoring my entry.
When i removed 8.8.8.8 as secondary DNS from my static entries, all worked fine, i was able to query my local DNS just fine!
So my question is. Is anyone aware of anything new regarding DNS queries? Maybe android is now forcing encrypted DNS traffic when available ?
EDIT:
Just for the record. I am using Android 9 with V10.0.5.0 build number (as earlier mentioned, Xiaomi Mi A1)

When VPN down, block app - When VPN up, allow app

Hello...
I have a Mi Box S device. It has the lastest updates.
Basically - what I am trying to do is when my VPN is up, an app is allowed to run (so do nothing). When the VPN is down, block the app.
I do not have ROOT.
I have tried various firewalls on the device that do not need ROOT and blocks apps - but they work by creating a separate VPN connection for the device. When I switch on my VPN, the firewall stops working. When I switch my VPN off, the firewall needs to be manually started.
If I had ROOT, I would edit IPTABLES to block everything except the IP \ PORTS needed for my VPN to work, and that would solve the issue. No apps would have Internet access until my VPN was active.
Ideas welcome. I am not against rooting the device - however - for the newest versions of the Android TV boxes, it seems to cause many more issues and does not seem to be worth the risk.
THANK YOU!
I do NOT know the answer to your question and I don't have Android TV, so ignore this if it doesn't help...
On the PC there are various VPN killswitch batch files that simply remove the LAN gateway, which works PERFECTLY to do what you ask on a PC:
Start VPN and then start the VPN killswitch
If the VPN is on, the LAN and WAN are accessed
The instant the VPN drops, the WAN is dropped
But the LAN remains intact
Maybe something like that is available for Android?
Googling, we get a lot of hits for Android VPN-specific killswitches.
Each Android public VPN server seems to have their own killswitch.
For example, here's one for private vpn on Android.
But there should be a killswitch for Android WITHOUT having to use any given VPN public server.
This hit implies it's a part of the Android settings.
But unfortunately my Android 12 doesn't have those VPN killswitch settings.
Does yours?
Solved. Admittedly - this solution works for me but might not work for others.
I host my own VPN server 'in the cloud' and, as part of that server, it's own DNS server.
Manually set the IP and DNS on the Mi Box S. Set the DNS to an INTERNAL DNS address that is only available when the VPN is running.
The app in question needs DNS to function. When the VPN is down, no functioning DNS, app does not function.
When the VPN is up, DNS functions, the app functions.
Good enough for me...

Categories

Resources