IP address translation?
I’m looking for a program or for some command that allow translating the domain name to IP address. For example, I want to enter the www.ars.com === 255.255.255.255(the ip address).
|
for an easy way to do it then do a
Code:
whois domainname.whatever |
/*
** getip.c -- a hostname lookup demo */ #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <netdb.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> int main(int argc, char *argv[]) { struct hostent *h; if (argc != 2) { // error check the command line fprintf(stderr,"usage: getip address\n"); exit(1); } if ((h=gethostbyname(argv[1])) == NULL) { // get the host info herror("gethostbyname"); exit(1); } printf("Host name : %s\n", h->h_name); printf("IP Address : %s\n", inet_ntoa(*((struct in_addr *)h->h_addr))); return 0; } I didnt write the code. I got it from a tutorial site about network programming. Beej's site or something like that. |
host 1.2.3.4
host www.example.com Will do both forward (domain name to IP) and reverse (IP to domain name) lookups. |
Or you can use traceroute www.hostname.com and even get all hops in between with hostnames and ip addresses
|
How about using either one of the programs nslookup, host or dig. -mk
|
All times are GMT -5. The time now is 11:13 PM. |