Changing the Host File

Changing the Host File


Overview

When setting up an OAuth, certain services, such as Google, do not allow the specifying of an IP address for redirect URIs—instead, these services expect a hostname from which the request will originate. This guide explains how to modify a host file on your local machine to map a known IP address to a hostname. You can then use this hostname instead of the IP address to browse to Matillion ETL or any other service that is accessible via that IP address. This change is local to the machine where changes are made.


Linux

  1. Open the terminal.
  2. Open the hosts file in any text editor.
  3. For example, using nano:
    sudo nano /etc/hosts
  4. Enter the appropriate user password.
  5. Change the file's contents as you require.
  6. Close the file by pressing CTRL + X.
  7. When asked if you want to save your changes, enter y (yes).


Windows 8 & Windows 10

  1. Press the Windows key or click the Windows menu button to bring up the search function.
  2. Type in "notepad". (Alternately, browse to it through Start MenuWindows AccessoriesNotepad .)
  3. Right-click Notepad, hover over More, and click Run as administrator.
  4. From Notepad, use FileOpen and browse to the file:
    c:\Windows\System32\Drivers\etc\hosts
  5. Change the file's contents as you require.
  6. Click FileSave to save your changes.


Windows 7 & Windows Vista

  1. Browse to Start Menu→All Programs→Accessories.
  2. Right-click 'Notepad' and select Run as administrator.
  3. If you have UAC enabled, click Continue to pass the UAC window.
  4. From Notepad, use File→Open and browse to the file:
    c:\Windows\System32\Drivers\etc\hosts
  5. Change the file's contents as you require.
  6. Use File→Save to save your changes.


OSX 10.0 to 10.12

  1. Open /Applications/Utilities/NetInfo Manager.
  2. Allow editing of the NetInfo database by clicking the padlock in the bottom-left corner of the window.
  3. Enter the appropriate user password.
  4. In the second column of the browser view, select the node named machines.
  5. The third column contains entries for -DHCP-, broadcasthost, and localhost.
  6. Select localhost.
  7. Repeat this loop for every additional host entry that you want to add:
    1. Use Edit→Duplicate.
    2. A confirmation alert appears. Click Duplicate.
    3. A new entry called localhost copy appears, and its properties are shown below the browser view.
    4. Double-click the value of the ip_address property and enter the IP address of the other computer.
    5. Double-click the value of the name property and enter the hostname you want for the other computer.
    6. Click the serves property and select Delete from the Edit menu.
    7. From the File menu, select Save.
    8. A confirmation alert appears.
    9. Click Update this copy.
  8. Select Quit from the NetInfo Manager menu.


OSX 10.12 to 10.6

  1. Open Applications→Utilities→Terminal.
  2. Open the hosts file by entering this below into the terminal window:
    sudo nano /private/etc/hosts
  3. Enter the appropriate user password.
  4. Edit the hosts file as below. Lines beginning with the hash symbol (#) are comments. Others describe default hostname mappings (e.g. 127.0.0.1 – local host).
  5. Enter any new mappings after the default mappings.
  6. Save the hosts file by pressing Control+X and answering y (yes).
  7. Flush the DNS cache using the following command in the terminal window:
    dscacheutil -flushcache