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.
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
I have installed sqlplus based on instruction given here
sqlplus 'username/password#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.100)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))'
This is giving me error
SQL*Plus: Release 11.2.0.4.0 Production on Fri Jul 10 16:10:38 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-21561: OID generation failed
Enter user-name:
What is the solution for this problem?
PS: I have already added hostname and hosts have already have value.
Append the name of your server to the hosts file.
If your /etc/hosts file looks like this:
127.0.0.1 localhost localhost.localdomain
It should be changed to:
127.0.0.1 localhost localhost.localdomain hostname
hostname can be obtained from the command "hostname".
If you are using Mac add local computer name to your 127.0.0.1 in /etc/hosts
It will be like
127.0.0.1 localhost <local_computer_name>
Way to find local computer name
System Preferences>Sharing(search for it if you cant find)
on the top you can see your local computer name
or you can use "hostname" command to get local computer name
This issue can also be cause by wrong permissions on the /etc/hosts file. If it is not readable for the Oracle uid, the errors will show.
Make sure your /etc/hosts is readable by everybody:
$ ls -l /etc/hosts
-rw-r--r-- 1 root system 7446 Mar 28 23:03 /etc/hosts
$
Answer obtained here.
1 - Get your hostname:
$ hostname
new-host
2 - Change the contents of /etc/hosts:
$ sudo cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
$ sudo nano /etc/hosts
$ sudo cat /etc/hosts
127.0.0.1 localhost new-host
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Hope this helps (:
look at /etc/sysconfig/network
change if needed the hostname
try this, don't put single quotes
sqlplus username/password#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.100)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))
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.