Nikhil Gupta
Nikhil Gupta

Reputation: 35

How to add and resolve URL as we do with host name after adding it in /etc/hosts file

I have a web app running on machine with ip : 172.10.10.10.

The basic API call exposed by this app is : GET - http://172.10.10.10 and it will return a response as OK.

On another machine I added an entry in /etc/hosts file as below.

172.10.10.10 webserver1.com

With this the ping command is resolved successfully. e.g. : ping webserver1.com

Now I want to resolve the curl command as well.

e.g. : curl http://webserver1.com

Result : curl: (6) Could not resolve host: webserver1.com

How to achieve this for curl command with http url?

Upvotes: 0

Views: 805

Answers (1)

Azee77
Azee77

Reputation: 140

You can setup a DNS server and point your IP in /etc/resolv.conf There are many options out there in marker ( paid / free ) for a Local DSN Server dockerized and non-dockerized too.

Upvotes: 1

Related Questions