Difference between IP address and Domain Name - dns

I have some trouble to make a difference between IP address, FQDN, domain name...
Tell me I'm wrong but an IP address represent a computer (a machine).
And a domain name is an other representation of a an address ip, and to make the link between IP address and domain name, DNS is used.
But I saw some domain name which have many ip address, and some IP address which have many domain name linked. How is it possible ?
I'm really confused :s
Thx

An IP address, either version 4 or 6, is both an identifier and a locator (it shows how to reach a specific element connected to the Internet).
More specifically it is tied to an interface, and a computer can have more than one interfaces. In fact, yours always have at least 2 addresses because it has 2 interfaces by default: localhost (127.0.0.1) which maps to itself (so it is the same name everywhere) and some IP address given by your ISP because you have an Ethernet or a WiFi interface.
A name, hostname, domain name, Fully Qualified Domain Name are all identifiers for human consumption, computers mostly do not use them.
The DNS system and the nameservers participating in it, among other things, allows to map a given name to a set of IP addresses.
A server name can map to multiple IP addresses for both fail over and load balancing: heavily used resources are split between many different servers with all their own IP address (there are ways also to make multiple servers all appear under the same IP everywhere, this is called IP anycasting).
As for "some ip adress which have many domain name linked." you will need to explain yourself a little more. Where do you see that? In the DNS, the PTR records allows you to map one IP address to one name, this is seldom used but it exists, and you have multiple IP addresses in multiple PTR records that all maps to one given name, but this is very little impact in real life.

Related

How to point single subdomain to same server with two IP address

For example, I've a server hosted at my home with 2 NICs for redundancy obviously.
NIC1 has been assigned with the public IP 103.204.82.22 from ISP1
NIC2 has been assigned with the public IP 144.110.12.64 from ISP2
I can access the server with both IP as usual.
Now, I have a domain acme.com. I've created a subdomain server.acme.com. I want to point server.acme.com to both the IPs so that in case one ISP fails to provide connectivity my server still remains online with the other one.
I've already tried with A and CNAME records. But it isn't working. It's working with A record if I use only one IP for the subdomain.
Can anyone tell me what and how can I point both the IPs to the single subdomain?
Thanks in advance
What you are describing is called DNS round robin, but that won't give you your expected outcome.
Anything you do with DNS if one ISP connection is down, traffic will still go there.
You may have your terminology mixed up a little to start with.
in this case, I suspect you really mean that server.acme.com is a host record, rather than a subdomain. (A subdomain would mean that the server address would be at servername.server.acme.com)
If you create an A record, and put both IP addresses in, and keep the TTL (time to live) short, then when a client wants to contact your machine it will randomly pick one of the addresses. If that address is unavailable, it will move on to the next. If that address stops working, it will keep trying it for the 'TTL' time.
Presuming that the IP addresses don't change, which would be a different problem altogether, then this provide basic load balancing and failover to both connections.
Amazon provide a more advanced type of DNS, that will actively monitor your connections and only provide responses that are live. - https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html

Two hostnames sharing the same IP

I noticed that one of Google's mail servers (alt4.aspmx.l.google.com) points to 74.125.200.26, but when I do a reverse DNS lookup on that IP I see that the hostname associated with it is sa-in-f26.1e100.net. My limited understanding of DNS is that when you have a situation like that, one hostname is an alias of the other, but that's not the case here.
My initial goal was making a Python program that given an IP address and a hostname, returns a boolean answer indicating whether the IP belongs to a mail server of that domain. The algorithm I implemented used dig to search all mail servers of a domain and then tried to match any of them to the hostname associated with the given IP (which I found using dig -x). My program fails with the case I mentioned before. What am I missing?
Sorry for my bad english. Thanks!
Many services can run on one server/ipaddress, and many hostnames can resolve to one IP address. In the other direction, one ip address will most often resolve to only one hostname (if it has PTR record at all), and the name will very often be something generic like ip-xx-yy-zz-qq.networkcarrier.net (so unrelated to any of the services that are legitimately running on that server).
Depending on the purpose of your check, perhaps you can just test if the hostname A record points to the required IP address (because your initial requirement is flawed: ip addresses do not belong to domains, they belong to network providers).
(Still, for some purposes, most notably as anti spam measure, there is a use case for checking if ip address resolves to some particular hostname.)

List of IP address for a host

We could see multiple ip addresses for a single host like facebook, google etc.
My question is why a host maintains so many ip addresses ? what is the purpose for it? Does it wont overlap with any other Public addresses.
The purpose is to distribuite the work load on different datacenter on different geographical areas. They use a single domain name (like facebook.com) to hide a big network of datacenter ready to reply to requests. The real host to which you will be connected is decided dynamically based on your position and the load of the different datacenter.

nslookup not returning all ip addresses for host

I'm working on a program that tracks when search engines cannot find important files on my server.
From my computer I typed:
nslookup google.com
and I received 11 IP addresses in return all beginning with 74.125.226
I then tried:
dig google.com
and I still receive the same IP addresses.
When I navigate to here through searching: http://www.iplists.com/google.txt, the number of IP addresses is greater than 10 and that list includes ones starting with 64.249 which also appears in my server log.
Am I using the wrong linux tools to find every IP address associated with google? If so, what tools should I use?
I want to generate the IP address database myself rather than rely on someone's post of IP addresses just in case IP addresses are updated in the future.
The keyword here is GeoDNS: When website/service has many servers around the world (with the main purpose of providing the lowest possible latency to user requests), using GeoDNS it can respond with different IP addresses to DNS queries for the same hostname, based on the locaton of the DNS client that is making the query (of course it will try to respond with the IP address of the closest server).
Basically, there is no way you can retrieve all possible addresses just by querying DNS from one location. Also, google can add/remove/change addresses/servers on daily basis so you probably can never have the definite list (unless google publishes it somewhere).
The real-time example, this might help you:
https://www.whatsmydns.net/#A/www.google.com
Additional reading:
What is the difference between Anycast and GeoDNS / GeoIP wrt HA?

Ip address for my computer and the Ip of the server that I am linked to

Thank you in advance for someone who answers this question. I used javascript to find out the ip address in my computer, the code is as following
function getip(json){
alert(json.ip); // alerts the ip address
}
I get one ip address which say 123.32.11.1
However when check my ip address on my mac it says I am connecting to xxx and the ip address is 10.1.223.123
I am confused about what's the two different ip address means.
If I am trying to use ip address to identify my geolocation I will need to use the first one. Does that mean only the first ip address means where I am located?
Thank you in advance.
Your IP address is probably 123.32.11.1. Any address in the range 10.x.x.x is a private IP address; sometimes used by your computer for internal business (see here).
Another option is that you have 2 IP addresses by virtue of being connected on 2 separate networks.

Resources