10

I am trying to access an ims core from the ims client in my Android device, however I need to modify the dhcp client to add the ip of the core as one of the DNS. In case of a Linux OS the following would do the job::

cd /etc/dhcp3/ ; vi dhclient.conf ; /* add the line:: prepend domain-name-servers 152.xx.xx.xx(ip of ims core) / sudo dhclient ; / to restart*/

Now the issue is how do I achieve the same in my Android?

3
  • Which Android device do you have? Version? Rooted / Unrooted?
    – Sparx
    Feb 26, 2011 at 10:42
  • I am having Motorola A855
    – user3148
    Feb 26, 2011 at 18:46
  • If you want to set a DNS server for one/some access points, you can use Wifi Static.
    – elmicha
    Nov 22, 2011 at 18:47

2 Answers 2

1

This doesn't really address your DHCP question (not sure what sysprop that would be), but it will fix your DNS issues. You can make an ASE script for it if you don't want to have to do it every time your DNS is changed by the provider.

Also, depending on how your DNS server is setup you may want to change the INT at the end of line one to "2" or "3" and add some other DNS servers for the rest of the internet (openDNS, google DNS, etc).

Open an adb shell or Terminal Emulator and type:

setprop ro.kernel.android.ndns 1
setprop net.eth0.dns1 152.xxx.xxx.xxx 

Alternatively, just throw the server(s) you want to resolve into /system/etc/hosts, like you would in a normal linux system.

1
  • 2
    note that not all devices have net.eth0.dns1, some use net.dns1 or net.gprs0.dns1, check this with getprop. Sep 27, 2011 at 17:47
0

On my device I got

/etc/dhcpd/dhclient.conf 

To get a new IP from DHCP you can run

dhcpcd -k wlan0
dhcpcd -n wlan0
1
  • /system/bin/sh: cat: /etc/dhcpd/dhclient.conf: No such file or directory
    – CS QGB
    Dec 20, 2022 at 9:39

You must log in to answer this question.