# Resolving Hostnames To IP Addresses Ubuntu

To change how the address `https://docs.natenetworks.com/books/project-notes/page/command-guide-to-backing-up-bookstack` is resolved locally and use a hostname instead of an IP address, you can edit the `hosts` file on your local machine. This allows you to map the IP address to a more friendly hostname, which you can then use in your browser or any application that accesses this URL. Here’s how to do it for various operating systems:

### For Linux and macOS

<div class="flex flex-grow flex-col max-w-full" id="bkmrk-open-a-terminal.-edi"><div class="min-h-[20px] text-message flex flex-col items-start gap-3 whitespace-pre-wrap break-words [.text-message+&]:mt-5 overflow-x-auto" data-message-author-role="assistant" data-message-id="e40121f5-42c6-4d3b-b89b-529b95cd194a"><div class="markdown prose w-full break-words dark:prose-invert dark">1. **Open a Terminal**.
2. **Edit the `/etc/hosts` file**. You’ll need superuser permissions to edit it. You can use any text editor; here, `nano` is used as an example:

</div></div></div>- <div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto">`sudo nano /etc/hosts`</div></div>
- **Add an entry** for the IP address and the desired hostname at the end of the file. For example, if you want to use `mybookstack.local` as the hostname, add:
    
    <div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md">lua</div></div>

1. <div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto">`<span class="hljs-number">192.168</span><span class="hljs-number">.1</span><span class="hljs-number">.236</span>    mybookstack.<span class="hljs-keyword">local</span>`</div></div>Ensure there's a space or a tab between the IP address and the hostname.
2. **Save and close** the file. In `nano`, you can do this by pressing `Ctrl + O`, `Enter` to save, and `Ctrl + X` to exit.
3. Now, you should be able to access `https://docs.natenetworks.com/books/project-notes/page/command-guide-to-backing-up-bookstack` using `http://mybookstack.local/books/project-notes/page/command-guide-to-backing-up-bookstack`.

### For Windows

1. **Open Notepad as Administrator**. You can do this by searching for Notepad in the Start menu, right-clicking on it, and selecting “Run as administrator”.
2. **Open the `hosts` file** located at `C:\Windows\System32\drivers\etc\hosts`.
3. **Add an entry** for the IP address and the desired hostname. For example:
    
    <div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md">lua</div></div>

1. <div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto">`<span class="hljs-number">192.168</span><span class="hljs-number">.1</span><span class="hljs-number">.236</span>    mybookstack.<span class="hljs-keyword">local</span>`</div></div>Make sure there’s a space or a tab between the IP address and the hostname.
2. **Save and close** the file.

After you update the `hosts` file, you might need to flush your DNS cache for the changes to take effect immediately. Here's how you can do it:

- **On Linux**, open a terminal and run:
    
    <div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md">bash</div></div>
- <div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto">`sudo systemctl restart nscd`</div></div>This command restarts the Name Service Cache Daemon, but note that not all distributions run `nscd` by default.
- **On macOS**, open a terminal and run:
    
    <div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md">bash</div></div>
- <div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto">`sudo killall -HUP mDNSResponder`</div></div>This command resets the DNS cache.
- **On Windows**, open Command Prompt as Administrator and run:
    
    <div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md">cmd</div></div>

- <div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto">`ipconfig /flushdns`</div></div>

Now, when you use `http://mybookstack.local/books/project-notes/page/command-guide-to-backing-up-bookstack` in your browser, it should resolve to `https://docs.natenetworks.com/books/project-notes/page/command-guide-to-backing-up-bookstack` via the local hostname you set.

### Using the Computer's Hostname

If you prefer to use the computer's hostname (assuming the computer hosting the BookStack instance has a name like `bookstack-server`), you can simply map the hostname to the IP address in the same way. However, if you want the hostname to be recognized by other devices in your network without editing each device's `hosts` file, you'd typically need to configure this on your DNS server or router, which might support local DNS configurations. This process varies significantly depending on the router or DNS server software, so you'll need to refer to the specific instructions for your device or software.