DNS tweaks for Developer and Testers


In this work-from-home situation, the developer needs DNS hosting (Public or local) for testing or R&D purpose.

Very difficult to achieve above the things in Home-based routers or Hotspot devices. Hence, we can use the below steps to achieve a DNS host for testing.

Developers or testers are do everything from controlling access to websites and network traffic to just mapping addresses to names. Which they hosted applications through IIS, Apache, etc.

Hosted application DNS should binded with hosted applications ip (Example, 192.168.X.X point to developer.42gears.com) and we have to update DNS records were going to test in client’s device (Mobile/PC’s) host files.

Please follow below steps for Windows PC, Mobile (rooted and non-rooted android devices) and Linux PC.

Septs for Windows PC:

Step 1 – Open Notepad as an Administrator

For example, in Windows 10 click on Start, Type in Notepad, Right Click and choose Run as Administrator

Step 2 – Browse to and open the Host File

c:\windows\system32\drivers\etc\hosts.file

Step 3 – Add in the required entry in the format of Ip Address > TAB > DNS Name

For example: (192.168.1.10      testing.example.com)

Step 4 -Save the file

Steps for Linux

Use the following instructions if you’re running Linux:

Step 1-Open a Terminal window. Enter the following command to open the hosts file in a text editor:

“sudo nano /etc/hosts”

Step 2-Enter your domain user password.

Step 3- Make the necessary changes to the file.

Step 4- Press Control-X.

Step 4- When you are asked if you want to save your changes, enter 

Steps for MacOS X 

Use the following instructions if you’re running MacOS X 10.6 through 10.12:

Step 1- On your computer, select Applications > Utilities > Terminal to open a Terminal window.

Step 2- Enter the following command in the Terminal window to open the hosts file:

“sudo nano /private/etc/hosts”

Step 3- When you are prompted, enter your domain user password.

Step 4 -Edit the host’s file.

The file contains comments (lines that begin with the # symbol) and some default host name mappings (for example, 127.0.0.1 – local host). Add your new mappings after the default mappings.

Step 5- To save the hosts file, press Control+X.

Step 6 -When you are asked if you want to save your changes, enter y.

Step 7 -To force your changes to take effect, flush the DNS cache by entering the following command:

“dscacheutil -flushcache”

Android Devices: –

The non-root method: –

For this method, you will require a computer with the Android Debug Bridge (or ADB) installed on it. If you don’t already have ADB, you can grab it from Google’s developer resource page. Install ADB, and then run a command prompt in ADB’s installation directory.

Step 1 – Connect your device to your computer via USB (make sure you’ve already enabled USB debugging in the developer settings). Run the command
to ensure your device is connected, and that ADB is reading and interacting with your device appropriately.

Step 2- Download your hosts file from your device by issuing the command

“adb pull /system/etc/hosts F:\hosts” (which added localhost hosted DNS Example, 192.168.X.X point to developer.42gears.com)

(replace F:\ with the directory you wish to copy your hosts file to)
This will copy your hosts file to your computer, to allow you to edit it in Notepad.

Step 4- Now, simply navigate to the directory which you copied the hosts file to and edit away! Remember, once you’re done you need to push the file back to your device. Issue the command:

“adb push F:\hosts /system/etc/”

(Again, replace F:\ with the directory where you’re storing your hosts file)
and you’re good to go.

The root method: –

This method is nowhere near as lengthy and should take you less than 5 minutes, even if you’re a slow tapper.

Step 1- Open your file manager of choice (we recommend a file manager like Solid Explorer, as it allows for easy adjustments and modifications to read and write permissions.

Step 2- Navigate to the /system/etc directory.

Step 3- Locate the hosts file in this directory and long-press it to open the “Properties” menu.

Step 4- Select the “Change” option in the permissions section.

Step 5- Select “Group” under write permissions. You should now have sufficient permissions to modify and overwrite the host’s file.

Step 6- Reboot your device and navigate to the hosts file again using your file manager. Select it, press “More” and tap the “Open” option. (You will need a text editor with Superuser access, like TurboEditor.

Step 7- Make any changes you wish; save the file and you’re set!

https://docs.rackspace.com/support/how-to/modify-your-hosts-file/
https://www.modmy.com/how-modify-hosts-file-your-android-device

Leave A Comment

Your email address will not be published. Required fields are marked *