Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)
edited by

The nslookup is used for network administration command-line tool which is available for many computers operating systems to query the Domain Name System and obtain domain name or an IP address mapping or to find any other specific DNS record.

The nslookup returns an endpoint(s) of this URL. But if I need to get some intermediate URL/IP, how can I do it?

For eg. If www.example.com is hosted on two instances on the AWS behind an ELB(Elastic load balancer), then

nslookup www.example.com

will return an IP of the 2 instances. Is there any method to get the DNS/IP of a load balancer?

I used the following function in C to resolve a URL to endpoints.

int getaddrinfo(const char *node, const char *service,

                const struct addrinfo *hints,

                struct addrinfo **res);

Is there any way to get my load balancer URL/IP in C?

1 Answer

0 votes
by (36.8k points)
edited by

You are getting confused by your IP addresses returned by nslookup. IP addresses are been actual addresses of the ELB, not your balanced instances.

your load balancer offers multiple addresses is basically to provide the fallback, cover different availability zones, etc. However, your IP addresses are not fixed and can change at any time, therefore use a provided DNS for the balancer instead whenever applicable.

Want to be a Linux expert? Come and join this Linux course

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jan 16, 2021 in Linux by supriya (36.8k points)
0 votes
1 answer
asked Apr 11, 2021 in Linux by dev_sk2311 (44.4k points)
0 votes
1 answer

Browse Categories

...