The nsswitch. You can use the below command line for configuration checking easily:. In case it is not listed like this, then open your file editor using the below command:.
This command will open the Vim text editor to make changes and set the files at the beginning for appropriate use. The Hosts files are beneficial to perform multiple tasks for domain names and IP addresses. It was the complete information on the Hosts file and how you can easily edit the Hosts file on Linux. This procedure is tried and tested on multiple Linux machines, but you have to carefully follow every step.
Simran works as a technical writer. Modifying your hosts file enables you to override the domain name system DNS for a domain on a specific machine. Modifying your hosts file causes your local machine to look directly at the Internet Protocol IP address that you specify.
Rackspace offers managed hosting solutions to assist with the handling of these resources. Modifying the hosts file involves adding two entries to it. Each entry contains the IP address to which you want the site to resolve and a version of the Internet address. For example, add the following two entries points, www. There's a single file on your computer that serves as a small gateway between you and the web. It's called the hosts file. If you need to block websites or create personalized web shortcuts on Linux, you can just add or tweak a few lines in the file.
In this post, we will discuss the hosts file in detail, along with comprehensive guides on how to edit and modify the hosts file securely. The hosts file is a plain text file that all operating systems use to translate hostnames also known as web addresses or URLs into IP addresses.
When you type in a hostname, such as wikipedia. If you open the hosts file, you'll quickly notice that it doesn't have the directory of the entire internet in there. Instead, there might be just a couple of lines and that's it.
What gives? This means that you can use the hosts file to add to what the DNS servers can't provide such as aliases for locations on your local network, which is otherwise only possible if you have a DNS server set up within your local network or override the IP addresses that your DNS servers would normally provide.
For example, if you ask for wikipedia. But if you wanted to block Wikipedia on that computer, you can add an entry in the hosts file that tells your computer that wikipedia. System administrators would periodically download updated copies of this file from a central repository. Even by the early s, it was almost impossible for admins to keep up as more and more hosts came online even when the network was still mostly limited to universities and research labs, so DNS was created.
Remembering VM IP addresses is a huge pain, and using the hosts file is perfect to manage that. As you can see, learning how to edit the Hosts file in Linux can be a useful skill, as it allows you to save you a lot of time later down the line. If you are on Windows, you can also edit the Hosts file and use it exactly the same way as stated above. If you are looking for a simple way to block websites , then these Chrome extensions may do a better job.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. John is a young technical professional with a passion for educating users on the best ways to use their technology.
He holds technical certifications covering topics ranging from computer hardware to cybersecurity to Linux system administration. You did not mention a very important use of the HOSTS file and that is blocking ads, trackers and other sketchy sites.
There are, in fact, pre-formatted HOSTS files available for download so that one does not have to manually enter thousands of sketchy IP addresses. It is my first line of defense. You've decided to leave a comment.
0コメント