Fix Hostname Not Resolved to an IP Address on site server
Here's how to Fix Hostname Not Resolved to an IP Address on site server.
i. Here are some useful pro tips for configuring the /etc/hosts file on a server:
- List local domain names not resolvable via DNS to facilitate testing. For example:
```
127.0.0.1 localhost test.mydomain.com
```
- Redirect requests for domains you don't want accessed to localhost, blocking access. For example:
```
127.0.0.1 blockedsite.com
```
- For web servers, map multiple domains/hostnames to the same IP address to support name-based virtual hosts. For example:
```
192.168.1.100 domain1.com www.domain1.com
192.168.1.100 domain2.com www.domain2.com
```
- Add entries mapping domain names to internal IP addresses to facilitate access to internal servers by name rather than remembering IP addresses.
- For load balanced services, add entries mapping a canonical name to multiple IPs to facilitate scaling out. For example:
```
192.168.1.101 appserver1.internal.com
192.168.1.102 appserver2.internal.com
192.168.1.103 appserver3.internal.com
```
- Clearly comment all entries added for maintainability and readability by other admins.
The key is to leverage /etc/hosts for local convenience, access control, and facilitating network architecture - not circumventing DNS for public-facing services.
ii. Registering private name servers with your domain registrar involves creating custom or private name servers associated with your domain. This allows you to use your own domain name as the nameserver for your website instead of relying on the default nameservers provided by your hosting provider. Here are general steps on how to register private name servers with a registrar:
### Step 1: Gather Information
1. **Identify Your Server IP Addresses:**
- Determine the IP addresses of the servers that will act as your custom name servers (e.g., ns1.yourdomain.com and ns2.yourdomain.com).
### Step 2: Access Registrar Account
1. **Log In to Your Registrar Account:**
- Go to the website of your domain registrar and log in to your account.
### Step 3: Find Name Server Settings
1. **Locate DNS or Name Server Settings:**
- Navigate to the DNS or Name Server settings section of your registrar's control panel.
### Step 4: Add Custom Name Servers
1. **Add Custom Name Servers:**
- Look for an option to add or register custom name servers.
- Provide the names of your custom name servers (e.g., ns1.yourdomain.com and ns2.yourdomain.com) and their corresponding IP addresses.
### Step 5: Save Changes
1. **Save Changes:**
- After entering the information, save the changes or update the name server settings.
### Step 6: Verify Configuration
1. **Check DNS Propagation:**
- DNS changes may take some time to propagate across the internet. You can use online tools to check the status of your DNS changes and verify that your custom name servers are resolving to the correct IP addresses.
### Example Scenario:
Let's assume you have the following information:
- **Domain:** yourdomain.com
- **Custom Name Servers:** ns1.yourdomain.com (IP: 123.456.789.1) and ns2.yourdomain.com (IP: 123.456.789.2)
Here's how you might input this information:
1. Log in to your registrar account.
2. Navigate to the DNS or Name Server settings.
3. Add custom name servers:
- Name Server 1: ns1.yourdomain.com (IP: 123.456.789.1)
- Name Server 2: ns2.yourdomain.com (IP: 123.456.789.2)
4. Save changes.
After completing these steps, your domain will be configured to use the custom name servers you specified. Keep in mind that DNS changes may take some time to propagate, so it might not take effect immediately.