LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 05-23-2002, 09:17 PM   #1
mikeshn
Member
 
Registered: Feb 2002
Distribution: Fedora Core 2
Posts: 586

Rep: Reputation: 30
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).
 
Old 05-23-2002, 10:34 PM   #2
JMC
Member
 
Registered: Apr 2002
Distribution: Mandrake 8.2
Posts: 43

Rep: Reputation: 15
for an easy way to do it then do a

Code:
   whois domainname.whatever
I have a c++ program on my puter somewhere that does what you are asking. I'll see if I can locate it and paste the code here.
 
Old 05-23-2002, 10:44 PM   #3
JMC
Member
 
Registered: Apr 2002
Distribution: Mandrake 8.2
Posts: 43

Rep: Reputation: 15
/*
** 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.
 
Old 05-24-2002, 12:41 PM   #4
sewer_monkey
Member
 
Registered: May 2002
Location: Toronto, ON, Canada
Distribution: Ubuntu, Debian, RedHat/CentOS
Posts: 610

Rep: Reputation: 30
host 1.2.3.4
host www.example.com

Will do both forward (domain name to IP) and reverse (IP to domain name) lookups.
 
Old 05-25-2002, 02:14 AM   #5
Noerr
Member
 
Registered: May 2002
Location: Dalec, HU
Distribution: Redhat 7.3
Posts: 696

Rep: Reputation: 30
Or you can use traceroute www.hostname.com and even get all hops in between with hostnames and ip addresses
 
Old 05-25-2002, 05:51 AM   #6
mikek147
Member
 
Registered: Mar 2002
Location: Elyria, Ohio
Distribution: Debian, Nothing else required
Posts: 141

Rep: Reputation: 15
How about using either one of the programs nslookup, host or dig. -mk
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 04:33 AM
Network Address Translation ashutoshsharma Linux - Networking 0 01-12-2005 07:06 AM
Network Address Translation for NFS not happening! Vincent_Vega Linux - Networking 4 01-09-2004 06:57 PM
translation? rebelcan Linux - General 1 07-28-2003 02:07 AM
"fast network address translation" kernel option dunkyb Linux - Networking 0 04-20-2003 06:42 PM


All times are GMT -5. The time now is 07:28 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration