[Q] net.dnsX not set on mobile data connection - Galaxy Ace S5830 Q&A, Help & Troubleshooting

Hi there,
I'm using the following rom: [ROM[DEV]]AOSP GingerBread 2.3.7 [COOPER][V3][02-08-13]
Despite being a fast and stable rom, it suffers a bug on mobile data connection, whereas wifi works fine. I'm currently trying to fix that bug. I would have posted that bug report/analysis in the corresponding rom's thread, but I'm not allowed to due to the 10-posts-limit in the developmental sections.
The following sections show how the dns properties differ when using wifi or mobile data:
If you think "tl;dr", scroll down for my questions
Connected to wifi:
Code:
# getprop | grep dns
[net.change]: [net.dnschange]
[net.dns1]: [192.168.1.25]
[net.dns2]: []
[net.dnschange]: [5]
[net.pdp0.dns1]: []
[net.pdp0.dns2]: []
[dhcp.wlan0.dns1]: [192.168.1.25]
[dhcp.wlan0.dns2]: []
[dhcp.wlan0.dns3]: []
[dhcp.wlan0.dns4]: []
As you can see:
wlan0 got its nameserver via dhcp
pdp0 (mobile data) has no nameserver set (because it's disconnected)
net1.dns got its value fr om dhcp.wlan0.dns1
-> internet access (name resolution) works
Now with wifi disconnected and mobile data connected:
Code:
# getprop | grep dns
[net.change]: [net.dnschange]
[net.dns1]: []
[net.dns2]: []
[net.dnschange]: [7]
[net.pdp0.dns1]: [139.7.30.126]
[net.pdp0.dns2]: [139.7.30.125]
[dhcp.wlan0.dns1]: []
[dhcp.wlan0.dns2]: []
[dhcp.wlan0.dns3]: []
[dhcp.wlan0.dns4]: []
wlan0 has no nameserver set (OK)
pdp0 (mobile data) has the right nameserver (Vodafone DE)
net1.dns has NOT copied its value from net.pdp0.dns1
-> internet access (name resolution) does NOT work
XDA member mahithm supplied a fix for that problem: http://forum.xda-developers.com/showpost.php?p=48640501&postcount=133
He simply put a script to /system/etc/init.d/555dns that does the following:
Code:
#!/system/bin/sh
#Written By mahithm
setprop net.dns1 8.8.8.8
setprop net.dns2 8.8.4.4
initscripts are run once at boot, so this makes mobile data work as long as you were not connected to a wifi since the last boot. Connecting to wifi sets the dns server of the wifi and overwrites net.dns1. Disconnecting clears net.dns1, thus not allowing name resolution as without mahithm's fix.
I tried to modify /system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf like this:
Code:
unset_dns_props()
{
for i in 1 2 3 4; do
setprop dhcp.${interface}.dns${i} ""
done
setprop net.dns1 8.8.8.8
setprop net.dns2 8.8.4.4
setprop net.dns3 $(getprop net.pdp0.dns1)
setprop net.dns4 $(getprop net.pdp0.dns2)
}
unset_dns_props() is calles when wifi is disconnected and dhcpcd (which is not needed for mobile data) quits. My modification should set the google dns to net.dns1/2 and try to extract the mobile data dns (if already set, only for testing purposes) to net.dns3/4. However, none of that works - it seems as if net.dnsX gets overwritten by another process after dhcpcd exits.
So now my questions are:
What service/program sets net.dnsX? Perhaps ConnectivityManager? How can I manipulate that behaviour?
May it be possible that what-service-soever tries to copy a wrong dns setting, e.g. from net.ppp0.dns1 which does not exists and thus is empty? Where are the communication interfaces set (build.prop etc.)?
Does dhcpcd (which calls the hook-script) not have permission to change net.dnsX but dhcp.*.dnsX?
Is there a possibility to create a hook that always gets called when net.dnsX changes?
Any other idea to fix it? How do other roms do this?

Hey man,
Thanks for bringing this bug to my notice. I don't have a wifi, so i couldn't test this out. I read that entries in default.prop, present in the root directory, is permanent. So try adding the following in default.prop
net.dns1 8.8.8.8
net.dns2 8.8.4.4
Before adding this, take a backup and then add the following to test it out. Do post your result.

Related

get-a-robot-vpnc help

I have been trying to get the get-a-robot-vpnc (http://code.google.com/p/get-a-robot-vpnc/) package to work on my HTC Vogue for some time. I am currently running the eclair 2.1 mssmision build.
I have gotten pretty far I think.. but need some help. Here are the steps that I have followed up until now.
1. Compile tun.ko module for Vogue
I followed these instructions to get the vogue kernel locally: http://www.androidonhtc.com/get_involved
After step 5 in that list, make sure to select the "Device Drivers->Network Device Support->Universal TUN/TAP device driver support" (select as M for kernel module)
After step 6, build the kernel modules: "make modules ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-"
2. Put tun.ko onto the vogue permanently
Set the /system partition writable
Code:
adb -d shell
#su
#mount -o remount,rw /system
In a different terminal, push the tun.ko over to the /system/lib/modules dir
Code:
adb -d push ~/android-kernel/kernel/drivers/net/tun.ko /system/lib/modules
Back in the first terminal, set the system volume to read only again.
Code:
#mount -o remount,ro /system
3. Install the latest get-a-robot-vpnc package
Download from website and push to device:
Code:
adb -d install VPN_Connections_v097.apk
It is installed to /data/data/org.codeandroid.vpnc_frontend directory.
I put in the correct settings to connect to my companies vpn. (These same settings work perfectly on my ubuntu machine)
When I run the program I see on logcat:
Code:
D/VPN_Connections( 658): Password is numeric
D/VPN_Connections( 658): password **********
D/VPN_Connections( 658): done interacting with vpnc
D/VPN_Connections( 658): process stderr:
D/VPN_Connections( 658):
D/VPN_Connections( 658): Attempt to read vpnc process id did not return anything
D/VPN_Connections( 658): process had died, return as failed connection
But when i shell into the phone I see the process running:
Code:
/ # ps | grep vpnc
658 10049 107m S org.codeandroid.vpnc_frontend
710 0 1300 S /data/data/org.codeandroid.vpnc_frontend/files/vpnc -
At this point the network is hosed and in order to get it back I have to reboot.
Trying it manually
In order to see what is happening with vpnc, I shell into the phone and run the program manually.
First I need to ensure the tun.ko is loaded:
Code:
#su
#insmod /system/lib/modules/tun.ko
You can see the command string for vpnc in the /data/data/org.codeandroid.vpnc_frontend/files/lastConnection.txt file.
I run this command:
Code:
/data/data/org.codeandroid.vpnc_frontend/files/vpnc --script /data/data/org.codeandroid.vpnc_frontend/files/vpnc-script --no-detach --debug 1
Enter the correct vpn data and see this output: (i cut out my company specific info and ip addresses)
Code:
vpnc version ERSION
IKE SA selected psk+xauth-3des-md5
NAT status: NAT-T VID seen, no NAT device detected
IKE SA selected psk+xauth-3des-md5
NAT status: NAT-T VID seen, no NAT device detected
Enter Username and Password.
Banner: Welcome <cut> Remote Access User.
got address <xxx.xxx.xxx.xxx>
Connect Banner:
| Welcome <cut> Remote Access User.
backing up dns and resolve.conf
vpnc-script ran to completion
IPSEC SA selected aes128-sha1
VPNC started in foreground...
vpnc[582]: can't open pidfile /var/run/vpnc/pid for writing
At this point I seem to be connected.. but can't actually ping anything on my company network, or get to any websites.
I am not very strong with networking.. so I feel that maybe the routes are not being setup properly.. but I don't know:
Here is my routing table after the connection (took out company ip)
Code:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
68.28.145.85 * 255.255.255.255 UH 0 0 0 ppp0
xxx.xxx.xxx.xx 68.28.145.85 255.255.255.255 UGH 0 0 0 ppp0
default * 0.0.0.0 U 0 0 0 tun0
Any help would be appreciated.
Hey - I posted a response in the vpnc thread:
http://forum.xda-developers.com/showpost.php?p=5625056&postcount=109
Also, to amend - if you try it manually again, try this:
/data/data/org.codeandroid.vpnc_frontend/files/vpnc --script /data/data/org.codeandroid.vpnc_frontend/files/vpnc-script --no-detach --natt-mode cisco-udp --debug 1

IPv6 Privacy Extensions

I just tested Privacy Extensions successfully under Virtuous 3.2.0 using the following command:
sysctl -w net.ipv6.conf.default.use_tempaddr=2
However I'd like to make the change permanent. Would it be better to create /etc/sysctl.conf which currently does not exist on my device, or add it to the /sys/module/ipv6/parameters directory? I tried the later, but was unable to create the file. Any ideas?
# pwd
/sys/module/ipv6/parameters
# echo 2 > use_tempaddr
cannot create use_tempaddr: directory nonexistent
code.google.com/p/android/issues/detail?id=14013
I'm on a Galaxy S but it doesn't matter.
I used the command from there https://bugs.launchpad.net/ubuntu/+source/procps/+bug/176125
on adb:" echo 2 >/proc/sys/net/ipv6/conf/all/use_tempaddr" but i get the erro:
"cannot create /proc/sys/net/ipv6/conf/all/use_tempaddr: directory nonexistent"
I made a textfile in windows and named it "use_tempaddr" and wrote "2" in the textfile. Removed the *.txt extension and copied it to /mnt/sdcard on my GalaxyS.
Then I made "busybox cp /mnt/sdcard/use_tempaddr /proc/sys/net/ipv6/conf/all/use_tempaddr" but I get the error: "cp: can't create '/proc/sys/net/ipv6/conf/all/use_tempaddr': No such file or directory"
Pls, help me how to get that file working.
You could use a sysctl.conf in /system/etc, just follow the steps here:
http://forum.xda-developers.com/showthread.php?t=814463
Very simple
failed to copy 'sysctl.conf' to '/system/etc/sysctl.conf': Permission denied
Why?
Can I do "adb shell" instead, then "su" to have access? But what is the command from inside adb shell instead of adb push?
EDIT: I pushed it to /mnt/sdcard but I can't copy it to /system/etc with Astro, the paste option is grayed out
EDIT2: Ok it worked. I downloaded "super manager" from the android market, and activated the root (rights) function of super manager.
Edit3: But going to for example http://test-ipv6.com on my Android device does show the MAC in the ipv6 address. So it didn't work
EDIT4: Another thing is, the Android Browser of Android 2.2 seems to only support ipv4
Polarfuchs said:
failed to copy 'sysctl.conf' to '/system/etc/sysctl.conf': Permission denied
Why?
Can I do "adb shell" instead, then "su" to have access? But what is the command from inside adb shell instead of adb push?
EDIT: I pushed it to /mnt/sdcard but I can't copy it to /system/etc with Astro, the paste option is grayed out
EDIT2: Ok it worked. I downloaded "super manager" from the android market, and activated the root (rights) function of super manager.
Edit3: But going to for example http://test-ipv6.com on my Android device does show the MAC in the ipv6 address. So it didn't work
Click to expand...
Click to collapse
You need root to modify the system partition.
Did you "sysctl -p" after the transfer? If not, open a terminal on your phone (or adb, whichever you prefer), and type that. The command should output the contents of your sysctl.conf
If that is successful, reboot, then try the website again.
If I enter sysctl -p it says sysctl:not found
if I enter sysctl.conf -p it says sysctl.conf: not found
But when I cd to /system/etc and do "ls" i can see the sysctl.conf file is present.
btw: I'm rooted.
Polarfuchs said:
If I enter sysctl -p it says sysctl:not found
if I enter sysctl.conf -p it says sysctl.conf: not found
But when I cd to /system/etc and do "ls" i can see the sysctl.conf file is present.
btw: I'm rooted.
Click to expand...
Click to collapse
Try:
Code:
busybox sysctl -p
Usually the update-script used to install roms will symlink this for you, but in this case, it's just one extra word lol.
Code:
$ export PATH=/data/local/bin:$PATH
$su
# busybox sysctl -p
sysctl: error: 'net.ipv6.conf.all.use_tempaddr' is an unknown key
#
hm.....
That's the extent of my knowledge sorry to say. Not too familiar with all of this
I hope someone can solve your issue!
Just for a sanity check, you could try looking at what is allowable in the context of your dinc: // I only looked at eth0, you can look at whatever you like using enough terms to get you into the neighborhood.
(from adb)
bash-3.2# sysctl -A | grep "net.ipv6.conf.eth0."
sysctl -A | grep "net.ipv6.conf.eth0."
sysctl: error reading key 'net.ipv4.route.flush': Permission denied
net.ipv6.conf.eth0.forwarding = 0
net.ipv6.conf.eth0.hop_limit = 64
net.ipv6.conf.eth0.mtu = 1500
net.ipv6.conf.eth0.accept_ra = 1
net.ipv6.conf.eth0.accept_redirects = 1
net.ipv6.conf.eth0.autoconf = 1
net.ipv6.conf.eth0.dad_transmits = 1
net.ipv6.conf.eth0.router_solicitations = 3
net.ipv6.conf.eth0.router_solicitation_interval = 4
net.ipv6.conf.eth0.router_solicitation_delay = 1
net.ipv6.conf.eth0.force_mld_version = 0
net.ipv6.conf.eth0.use_tempaddr = 0
net.ipv6.conf.eth0.temp_valid_lft = 604800
net.ipv6.conf.eth0.temp_prefered_lft = 86400
net.ipv6.conf.eth0.regen_max_retry = 5
net.ipv6.conf.eth0.max_desync_factor = 600
net.ipv6.conf.eth0.max_addresses = 16
net.ipv6.conf.eth0.accept_ra_defrtr = 1
net.ipv6.conf.eth0.accept_ra_pinfo = 1
net.ipv6.conf.eth0.accept_ra_rtr_pref = 1
net.ipv6.conf.eth0.router_probe_interval = 60
net.ipv6.conf.eth0.proxy_ndp = 0
net.ipv6.conf.eth0.accept_source_route = 0
net.ipv6.conf.eth0.optimistic_dad = 0
net.ipv6.conf.eth0.disable_ipv6 = 0
net.ipv6.conf.eth0.accept_dad = 1
sysctl: error reading key 'net.ipv6.route.flush': Permission denied
bash-3.2#
So, maybe this line is of interest::
net.ipv6.conf.eth0.use_tempaddr = 0
-- I could echo 1 into the /proc FS spot you were trying to, as well as setting tempaddr=2. I am just guessing that some of the kernels aren't using built in ipv6, so maybe you've got to load the module? "modprobe ipv6"?
I'm also guessing you've tested something easy like "# ping6 -c 4 ::1" just to be sure ipv6 is alive at all.
Just some thoughts - Hashi
ping6 does show that:
Code:
$ export PATH=/data/local/bin:$PATH
$su
# ping6 -c 4 ::1
ping6: not found
# busybox ping6 -c 4 ::1
PING ::1 (::1): 56 data bytes
64 bytes from ::1: seq=0 ttl=64 time=0.191 ms
64 bytes from ::1: seq=1 ttl=64 time=0.924 ms
64 bytes from ::1: seq=2 ttl=64 time=0.968 ms
64 bytes from ::1: seq=3 ttl=64 time=0.198 ms
--- ::1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.191/0.570/0.968 ms
#
grep doesn't exist on the phone:
Code:
export PATH=/data/local/bin:$PATH
$ $su
# busybox sysctl -a | grep "net.ipv6.conf"
grep: not found
sysctl: error reading key 'net.ipv4.route.flush': Permission denied
sysctl: error reading key 'net.ipv6.route.flush': Permission denied
#
And modprobe ipv6 gives:
Code:
export PATH=/system/xbin:$PATH
$ $busybox modprobe ipv6
modprobe: chdir(2.6.32.9): No such file or directory
$
EDIT: "lsmod" doesn't show ipv6
and "insmod ipv6" says "can't open 'ipv6'"
Just a couple things since I've got to run now:
1) No grep on phone: I think it's just another bit of busybox. If you type in busybox and <enter>, then you should see a huge list of verbs / cmds, and you can use "busybox" <verb> (or for grep busybox grep) instead of grep.
2) modprobe ipv6 fails:: I hadn't really studied android much yet, so now I see that ipv6 is most often compiled into the kernel, not a module, so my mistake. It is unlikely to be module except on some early kernel or if someone really wanted it to be.
3) ping6 ::1 returns, is a good, but very embryonic good sign.
4) What are you after? Stateless configuration (DHCP for IPv6 only unique?). Have you had IPv6 working after any fashion (say with a "2001::xxxx:yyyy::z" homebrewed unique address working at all yet? Another thing: Are you behind some IPv6 unfriendly firewall or are you using 3g? If you're on wifi and say, behind an ATT UVerse setup, you are going to have use 6to4 tunnel to get anywhere. (hey, what's another 30 ms? )
--- I'm an IPv6 fan, but only really know configuring it on Cisco routers and true linux boxes thus far. -----
If you're in what maybe is the best of worlds on wifi over a dd-wrt setup, then try to configure an IPv6 tunnel on the firewall on the Outside and see if you can hit that with IPv6. Gotta start somewhere.
Hashi
I use a AVM Fritzbox 7240 with freetz image.
My ISP doesn't use IPv6 yet but the fritzbox router automatically negotiates if 6to4 is necessary. And because my ISP still has no ipv6 the router uses 6to4.
Another setting in the router config is, that the router addresses 'unique local addresses' to the network device as far as no ipv6 connection is present.
That setting can be changed too.
I'm not a professional network administrator, but I wanted to test ipv6 for the router. And I want to use the privacy extensions on android, because without them the MAC is shown on for example www.test-ipv6.com. Ipv6 does work on android but without privacy extensions at default.
Ah yes, I connect my android device via wifi to the router.
So, if ipv6 is built into the kernel, is there a via to set the use_tempaddr setting? Maybe via a file like rc.custom or how these files are called that load things at boot up.
Polarfuchs said:
I use a AVM Fritzbox 7240 with freetz image.
My ISP doesn't use IPv6 yet but the fritzbox router automatically negotiates if 6to4 is necessary. And because my ISP still has no ipv6 the router uses 6to4.
Another setting in the router config is, that the router addresses 'unique local addresses' to the network device as far as no ipv6 connection is present.
That setting can be changed too.
I'm not a professional network administrator, but I wanted to test ipv6 for the router. And I want to use the privacy extensions on android, because without them the MAC is shown on for example www.test-ipv6.com. Ipv6 does work on android but without privacy extensions at default.
Ah yes, I connect my android device via wifi to the router.
So, if ipv6 is built into the kernel, is there a via to set the use_tempaddr setting? Maybe via a file like rc.custom or how these files are called that load things at boot up.
Click to expand...
Click to collapse
OK: It sounds like you made a lot more progress than me on the droid if you got it working with any outside site with IPv6. One thing I notice is that although it "appears" I can set use_tempaddr, I then realized that no matter what I type in, it is usually echoed back to me on the command line, so that I have no idea if it was really set. I'm too new to the Dinc to know what it'll do and won't re ipv6.
It turns out I wasn't setting it using sysctl, but I was able to echo 2 > /proc/*/.../use_tempaddr, and that would show up in a 'cat /proc/*' statement. I don't think it actually is working on my ROM or that I haven't yet figured out how to transform the linux statements I'm comfortable with into the watered down droid busybox equivalents. I'm really not seeing much indication other than a few little hopeful things, that ipv6 is fully enough supported on my rev of software to get anywhere.
However, now I'm pretty interested in this and will be working on an ipv6 setup (just got an actual /48 block at work) so will be keeping this in mind.
I'm curious now to know what series of statements you used to get far enough to hit www.test-ipv6.com with ping6? (or did I get that wrong?)
There is a bug filed in the google codebase that implies that ipv6 just isn't working yet, but it looks fairly old. It may be pre-2.2. It is an enhancement request that is still alive and asking for ipv6 support in android, so I'm really interested in what you did before to get it working.
By the way, my results from test-ipv6.com are pretty bleak. 10/10 for ipv4 and 0/14 (I'm forgetting the exact numbers). That was after a lot of setup and attempting to do this the way I'd do a linux box. I do believe it's in the kernel, and sysctl -a seems to bear that out.
I did manage to figure out how to make a dinc kernel tonight, so I can get a better look now at the ipv6.c code and make sure it's in the config. This little linux box is really confusing me right now
Thanks -- Hashi
I didn't do much.
I have android 2.2 which already supports ipv6 but no privacy extensions.
ipv6 worked from the start.
Ipv6 does show me a 7/10 on my win7 pc.
But with my galaxy S android device it shows 0 or 2 (I don't remember)
I think the installed browser of android 2.2 doesn't support ipv6 yet.
I have made screenshots to compare ipv6 on win7 and on the android device via wifi.
Do you think the results for my android device on test.ipv6.com appear like that, because the browser doesn't show ipv6 sites, or do the results mean that I have an ipv6 address through 6to4 but my android device doesn't accept ipv6 yet?
Polarfuchs said:
I didn't do much.
I have android 2.2 which already supports ipv6 but no privacy extensions.
ipv6 worked from the start.
Ipv6 does show me a 7/10 on my win7 pc.
But with my galaxy S android device it shows 0 or 2 (I don't remember)
I think the installed browser of android 2.2 doesn't support ipv6 yet.
I have made screenshots to compare ipv6 on win7 and on the android device via wifi.
Do you think the results for my android device on test.ipv6.com appear like that, because the browser doesn't show ipv6 sites, or do the results mean that I have an ipv6 address through 6to4 but my android device doesn't accept ipv6 yet?
Click to expand...
Click to collapse
I'll look around for the write-up(s) I found over the last day or two about various androids and ipv6, and they'll perhaps answer some of your questions, like the browser. This is the gist of what I got from reading.
Some 2.2+ androids support (marginally) the ipv6 stack, tunneled AND dual-stack. A couple people can get 'outside' using ipv6, and a couple more can 'browse' ipv6-only websites. The browser isn't the problem. At some low level on my Incredible, the stack doesn't "see" ipv6 addresses as "valid". I think that means it just has some holes left in it. You've got a 'newer' device (Samsung), so this may have been improved.
My scores are 10/10, ipv4, and 0/24? ipv6, and from a 0 score there's nothing it can tell you of use. It just doesn't work. Yours looks very promising.
One thing I'm wondering about is whether I've got a version of busybox that is sadly lacking in ipv6 functionality. All the network applets come out of that single executable. I've got busybox 1.16.0, and am curious which you've got. I could change busybox's version easily, in fact you can go to busybox.net, get source, fix it up, use toolchains and build it.
Also, life is easier if you just install it (./busybox --install .) since it'll make a symlink for each function in whatever folder it was in (like /system/xbin is pretty empty and on my path).
Let us know when you get it running. I'll do the same. Another thing missing in mine is ipv6 DNS. I have ipv6 DNS setup at work, and if I point it to that DNS server using "setprop x.y.sit1.DNS.*" (sorry, don't recall the exact setup procedure), than it still will not resolve ipv6 addresses. Nslookup (type=AAAA) doesn't work correctly either. Mine is heavily hacked stock 2.2 with a custom kernel. I just blew all the 'sense' layer away for the sake of battery life.
-- H
I use a cooked rom, not the official samsung 2.2
It has had busybox 1.16 installed.
But I went to the market and installed the app "BusyBox Installer" which then installed BusyBox 1.17.1 for me.
Sorry for not subscribing to my own thread, I had this problem licked back in January....at least on my Droid Inc. The problem is that /system is mounted as read-only. You need to remount with RW permissions and then copy or vi sysctl.conf to /system/etc/
skyblaster said:
Sorry for not subscribing to my own thread, I had this problem licked back in January....at least on my Droid Inc. The problem is that /system is mounted as read-only. You need to remount with RW permissions and then copy or vi sysctl.conf to /system/etc/
Click to expand...
Click to collapse
Thanks for checking back. I'd still like to get this working on my own Inc. The case I'm most interested in is probably using 3g rather than wifi. Do you have an idea whether the Verizon 3g supports ipv6? I know we should be able to get it working in , for example, a dd-wrt flashed router, but it would be nice to be able to use ipv6 when there's no handy wifi.
Thanks - Hashi
Thx for the feedback.
I remounted system rw (can be done easily with "SGS Toolbox", or manually)
Ifconfig shows as long as wifi is turned on, there is an interface called eth0.
I added to the sysctl.conf this: "net.ipv6.conf.eth0.use_tempaddr=2"
I rebooted and ifconfig shows an ipv4 and ipv6 address.
But www.test-ipv6.com shows 0/10 at the ipv6 rating.
EDIT: Does /system have to be kept rw or can I change it to Read-only after placing the sysctl.conf?

[Q] I9000 and OpenVPN

Hi all!
I'm trying to connect my I9000 with OpenVPN server in my LAN using OpenVPN Settings. All configuration files seem to be correct, because connection is up, but no packet (even ICMP) goes through the tunnel. I have added special configuration to server's CCD folder for my I9000, but nothing changed. When I type in Terminal Emulator
Code:
ip route
I get the following:
Code:
192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.102
default via 192.168.2.1 dev eth0
192.168.2.0/24 is my home network. VPN Server's address is 10.8.0.1 (192.168.2.200 in my LAN).
when I type in Terminal Emulator
Code:
ifconfig tun0
I get
Code:
Cannot assign requested address
I have another device Desire HD, and on this one OpenVPN works correctly.
When I type
Code:
ip routes
in Terminal Emulator, I have:
Code:
10.8.0.5 dev tun0 src 10.8.0.6
192.168.2.0/24 dev eth0 src 192.168.2.100
10.8.0.0/24 via 10.8.0.5 dev tun0
default via 192.168.2.1 dev eth0
All problems seem to be in routes and gateway settings. How can I add proper routes and gateway on my I9000? What's wrong? Can anybody help me?
Thanks
Solved
I solved all problems with OpenVpn by flashing CyanogenMod on I9000.

[Q] Is there a way to change device name when connected to USB?

I found how to change device name for Bluetooth and Ethernet (separate settings).
Is there a way to change device name from XT1053 (or whatever you model is) to something else when device is connected to USB?
Disregard the post below - this is for network host name (what will appear in your WiFi router).
Executing this in terminal window:
> su
> getprop net.hostname
> setprop net.hostname <new_hostname>
only works until the reboot.
I found this solution: http://www.invialgo.com/2012/change-android-hostname/#comment-88411 but haven't tried that yet.

[GUIDE] How to Change DNS in Android Device (8 methods)

Here is a compilation of different ways to change/set the DNS Server in Android Devices
In this thread, I'll be setting the DNS Servers to 8.8.88 & 8.8.4.4 (Google DNS).
You can use any DNS server of your wish.
FOR NON-ROOTED DEVICES:
Method 1: (by changing WiFi Settings)
Note: For some devices, this will work only if you can set a static IP.
1. Go Settings->WiFi
2. Long press the Network you're connected to, and tap 'Modify Network'.
3. Check 'Advanced'. (may not be required in some phones)
Switch the IP settings from DHCP to Static.
Add required DNS servers to the entries for DNS 1 and DNS 2.
4. Click 'Save'
(Don't worry about the editing the IP address as the Android device may fill in the IP address it has acquired through DHCP.)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Method 2: (Easiest Method using app)
You could just use any app like:
1. Engelsiz : DNS Changer
2. DNS Changer (NO ROOT)
3. DNS Changer (no root 3G/WiFi)
4. DNSet
5. DNS Changer
(or any other app in Play Store.)
(Some apps may require root access)
FOR ROOTED DEVICES:
Easiest way:
The best apps I would recommend to do this automatically are:
1. Override DNS (Root)
2. Set DNS
3. DNS + DNSCrypt Manager
4. DNS Forwarder
Method 3: (by editing DNS config)
1. Open the file 20-dns.conf from /etc/dhcpcd/dhcpcd-hooks/ using a Text Editor (I use ES File Explorer)
2. Add this line to the beggining & reboot device:
Code:
new_domain_name_servers="8.8.8.8 8.8.4.4 $new_domain_name_servers"
So, finally the script finally looks something like this:
Code:
##THIS CAN VARY slightly FOR DIFFERENT ROM BUILDS
# Set net.<iface>.dnsN properties that contain the
# DNS server addresses given by the DHCP server.
[B]new_domain_name_servers="[I]8.8.8.8[/I] [I]8.8.4.4[/I] $new_domain_name_servers"[/B]
if [[ $interface == p2p* ]]
then
intf=p2p
else
intf=$interface
fi
set_dns_props()
{
case "${new_domain_name_servers}" in
"") return 0;;
esac
count=1
for i in 1 2 3 4; do
setprop dhcp.${intf}.dns${i} ""
done
count=1
for dnsaddr in ${new_domain_name_servers}; do
setprop dhcp.${intf}.dns${count} ${dnsaddr}
count=$(($count + 1))
done
separator=" "
if [ -z "$new_domain_name" ]; then
separator=""
else
if [ -z "$new_domain_search" ]; then
separator=""
fi
fi
setprop dhcp.${interface}.domain "${new_domain_name}$separator${new_domain_search}"
}
unset_dns_props()
{
for i in 1 2 3 4; do
setprop dhcp.${intf}.dns${i} ""
done
setprop dhcp.${interface}.domain ""
}
case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT) set_dns_props;;
EXPIRE|FAIL|IPV4LL|RELEASE|STOP) unset_dns_props;;
esac
This is a permanent change. (& sets only for WiFi)
Remove that added line to undo the changes.
(Source: http://forum.xda-developers.com/showpost.php?p=51650282&postcount=7 )
Method 4: (by changing DNS properties using Terminal Emulator)
Note: This may not work in Android 4.4 and above devices.
1. Open Terminal Emulator and type:
Code:
getprop | grep dns
2. Note down all the properties related to dns1, dns2.
These are the properties you need to set to change the DNS Server.
Use the following commands in Terminal Emulator to set them (using setprop):
Code:
su
setprop dhcp.wlan0.dns1 8.8.8.8
setprop dhcp.wlan0.dns2 8.8.4.4
setprop net.dns1 8.8.8.8
setprop net.dns2 8.8.4.4
Other optional properties for mobile networks (may vary with devices) (rmnet0 for 3G I guess)
Code:
setprop net.ppp0.dns1 8.8.8.8
setprop net.ppp0.dns2 8.8.4.4
setprop net.rmnet0.dns1 8.8.8.8
setprop net.rmnet0.dns2 8.8.4.4
setprop net.pdpbr1.dns1 8.8.8.8
setprop net.pdpbr1.dns2 8.8.4.4
Setting DNS for very older devices:
Code:
setprop ro.kernel.android.ndns 2
setprop dhcp.eth0.dns1 8.8.8.8
setprop dhcp.eth0.dns2 8.8.4.4
(You may similarly set dns3 & dns4, but that's not necessary)
These properties get reset to the original values upon reboot..
So, to keep these changes permanent, add the required commands to init.d
(Source: https://github.com/ukanth/afwall/wiki/DNS#changing-default-dns )
Method 5: (by using iptables command)
1. Open Terminal Emulator and type the following:
Code:
su
iptables -t nat -A OUTPUT -p tcp --dport 53 -j DNAT --to-destination 8.8.8.8:53
iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 8.8.8.8:53
iptables -t nat -D OUTPUT -p tcp --dport 53 -j DNAT --to-destination 8.8.8.8:53 || true
iptables -t nat -D OUTPUT -p udp --dport 53 -j DNAT --to-destination 8.8.8.8:53 || true
iptables -t nat -I OUTPUT -p tcp --dport 53 -j DNAT --to-destination 8.8.8.8:53
iptables -t nat -I OUTPUT -p udp --dport 53 -j DNAT --to-destination 8.8.8.8:53
(you may also use this as AFWall+ Custom Script)
For more detailed info and better understanding, click here.
These properties get reset to the original values upon reboot..
So, to keep these changes permanent, add the required commands to init.d
Method 6: (by editing resolv.conf)
Note:
I think this method works only for old devices. Nothing wrong in trying
1. Open resolv.conf from /system/etc/ using a Text Editor (I use ES File Explorer)
(If there's no such file, create it and try.)
2. Modify the nameservers in the file to your desired DNS servers.
The file finally looks like this:
Code:
nameserver 8.8.8.8
nameserver 8.8.4.4
This change is permanent..
So, it's better to backup the original resolv.conf before editing.
(Source: https://butterflydroid.wordpress.com/2011/10/19/how-to-set-dns-server-on-android-phone/ )
Method 7: (by using ndc resolver command)
1. Open Terminal Emulator and type the following:
Code:
su
ndc resolver flushif [SIZE="1"][I]## to flush old DNS servers[/I][/SIZE]
ndc resolver flushdefaultif [SIZE="1"][I]## to flush resolver[/I][/SIZE]
ndc resolver setifdns <iface> <domains> <dns1> <dns2> ... [SIZE="1"][I]## Add the new servers[/I][/SIZE]
ndc resolver setdefaultif [SIZE="1"][I]## Set as the default device[/I][/SIZE]
This may vary for different Android Versions, so check this also..
These properties get reset to the original values upon reboot..
So, to keep these changes permanent, add the required commands to init.d
Method 8: (by using DNSCrypt command)
Install DNSCrpt on your Android Device with this instructions here.
Then check this answer here on Android Stack Exchange on how to set DNS using a script.
Hit the 'Thanks!' button if you found this helpful.
Leave a reply if you need any help
Do leave a reply if any of these methods worked on your device...
please tell me how to add init.d. I don't know.
rajarshi kundu said:
please tell me how to add init.d. I don't know.
Click to expand...
Click to collapse
This might help:
[GUIDE] How to use init.d scripts
Or try this app: Universal Init.d
method1
great list tks. re method 1, in my experience you have to give an ip address as otherwise you can't save the settings, which then turns out you have to give the device a static ip at your router.
Great list...
Now how about you tell us which versions of Android these work on?
Since Android 6.1.x you can only change the DNS for tethered devices and nothing else. Everything else is ignored, no matter what you set or which app you use.
Wartickler said:
Now how about you tell us which versions of Android these work on?
Since Android 6.1.x you can only change the DNS for tethered devices and nothing else. Everything else is ignored, no matter what you set or which app you use.
Click to expand...
Click to collapse
DNS + DNSCrypt Manager (root) worked for me in Android 7.1.1
Fast what is the fastest downloader for Android phone as cell phones and tablets also how do you use the DNS changer
S7 Nougat
seems after an upgrade to Nougat I cant view my DNS anymore is this true? Mine is nonrooted
i'm on Android 6.0.1 and the iptables method works!
setprop doesn't work.
Wartickler said:
Since Android 6.1.x you can only change the DNS for tethered devices and nothing else. Everything else is ignored, no matter what you set or which app you use.
Click to expand...
Click to collapse
Modifying the 20-dns.conf file worked for me on 7.0.
Help please,
Do u guys think dns changer app still needed if dns already change through build prop( kernel adiutor)? Or mod app like fly on mod?
Feels like its redundant
Is it possible to change dns host name permanently?
So it wont be changed to default after reboot..
@GokulNC
How to change the DNS ADDRESS with help of creating dumpy VPN service without help of any application .
With help of application -
U list out in non - root app list
Like
https://play.google.com/store/apps/details?id=com.burakgon.dnschanger
That app use dumpy vpn for dns change
But
why we app ??
Please try to discover the configuration of vpn..
Hi, I have a question.
Can you tell me if this changes will be applied also to DNS of Mobile Data?
Dns
I did change Dns regular interface for Android Tv but Dns leak test still shows Isp Dns. Why?
GokulNC said:
Here is a compilation of different ways to change/set the DNS Server in Android Devices
In this thread, I'll be setting the DNS Servers to 8.8.88 & 8.8.4.4 (Google DNS).
You can use any DNS server of your wish.
FOR NON-ROOTED DEVICES:
Method 1: (by changing WiFi Settings)
Note: For some devices, this will work only if you can set a static IP.
1. Go Settings->WiFi
2. Long press the Network you're connected to, and tap 'Modify Network'.
3. Check 'Advanced'. (may not be required in some phones)
Switch the IP settings from DHCP to Static.
Add required DNS servers to the entries for DNS 1 and DNS 2.
4. Click 'Save'
(Don't worry about the editing the IP address as the Android device may fill in the IP address it has acquired through DHCP.)
Method 2: (Easiest Method using app)
You could just use any app like:
1. Engelsiz : DNS Changer
2. DNS Changer (NO ROOT)
3. DNS Changer (no root 3G/WiFi)
4. DNSet
5. DNS Changer
(or any other app in Play Store.)
(Some apps may require root access)
FOR ROOTED DEVICES:
Easiest way:
The best apps I would recommend to do this automatically are:
1. Override DNS (Root)
2. Set DNS
3. DNS + DNSCrypt Manager
4. DNS Forwarder
Method 3: (by editing DNS config)
1. Open the file 20-dns.conf from /etc/dhcpcd/dhcpcd-hooks/ using a Text Editor (I use ES File Explorer)
2. Add this line to the beggining & reboot device:
Code:
new_domain_name_servers="8.8.8.8 8.8.4.4 $new_domain_name_servers"
So, finally the script finally looks something like this:
Code:
##THIS CAN VARY slightly FOR DIFFERENT ROM BUILDS
# Set net.<iface>.dnsN properties that contain the
# DNS server addresses given by the DHCP server.
[B]new_domain_name_servers="[I]8.8.8.8[/I] [I]8.8.4.4[/I] $new_domain_name_servers"[/B]
if [[ $interface == p2p* ]]
then
intf=p2p
else
intf=$interface
fi
set_dns_props()
{
case "${new_domain_name_servers}" in
"") return 0;;
esac
count=1
for i in 1 2 3 4; do
setprop dhcp.${intf}.dns${i} ""
done
count=1
for dnsaddr in ${new_domain_name_servers}; do
setprop dhcp.${intf}.dns${count} ${dnsaddr}
count=$(($count + 1))
done
separator=" "
if [ -z "$new_domain_name" ]; then
separator=""
else
if [ -z "$new_domain_search" ]; then
separator=""
fi
fi
setprop dhcp.${interface}.domain "${new_domain_name}$separator${new_domain_search}"
}
unset_dns_props()
{
for i in 1 2 3 4; do
setprop dhcp.${intf}.dns${i} ""
done
setprop dhcp.${interface}.domain ""
}
case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT) set_dns_props;;
EXPIRE|FAIL|IPV4LL|RELEASE|STOP) unset_dns_props;;
esac
This is a permanent change. (& sets only for WiFi)
Remove that added line to undo the changes.
(Source: http://forum.xda-developers.com/showpost.php?p=51650282&postcount=7 )
Method 4: (by changing DNS properties using Terminal Emulator)
Note: This may not work in Android 4.4 and above devices.
1. Open Terminal Emulator and type:
Code:
getprop | grep dns
2. Note down all the properties related to dns1, dns2.
These are the properties you need to set to change the DNS Server.
Use the following commands in Terminal Emulator to set them (using setprop):
Code:
su
setprop dhcp.wlan0.dns1 8.8.8.8
setprop dhcp.wlan0.dns2 8.8.4.4
setprop net.dns1 8.8.8.8
setprop net.dns2 8.8.4.4
Other optional properties for mobile networks (may vary with devices) (rmnet0 for 3G I guess)
Code:
setprop net.ppp0.dns1 8.8.8.8
setprop net.ppp0.dns2 8.8.4.4
setprop net.rmnet0.dns1 8.8.8.8
setprop net.rmnet0.dns2 8.8.4.4
setprop net.pdpbr1.dns1 8.8.8.8
setprop net.pdpbr1.dns2 8.8.4.4
Setting DNS for very older devices:
Code:
setprop ro.kernel.android.ndns 2
setprop dhcp.eth0.dns1 8.8.8.8
setprop dhcp.eth0.dns2 8.8.4.4
(You may similarly set dns3 & dns4, but that's not necessary)
These properties get reset to the original values upon reboot..
So, to keep these changes permanent, add the required commands to init.d
(Source: https://github.com/ukanth/afwall/wiki/DNS#changing-default-dns )
Method 5: (by using iptables command)
1. Open Terminal Emulator and type the following:
Code:
su
iptables -t nat -A OUTPUT -p tcp --dport 53 -j DNAT --to-destination 8.8.8.8:53
iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 8.8.8.8:53
iptables -t nat -D OUTPUT -p tcp --dport 53 -j DNAT --to-destination 8.8.8.8:53 || true
iptables -t nat -D OUTPUT -p udp --dport 53 -j DNAT --to-destination 8.8.8.8:53 || true
iptables -t nat -I OUTPUT -p tcp --dport 53 -j DNAT --to-destination 8.8.8.8:53
iptables -t nat -I OUTPUT -p udp --dport 53 -j DNAT --to-destination 8.8.8.8:53
(you may also use this as AFWall+ Custom Script)
For more detailed info and better understanding, click here.
These properties get reset to the original values upon reboot..
So, to keep these changes permanent, add the required commands to init.d
Method 6: (by editing resolv.conf)
Note:
I think this method works only for old devices. Nothing wrong in trying
1. Open resolv.conf from /system/etc/ using a Text Editor (I use ES File Explorer)
(If there's no such file, create it and try.)
2. Modify the nameservers in the file to your desired DNS servers.
The file finally looks like this:
Code:
nameserver 8.8.8.8
nameserver 8.8.4.4
This change is permanent..
So, it's better to backup the original resolv.conf before editing.
(Source: https://butterflydroid.wordpress.com/2011/10/19/how-to-set-dns-server-on-android-phone/ )
Method 7: (by using ndc resolver command)
1. Open Terminal Emulator and type the following:
Code:
su
ndc resolver flushif [SIZE="1"][I]## to flush old DNS servers[/I][/SIZE]
ndc resolver flushdefaultif [SIZE="1"][I]## to flush resolver[/I][/SIZE]
ndc resolver setifdns <iface> <domains> <dns1> <dns2> ... [SIZE="1"][I]## Add the new servers[/I][/SIZE]
ndc resolver setdefaultif [SIZE="1"][I]## Set as the default device[/I][/SIZE]
This may vary for different Android Versions, so check this also..
These properties get reset to the original values upon reboot..
So, to keep these changes permanent, add the required commands to init.d
Method 8: (by using DNSCrypt command)
Install DNSCrpt on your Android Device with this instructions here.
Then check this answer here on Android Stack Exchange on how to set DNS using a script.
Hit the 'Thanks!' button if you found this helpful.
Leave a reply if you need any help
Do leave a reply if any of these methods worked on your device...
Click to expand...
Click to collapse
I am trying to use method #3 but I dont have dhcpcd folder ... What to do? My device is rooted and in es manager root explore is checked...
Nice guide, if you have a Raspberry Pi install Pi-Hole on it, then set your home ip as DNS server on your phone/tablet and you'll have have adblocker on your phone/tablet.:good::good:
syamsoul said:
i'm on Android 6.0.1 and the iptables method works!
Click to expand...
Click to collapse
This thread has no other occurrence of "iptables" - would you mind including a reference.
I'm wasting far too much time reading solutions that don't work on CM13 - Android 6.0.1.
drummond said:
This thread has no other occurrence of "iptables" - would you mind including a reference.
I'm wasting far too much time reading solutions that don't work on CM13 - Android 6.0.1.
Click to expand...
Click to collapse
OP - Rooted Devices - Method 5 - it's right there, page 1.
There's an app too.
How much time can that waste?
(If it takes too long to go back one page, the OP is quoted just above your post)

Categories

Resources