Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 05-23-2002, 09:17 PM   #1
Registered: Feb 2002
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 === ip address).
Old 05-23-2002, 10:34 PM   #2
Registered: Apr 2002
Distribution: Mandrake 8.2
Posts: 43

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

   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
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");
} if ((h=gethostbyname(argv[1])) == NULL) { // get the host info
} 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
Registered: May 2002
Location: Toronto, ON, Canada
Distribution: Ubuntu, Debian, RedHat/CentOS
Posts: 624

Rep: Reputation: 31

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

Rep: Reputation: 30
Or you can use traceroute and even get all hops in between with hostnames and ip addresses
Old 05-25-2002, 05:51 AM   #6
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


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

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 > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:30 AM.

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