• Skip to main content
  • Select language
  • Skip to search
MDN Web Docs
  • Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs / DOM
    • WebExtensions
    • MathML
  • References & Guides
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
B2G OS
  1. MDN
  2. Archive of obsolete content
  3. B2G OS
  4. Developing Firefox OS
  5. Customizing DNS

Customizing DNS

In This Article
  1. Preparing your environment
  2. Steps to update DNS
  3. See also

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:
        count=1
        for dnsaddr in ${new_domain_name_servers}; do
            setprop dhcp.${intf}.dns${count} ${dnsaddr}
            count=$(($count + 1))
        done
  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

  • ADB documentation

Document Tags and Contributors

Tags: 
  • DNS
  • Firefox OS
 Contributors to this page: chrisdavidmills, Jeremie, Case_Of
 Last updated by: chrisdavidmills, Feb 27, 2017, 2:58:48 AM
See also
  1. Build and install
    1. Build and install overview
    2. B2G OS build process summary
    3. Build prerequisites
    4. Preparing for your first build
    5. Building B2G OS
    6. B2G installer add-on
    7. Building B2G OS for Flame on Mac OS X
    8. Choosing how to run Gaia or B2G OS
    9. Compatible Devices
    10. Installing B2G OS on a mobile device
    11. Creating and applying B2G OS update packages
    12. Building and installing FOTA community builds
    13. B2G build variables reference sheet
  2. Porting B2G OS
    1. Porting overview
    2. Porting basics
    3. Porting on CyanogenMod
  3. Developing Gaia
    1. Developing Gaia overview
    2. Running the Gaia codebase
    3. Run Gaia on desktop using Mulet
    4. Understanding the Gaia codebase
    5. Making Gaia code changes
    6. Testing Gaia code changes
    7. Submitting a Gaia patch
    8. Gaia build system primer
    9. Different ways to run Gaia
    10. Make options reference
    11. Gaia tools reference
  4. B2G OS APIs