Get the domain name from IP address

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am using the following commands to get the domain name using the IP address
dig -x IPaddress
But it gives me some host names like ns1 etc. Is there any bash command that can give the actual domain name?
ip url
add a comment |Â
up vote
0
down vote
favorite
I am using the following commands to get the domain name using the IP address
dig -x IPaddress
But it gives me some host names like ns1 etc. Is there any bash command that can give the actual domain name?
ip url
Can you show us what you get?
â ctrl-alt-delor
May 18 at 15:14
And what you expected.
â ctrl-alt-delor
May 18 at 15:25
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using the following commands to get the domain name using the IP address
dig -x IPaddress
But it gives me some host names like ns1 etc. Is there any bash command that can give the actual domain name?
ip url
I am using the following commands to get the domain name using the IP address
dig -x IPaddress
But it gives me some host names like ns1 etc. Is there any bash command that can give the actual domain name?
ip url
edited May 18 at 15:41
Andy Dalton
4,7561520
4,7561520
asked May 18 at 14:59
Ricky mem
102
102
Can you show us what you get?
â ctrl-alt-delor
May 18 at 15:14
And what you expected.
â ctrl-alt-delor
May 18 at 15:25
add a comment |Â
Can you show us what you get?
â ctrl-alt-delor
May 18 at 15:14
And what you expected.
â ctrl-alt-delor
May 18 at 15:25
Can you show us what you get?
â ctrl-alt-delor
May 18 at 15:14
Can you show us what you get?
â ctrl-alt-delor
May 18 at 15:14
And what you expected.
â ctrl-alt-delor
May 18 at 15:25
And what you expected.
â ctrl-alt-delor
May 18 at 15:25
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
Using the +short option of dig you can get only the dns name.
dig -x 8.8.8.8 +short | awk -F '.' 'print $2"."$3'
There's probably a nicer way to reassemble it with awk Or just return the DNS Domain.
Have a read through the QUERY OPTIONS in man dig
add a comment |Â
up vote
1
down vote
When I do it I get something like this
dig +short -x $(dig +short example.com)
I get
host-198-51-100-0.as13285.net.
This is not the original domain name, because the domain name system has no easy way to look it up, as the real name is not registered in the database, however the one that was returned was. It would be to expensive to ask every DNS server in the world.
In addition there is a many to one relationship. Each IP can have many domain names (sometimes a domain name has many IP addresses, used for load balancing).
There is no need to ask every DNS server in the world. The domain name system has a way to look it up, and it's not more complicated than a forward lookup. In fact, it's very similar: instead of looking up, say,google-public-dns-b.google.com, the PTR record for the domain name4.4.8.8.in-addr.arpais searched hierarchically starting fromarpa.
â Johan Myréen
May 18 at 16:03
@Yes sorry If I suggested that it can not be done, I only mean that It can not be done, if it is not entered into the database. Searching the world is what would be needed to do it in reverse, but we don't have to do this, as sometimes there reverse lookup is added to the database.
â ctrl-alt-delor
May 18 at 16:32
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Using the +short option of dig you can get only the dns name.
dig -x 8.8.8.8 +short | awk -F '.' 'print $2"."$3'
There's probably a nicer way to reassemble it with awk Or just return the DNS Domain.
Have a read through the QUERY OPTIONS in man dig
add a comment |Â
up vote
1
down vote
accepted
Using the +short option of dig you can get only the dns name.
dig -x 8.8.8.8 +short | awk -F '.' 'print $2"."$3'
There's probably a nicer way to reassemble it with awk Or just return the DNS Domain.
Have a read through the QUERY OPTIONS in man dig
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Using the +short option of dig you can get only the dns name.
dig -x 8.8.8.8 +short | awk -F '.' 'print $2"."$3'
There's probably a nicer way to reassemble it with awk Or just return the DNS Domain.
Have a read through the QUERY OPTIONS in man dig
Using the +short option of dig you can get only the dns name.
dig -x 8.8.8.8 +short | awk -F '.' 'print $2"."$3'
There's probably a nicer way to reassemble it with awk Or just return the DNS Domain.
Have a read through the QUERY OPTIONS in man dig
answered May 18 at 15:17
Sir_Scofferoff
33623
33623
add a comment |Â
add a comment |Â
up vote
1
down vote
When I do it I get something like this
dig +short -x $(dig +short example.com)
I get
host-198-51-100-0.as13285.net.
This is not the original domain name, because the domain name system has no easy way to look it up, as the real name is not registered in the database, however the one that was returned was. It would be to expensive to ask every DNS server in the world.
In addition there is a many to one relationship. Each IP can have many domain names (sometimes a domain name has many IP addresses, used for load balancing).
There is no need to ask every DNS server in the world. The domain name system has a way to look it up, and it's not more complicated than a forward lookup. In fact, it's very similar: instead of looking up, say,google-public-dns-b.google.com, the PTR record for the domain name4.4.8.8.in-addr.arpais searched hierarchically starting fromarpa.
â Johan Myréen
May 18 at 16:03
@Yes sorry If I suggested that it can not be done, I only mean that It can not be done, if it is not entered into the database. Searching the world is what would be needed to do it in reverse, but we don't have to do this, as sometimes there reverse lookup is added to the database.
â ctrl-alt-delor
May 18 at 16:32
add a comment |Â
up vote
1
down vote
When I do it I get something like this
dig +short -x $(dig +short example.com)
I get
host-198-51-100-0.as13285.net.
This is not the original domain name, because the domain name system has no easy way to look it up, as the real name is not registered in the database, however the one that was returned was. It would be to expensive to ask every DNS server in the world.
In addition there is a many to one relationship. Each IP can have many domain names (sometimes a domain name has many IP addresses, used for load balancing).
There is no need to ask every DNS server in the world. The domain name system has a way to look it up, and it's not more complicated than a forward lookup. In fact, it's very similar: instead of looking up, say,google-public-dns-b.google.com, the PTR record for the domain name4.4.8.8.in-addr.arpais searched hierarchically starting fromarpa.
â Johan Myréen
May 18 at 16:03
@Yes sorry If I suggested that it can not be done, I only mean that It can not be done, if it is not entered into the database. Searching the world is what would be needed to do it in reverse, but we don't have to do this, as sometimes there reverse lookup is added to the database.
â ctrl-alt-delor
May 18 at 16:32
add a comment |Â
up vote
1
down vote
up vote
1
down vote
When I do it I get something like this
dig +short -x $(dig +short example.com)
I get
host-198-51-100-0.as13285.net.
This is not the original domain name, because the domain name system has no easy way to look it up, as the real name is not registered in the database, however the one that was returned was. It would be to expensive to ask every DNS server in the world.
In addition there is a many to one relationship. Each IP can have many domain names (sometimes a domain name has many IP addresses, used for load balancing).
When I do it I get something like this
dig +short -x $(dig +short example.com)
I get
host-198-51-100-0.as13285.net.
This is not the original domain name, because the domain name system has no easy way to look it up, as the real name is not registered in the database, however the one that was returned was. It would be to expensive to ask every DNS server in the world.
In addition there is a many to one relationship. Each IP can have many domain names (sometimes a domain name has many IP addresses, used for load balancing).
answered May 18 at 15:25
ctrl-alt-delor
8,75831947
8,75831947
There is no need to ask every DNS server in the world. The domain name system has a way to look it up, and it's not more complicated than a forward lookup. In fact, it's very similar: instead of looking up, say,google-public-dns-b.google.com, the PTR record for the domain name4.4.8.8.in-addr.arpais searched hierarchically starting fromarpa.
â Johan Myréen
May 18 at 16:03
@Yes sorry If I suggested that it can not be done, I only mean that It can not be done, if it is not entered into the database. Searching the world is what would be needed to do it in reverse, but we don't have to do this, as sometimes there reverse lookup is added to the database.
â ctrl-alt-delor
May 18 at 16:32
add a comment |Â
There is no need to ask every DNS server in the world. The domain name system has a way to look it up, and it's not more complicated than a forward lookup. In fact, it's very similar: instead of looking up, say,google-public-dns-b.google.com, the PTR record for the domain name4.4.8.8.in-addr.arpais searched hierarchically starting fromarpa.
â Johan Myréen
May 18 at 16:03
@Yes sorry If I suggested that it can not be done, I only mean that It can not be done, if it is not entered into the database. Searching the world is what would be needed to do it in reverse, but we don't have to do this, as sometimes there reverse lookup is added to the database.
â ctrl-alt-delor
May 18 at 16:32
There is no need to ask every DNS server in the world. The domain name system has a way to look it up, and it's not more complicated than a forward lookup. In fact, it's very similar: instead of looking up, say,
google-public-dns-b.google.com, the PTR record for the domain name 4.4.8.8.in-addr.arpa is searched hierarchically starting from arpa.â Johan Myréen
May 18 at 16:03
There is no need to ask every DNS server in the world. The domain name system has a way to look it up, and it's not more complicated than a forward lookup. In fact, it's very similar: instead of looking up, say,
google-public-dns-b.google.com, the PTR record for the domain name 4.4.8.8.in-addr.arpa is searched hierarchically starting from arpa.â Johan Myréen
May 18 at 16:03
@Yes sorry If I suggested that it can not be done, I only mean that It can not be done, if it is not entered into the database. Searching the world is what would be needed to do it in reverse, but we don't have to do this, as sometimes there reverse lookup is added to the database.
â ctrl-alt-delor
May 18 at 16:32
@Yes sorry If I suggested that it can not be done, I only mean that It can not be done, if it is not entered into the database. Searching the world is what would be needed to do it in reverse, but we don't have to do this, as sometimes there reverse lookup is added to the database.
â ctrl-alt-delor
May 18 at 16:32
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f444630%2fget-the-domain-name-from-ip-address%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Can you show us what you get?
â ctrl-alt-delor
May 18 at 15:14
And what you expected.
â ctrl-alt-delor
May 18 at 15:25