Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
19
rated 0 times [  19] [ 0]  / answers: 1 / hits: 13923  / 3 Years ago, tue, october 26, 2021, 7:00:29

For development purposes I want all DNS requests to the .dev TLD to forward to my own PC.



The hosts file does not suffice. I use multiple domains and also multiple subdomains. I would have to add a line for each combination.



I have read that a DNS forwarder like DNSmasq can be used to do the job (for example as described here). Also this software is already installed on Ubuntu 12.10.



The problem is that I fail to see how and where I should configure DNSmasq, i.e., where I should put this line:



address=/dev/127.0.0.1

More From » dns

 Answers
6

The complete standalone dnsmasq (DHCP and DNS server) is not installed by default in Ubuntu 12.04 and 12.10, but a package called dnsmasq-base is installed by default in Ubuntu Desktop 12.04 and 12.10. The dnsmasq-base package contains the dnsmasq binary and is used by NetworkManager.



To do what you want you will need to use dnsmasq as a caching DNS server. You need to:




  • Install dnsmasq
    sudo apt-get install dnsmasq

  • Change your network setting, so that your computer uses itself as it dns server.

  • Make the changes to the config files:



Create /etc/dnsmasq.d/dev-tld with these contents:



local=/dev/

address=/dev/127.0.0.5


The first command says *.dev requests can't be forwarded to your real DNS server. The second says *.dev resolves to 127.0.0.5 which is localhost.




  • Restart the dnsmasq service (not network-manager)


[#33496] Thursday, October 28, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hamostic

Total Points: 403
Total Questions: 142
Total Answers: 112

Location: Iceland
Member since Sat, Sep 17, 2022
2 Years ago
;