How to temporarily override a DNS setting for a certain domain name to point to localhost?

5,211

What are we talking about here? A single host, a network, a dns server serving your domain?

I'm gonna go with single host:

echo '127.0.0.1 somehost.example.org' | sudo tee -a /etc/hosts

If you are in fact in a network then please add more information to your question.

Share:
5,211

Related videos on Youtube

Rajat Gupta
Author by

Rajat Gupta

A problem solver & enthusiastic programmer looking out for exciting work opportunities. Highly interested in building Android applications, Web development, & Server side coding involving (sql/ nosql) databases & APIs. I love solving problems, building efficient approaches & algorithms. To describe my strong points, I have pretty decent problem solving skills, fast learner & highly motivated & energetic person! Gained good experience in software development in the past 2 years working on numerous android & web development projects with companies like olready.in, twowaits.com, spactre.com. Selected among Top three finalists for LinkedIn MTV GetAJob Season 4 for Flipkart as Software Developer Intern among 50k candidates.

Updated on September 18, 2022

Comments

  • Rajat Gupta
    Rajat Gupta almost 2 years

    I need ubuntu to use a certain domain name to point to a localhost address temporarily. How could I confgure for that ?

  • Rajat Gupta
    Rajat Gupta over 10 years
    thanks I tried modifying the /etc/hosts file but it didn't had any effects even after restart..
  • mivk
    mivk over 9 years
    You may also need to ensure that the "hosts: " line in "/etc/nsswitch.conf" lists "files" before "dns". For example: hosts: files mdns4_minimal [NOTFOUND=return] wins dns mdns4