curl: (6) Could not resolve host: google.com; Name or service not known
Issues were:
- IPV6 enabled
- Wrong DNS server
Here is how I fixed it:
IPV6 Disabling
- Open Terminal
- Type
su
and enter to log in as the super user - Enter the root password
- Type
cd /etc/modprobe.d/
to change directory to/etc/modprobe.d/
- Type
vi disableipv6.conf
to create a new file there - Press
Esc + i
to insert data to file - Type
install ipv6 /bin/true
on the file to avoid loading IPV6 related modules - Type
Esc + :
and thenwq
for save and exit - Type
reboot
to restart fedora - After reboot open terminal and type
lsmod | grep ipv6
- If no result, it means you properly disabled IPV6
Add Google DNS server
- Open Terminal
- Type
su
and enter to log in as the super user - Enter the root password
- Type
cat /etc/resolv.conf
to check what DNS server your Fedora using. Mostly this will be your Modem IP address. - Now we have to Find a powerful DNS server. Luckily there is a open DNS server maintain by Google.
- Go to this page and find out what are the "Google Public DNS IP addresses"
- Today those are
8.8.8.8
and8.8.4.4
. But in future those may change. - Type
vi /etc/resolv.conf
to edit theresolv.conf
file - Press
Esc + i
for insert data to file - Comment all the things in the file by inserting # at the begin of the each line. Do not delete anything because can be useful in future.
Type below two lines in the file
nameserver 8.8.8.8
nameserver 8.8.4.4-Type
Esc + :
and thenwq
for save and exit- Now you are done and everything works fine (Not necessary to restart).
- But every time when you restart the computer your /etc/resolv.conf will be replaced by default. So I'll let you find a way to avoid that.
Here is my blog post about this:
http://codeketchup.blogspot.sg/2014/07/how-to-fix-curl-6-could-not-resolve.html
Curl (6) Could not resolve host: http
First off, in that other SO question, the ES node was a live one so its URL included https
.
Your localhost ist almost certainly not going to have https
so change it to http
:
curl -XPUT -H "Content-Type: application/json" \
http://localhost:9200/_all/_settings \
-d '{"index.blocks.read_only_allow_delete": null}'
Other than that, everything looks okay, provided that your ES is running.
When successful, you should receive a simple message:
{"acknowledged":true}
Edit: go with
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d "{\"index.blocks.read_only_allow_delete\": null}"
curl: (6) Could not resolve host: application
In my case, putting space after colon was wrong.
# Not work
curl -H Content-Type: application/json ~
# OK
curl -H Content-Type:application/json ~
Bash - Curl (6) couldn't resolve host issue
Try printing out the whole string/url. I believe it should have some problems in it.
Related Topics
How to Use Variables in Bash Sed Command, Specific Example
Sed In-Place Flag That Works Both on MAC (Bsd) and Linux
How to Link to a Specific Glibc Version
Adding a New Entry to the Path Variable in Zsh
What Is an Uninterruptible Process
What Does Localhost Means Inside a Docker Container
Automating Telnet Session Using Bash Scripts
How to Remove the Last Character of a File in Unix
How to Manage Perl Modules When Using a Package Manager
Use Expect in a Bash Script to Provide a Password to an Ssh Command
Allowed Characters in Linux Environment Variable Names
How to Join Multiple Lines of File Names into One With Custom Delimiter