We may see the need of having to edit sometime Hosts file from your computer to create a mapping between an IP address and a domain name.
Today it is not very usual to deal with the Host file because there are DNS servers and when we write in any browser a domain name servers DNS are responsible for the correct IP address.
However even it used, for example, block a website or block some content as it can be advertising.
To review the changes in the Hosting server while another server DNS point to the solution is to edit the Hosts file .
Host OS X file is a file where the system stores the correspondence between Internet domain names and IP addresses. Until it began to use servers DNS , the Host file was responsible for resolving domain names. Today you do not need but know how to modify the Host file in OS X may be interesting. For example, we may be useful to block access to certain web pages.
In OS X a way to edit the Host file is to use Terminal. We launched by the terminal and the order
sudo pico /private/etc/hosts
With Pico we will be able to make the appropriate changes. It is not difficult but of course remember as editor and launch the file path in OS X is in the directory / private / etc / hosts. So, is a simpler method? Yes, thanks to a preference pane that you can install.
Hosts is a small application that is installed in the System Preferences panel in OS X and gives us access to Host OS X file . From it we can add the IP address, the server name (hostname) and select whether or not we want to be active modification. Everything very visual way.
In this guide we will guide users of Mac OS X (Mac OS now) so you can edit the host file on their computers.
Hosts File Edit from the Terminal
Mac OS X has a tool called Terminal which is nothing more than a command console where we can perform operations by typing command lines.
Although no previous experience with the command line and new users may seem somewhat complicated to use, it is how fast and effective editing the hosts file on Mac.
To open the terminal we can perform a Spotlight search and write Terminal
Or search inside the folder Utilities in Applications.
Once the application starts, you will see a window where the name of your machine appears and where we have to copy the following line of text and press Enter :
sudo nano /private/etc/hosts
We will ask the administrator password , which is usually the same as we when the computer starts if we are managers. If not we talk to the computer administrator.
Important! The password characters are not displayed while write, in fact not even move the courses, but it is not an error. We must enter the password and press Enter on the keyboard.
If all goes well we will see in the window ends something like this:
To move through this window you can use the arrow keys until you reach a blank line and add the IP server followed by the domain you want. Would be something like:
To save the changes we need to use the key combination Ctrl + O (letter O is not a zero) followed by Enter .
To close the window we will use the key combination Control + X
Finally, we can clear the cache by adding the following command in the terminal and pressing Enter .
And we can close the terminal window, but if you want to check that everything went well you can use to make a ping and see that it is pointing to the correct IP address.
It’s simple, simply type ping followed by the domain. This will return an IP address. If you have changed it is that everything is fine. If not we repeat the process.
Locate the Hosts file and edit it from the Finder
Depending on the version of Mac OS X being used can vary, but for some time we can find in the following path:
The problem is that the directory private is a hidden file, so if we find browsing the Finder will not locate it.
If we want to access the folder we can use the function Go to Folder … offered by the Mac OS X Finder from the menu Go .
This will open a window where you can write / private / etc which will lead us directly to the folder where the Hosts file is hosted.
Once we located we can drag the desktop to make a copy of it that we can edit. If we try to edit from the folder itself where it is, we tell you that we do not have sufficient permissions.
Once there you can edit it open with TEXEDIT, for example.
How to edit the Hosts file is very simple, we must put an IP address, leave a blank and add the domain name:
XX.XXX.XXX.XXX ieenews.com www.Tudominio.com
In the Hosts file would look like this:
Once edited and saved must save the changes and move back to the folder / private / etc .
In doing so we will ask you to identify us as our computer administrators password
We also tell you that there is already a file named hosts and if we want to save both files, stop the transfer or replace. Will click Replace .
Only after that will we enter our password to transfer the edited hosts file to the folder / private / etc and that the changes we have made are applied.
You can use the Terminal to make a ping and check that you return the IP address you have added as we indicated in the previous step.
Do not forget to remove the changes to the Hosts file when they are no longer necessary lest you cause problems in the future.
Editing the Hosts file in Windows 10
One of the main “problems” that occurs when making a change hosting provider is that before deregister the old provider we must ensure that our web page loads and works well under the new provider .
There is a way “local” to do so only on the computer that changes will be made to indicate you can see there the content uploaded to the new server, without harming what is currently displayed on the Internet.
Steps to follow:
Suppose we are with another provider and want to migrate our web Hosting to see how it would look here, but without changing our domain dns , otherwise this would cease to point to the old provider. And if we have raised the evil web servers Hosting this would be displayed with failures resulting from having migrated wrong. Or even if we have created in “local” in our PC and want to upload it to the server to see how it would be published on the network.
Locate Server IP
First of all we have to do is locate the server IP as the need to put in the host file Window10 .
To do this, in cPanel , we should go to the block “Domains” and access the “Editor single zone” or “Advanced Editor zone”.
No matter which of the two we select areas, since in any of them you can see which is the IP Hosting on the bottom.
The IP Hosting will we see repeated on several occasions by the bottom:
All right! We know the IP of our web hosting.
Locate the Hosts file in Windows 10
This is where there are often problems sometimes not in itself to locate this file, but because it does not usually make the changes correctly.
In Windows 10 the file can be located in the following path:
C: \ Windows \ System32 \ drivers \ etc
But … What is the HOSTS file?
We can take this file as an address book. When entering an address in the browser, the system searches the hosts file to check whether the IP to which will access is included . If it is, it makes the call and load the site. If not, you would ask your ISP. Not being our web site with a domain, the ISP does not know our address and not the page load is performed. That is, the hosts file lets you override the DNS for a domain on the machine on which it ‘s set.
Edit the Hosts file in Windows 10
To do this, click on the start menu below entirely to the left of Windows 10 and type “Notepad” .
Then, we click on the right mouse button on the application site and click on “Run as Administrator”(you can ask our user password or accept that we want to make changes to the computer).
Then in notepad, click on “File” -> “Open” .
We look for the host file in the path:
C: \ Windows \ System32 \ drivers \ etc
Default not appear to us, so in the dropdown on the right we have to give “All files” .
Select the hosts file and give it to “Open” ; right below “All files”.
Once completely-open we -down add the IP that we indicated before and nuestrodominio.com (replacing the corresponding nuestrodominio.com) put it first and then without www www (leaving a blank space between each item). As shown in the following screenshot:
The order would be:
[IP of our domain] blank [domain name without www] blank [domain name www]
And finally, click on “File” -> “Save” to save the change made . We tried to reload the page in your web browser and that’s it.
In this way we will have our hosts file edited in the correct way to load our website “local” form under the Hosting server.
To verify that your computer’s IP pointing just introduced can make a simple operation called Ping ( Packet Internet Grouper ). With this action we can check the status of the connection through request packets question and answer to determine whether a particular IP is accessible from your Internet connection.
How to Ping in Windows 10?
To ping in Windows 10, click on the start menu below all left, we write “cmd and click on” Command Prompt “.
- 1 Hosts File Edit from the Terminal
- 2 Locate the Hosts file and edit it from the Finder
- 3 Editing the Hosts file in Windows 10
- 4 Locate Server IP
- 5 Locate the Hosts file in Windows 10
- 6 Edit the Hosts file in Windows 10
- 7 Check IP