Customizing DNS

This is an archived page. It's not actively maintained.

This article outlines a procedure to change the DNS servers for all interfaces (wifi, cellular, etc.) on a Firefox OS device.

Preparing your environment

  1. On your phone, go to Developer settings and enable the following settings:
    • Remote Debugging (in Firefox OS 1.4 and above, select ADB and Devtools from the drop down menu.)
    • Console Enabled
  2. Make sure that you have got ADB/Fastboot installed on your computer.
  3. Once these steps are done, plug your phone into your computer via USB.

Steps to update DNS

  1. Open a terminal window.
  2. Pull the DNS configuration file onto your computer with the below command:
    adb pull /system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf 20-dns.conf
  3. Find lines 22 to 26 of the file:
        for dnsaddr in ${new_domain_name_servers}; do
            setprop dhcp.${intf}.dns${count} ${dnsaddr}
            count=$(($count + 1))
  4. Inside this section, replace the setprop line with lines like the following (you can include up to 4 DNS servers):
        setprop dhcp.${intf}.dns1 <DNS server 1 ip adress>
        setprop dhcp.${intf}.dns2 <DNS server 2 ip adress>
        setprop dhcp.${intf}.dns3 <DNS server 3 ip adress>
        setprop dhcp.${intf}.dns4 <DNS server 4 ip adress>
  5. Remount the /system partition on the device to get read-write permissions, like so:
    adb remount
  6. Backup the original file, just in case:
    adb shell mv /system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf /system/etc/dhcpcd/dhcpcd-hooks/20-dns.bak.conf
  7. Push the edited file and apply the correct permissions to it, as follows:
    adb push 20-dns.conf /system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf
    adb shell chmod 644 /system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf
  8. Reboot the device and your DNS server settings will be updated.

See also