What's the difference between these lines:
::1 localhost
...and
127.0.0.1 localhost
in Windows hosts file?
Initially I had the line of the first kind in my hosts file and typing localhost in the browser led me to 127.0.0.1. Then I didn't use localhost prompt in the browser for some time, and when I needed to use it again it just didn't work. I changed the first line form the second one in my hosts file and it worked. Why could that happen?
::1 is IPv6.
127.0.0.1 is IPv4.
::1 is IPv6
127.0.0.1 is IPv4
I guess you disabled IPv6 in between tests?
The former, "::1" is IPv6 compressed syntax for the localhost. It is equivalent to 127.0.0.1. Did you disable IPv6 support in your OS or network adapter? Maybe that's why it stopped working.
I believe ::1 is the IPV6 notation of 127.0.0.1.
Related
I am trying to add new entry to the /etc/hosts in mac os (el Capitan)
how ever when I try to ping this entry , I am getting error of not resolved
there is no nsswitch file
what am I missing?
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
local.datafabric.io localhost
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
In the man page for the hosts file
man hosts
the syntax is explained:
IP_address canonical_hostname [aliases...]
so, if you want to add the name local.datafabric.io as an alias for localhost (127.0.0.1), the line should look like this:
127.0.0.1 localhost local.datafabric.io
man is your friend.
You will probably also want to flush your dnscache. The correct commands for that are depending on the actual version of MacOS.
Having an issue starting mongo using mongod --dbpath. I get the following error:
NETWORK [HostnameCanonicalizationWorker] Failed to obtain address information for hostname ##########: nodename nor servname provided, or not known
Host name only has latin characters. I've tried multiple networks, deleted all DNS entries, confirmed my /etc/hosts looks fine and now I'm at a standstill.
Here is my /etc/hosts:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
#::1 localhost
Try enabling the ipv6 and restart the mongod server
::1 localhost
I followed the answer in this JIRA ticket.
And here is my /etc/hosts file.
1 ##
2 # Host Database
3 #
4 # localhost is used to configure the loopback interface
5 # when the system is booting. Do not change this entry.
6 ##
7 # 127.0.0.1 localhost
8 127.0.0.1 localhost localhost.localdomain
9 255.255.255.255 broadcasthost
10 # ::1 localhost
change your HOSTNAME in /etc/sysconfig/network likes:
HOSTNAME=Steven
Then change your hostname in /etc/hosts:
127.0.0.1 localhost localhost.localdomain ...............
to
127.0.0.1 localhost Steven ...............
I've been able to block Youtube and Facebook sites, but not amazon or google. Why? Seems these two websites have something different. Thanks
Bernardos-MacBook-Pro:~ bernardo$ sudo nano /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 www.youtube.com
127.0.0.1 http://www.amazon.es
127.0.0.1 https://www.google.es
127.0.0.1 www.facebook.com
try it without http:// like on facebook and youtube
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
This is my /etc/hosts file but it's really strange failure to ping and cannot resolve localhost.
It's work well like ping gonjay when I add
127.0.0.1 gonjay
to my hosts file.
I fixed it by making sure that hosts file used Unix line endings (I used Sublime Text for this)
I have solved the problem by restoring my Hosts file (it was empty):
But before, you have to check your hosts file.
cat /etc/hosts
If nothing is shown, that means your hosts file is empty.
Then just copy and paste this over the existing hosts file then save it as plain text to restore it.
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
If your hosts file is not empty, your can try to delete it and add it again with this lines.
Probably will help for those who don't know how make Unix line endings
brew install dos2unix
sudo dos2unix -c mac /private/etc/hosts
That will convert your perfectly fine hosts file to UNIX encoding.
Within the /etc/hosts file you can block traffic via
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
# Block Adobe Activation
127.0.0.1 activate.adobe.com
127.0.0.1 practivate.adobe.com
127.0.0.1 ereg.adobe.com
127.0.0.1 activate.wip3.adobe.com
127.0.0.1 wip3.adobe.com
127.0.0.1 3dns-3.adobe.com
127.0.0.1 3dns-2.adobe.com
127.0.0.1 adobe-dns.adobe.com
127.0.0.1 adobe-dns-2.adobe.com
127.0.0.1 adobe-dns-3.adobe.com
127.0.0.1 ereg.wip3.adobe.com
127.0.0.1 activate-sea.adobe.com
127.0.0.1 wwis-dubc1-vip60.adobe.com
127.0.0.1 activate-sjc0.adobe.com
127.0.0.1 hl2rcv.adobe.com
#127.0.0.1 reddit.com
#127.0.0.1 www.reddit.com
However I want to redirect these websites to another website I have online informing the user this is blocked content
You cannot redirect to a website per se - the only think you can try is to get the ip address the website is hosted on and if the server is set to handle the request, it will work. That means it's not going to work on shared servers that has one IP.
For more sophisticated redirect, you have to use other solution.
Instead of setting those IPs to 127.0.0.1 set them to the IP of the "Sorry, blocked" server