Title: Resolving Router DNS Issues with a Ubuntu 20.04 Server on Raspberry Pi
In this article, we will discuss a common issue faced when using a local network that includes a server running Ubuntu 20.04 on a Raspberry Pi. The server runs Apache to serve certain web pages on localhost (mainly dev/public...). However, the router DNS is causing problems, and we will provide a solution to this issue.
Understanding the Problem
When you try to access the web pages on your local network, you may encounter issues due to the router's DNS. The router might not be correctly resolving the domain names to the IP addresses of the devices on your network. As a result, you may not be able to access the web pages served by your Ubuntu server on Raspberry Pi.
Identifying the Problem
To identify if the router DNS is causing the issue, you can try accessing the web pages using the IP address instead of the domain name. If you can access the web pages using the IP address, it confirms that the router DNS is the cause of the problem.
Resolving the Problem
To resolve the router DNS issue, you can set a static IP address for your Raspberry Pi and configure the DNS settings on your router to point to the static IP address of your Raspberry Pi. Here's how you can do it:
-
Setting a Static IP Address on Raspberry Pi
Open the terminal on your Raspberry Pi and run the following commands:
sudo nano /etc/network/interfacesEdit the file and replace the DHCP-managed settings with static IP settings. Here's an example:
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.1Save and close the file, then restart the network service:
sudo service networking restart -
Configuring DNS Settings on Router
Log in to your router's administration interface and find the DNS settings. Add a new DNS server entry with the IP address of your Raspberry Pi (192.168.1.100 in this example). Save the changes and reboot the router.
Testing the Solution
Now, you should be able to access the web pages on your local network using the domain name. If you still face issues, try clearing your browser's DNS cache or use a different browser.
References
This article provides a solution to a common problem faced when using a local network that includes a server running Ubuntu 20.04 on a Raspberry Pi. By setting a static IP address for the Raspberry Pi and configuring the DNS settings on the router, you can resolve router DNS issues and access the web pages on your local network.