I'm having trouble getting a curl response from an external server. I am working on a debian server I did not set up and the external resource (www.example.com) has be configured to not receive ping requests.

The debian server accepts incoming traffic but should have its outgoing traffic limited to www.example.com by the network. Not sure how to test if it can reach www.example.com.

From the debian server I would like to curl an api on an external resource (www.example.com/api).

currently trying to curl like this

curl -X GET https://www.example.com/api/ -H 'Authorization: Token MY_SECRET'

responds with this:

curl: (6) Couldn't resolve host 'www.example.com'

I'm not very familiar with server configuration but my searches have been pointing to a resolv.conf configuration, but I can't figure out how to test that and haven't been able to find a clear enough example for someone will as little familiarity as I.

  • 1
    If a firewall, etc (on local machine or on router or ...) is blocking all traffic except to example.com then dns won't work - it will be blocked, unless you are using example.com as your nameserver as well. Go to another machine, do a nslookup on example.com, and put appropriate entries in /etc/hosts on your debian box – ivanivan Mar 30 '17 at 17:17
  • If www.example.com is a real resolvable name, and your resolver is not managed by a process which will overwrite manual changes (e.g. resolvconf), you can use google's easy-to-remember public DNS server: add the line nameserver as the first non-commented line in /etc/resolv.conf. It's good to be in the habit of keeping an unmodified copy of any configuration file you change. – user4556274 Mar 30 '17 at 17:18
  • @user4556274 that worked! thank you. My one remaining question is that the /etc/resolve.conf file has this at the top # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN Not sure where to actually add the change to make it permanent, resolveconf is a folder with a couple non-obvious-named files and no instructions if there's a process to restart once I make a change – Vague Space Mar 30 '17 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.