Go Back   The UNIX and Linux Forums > Special Forums > IP Networking
Search Forums:



IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-21-2005
Registered User
 

Join Date: Sep 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
how to retrieve IP address of a machine

hi

is there is any command that retrieves the IP address of a machine. Also is there any function in c that does the same.

thankx
Sponsored Links
    #2  
Old 10-21-2005
Perderabo's Avatar
Unix Daemon (Adminstrator Emeritus)
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,679
Thanks: 26
Thanked 237 Times in 147 Posts
Depends on the exact os and on how the box is configured. Also a box can have many ip addresses. With any fully qualified domain name, you can lookup the ip addresses. Can we assume that you know the fqdn?

One exception: the machine's ip address is 127.0.0.1. Every system can contact itself using this address.
Sponsored Links
    #3  
Old 10-21-2005
vertigo23's Avatar
Registered User
 

Join Date: Jul 2005
Location: SF, CA
Posts: 74
Thanks: 1
Thanked 0 Times in 0 Posts
While Perderabo is right about the myriad of configurations a given box can have, on just about every Unix I've dealt with, 'ifconfig -a' will list the configuration, including IP address, for all your network interfaces. Dunno about the C function.

Also, it's certainly possible to configure a machine with no loopback interface. On BSD for example, just run 'ifconfig lo0 delete'. Of course, that'll probably break a lot of stuff ;-)
    #4  
Old 10-21-2005
Perderabo's Avatar
Unix Daemon (Adminstrator Emeritus)
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,679
Thanks: 26
Thanked 237 Times in 147 Posts
Quote:
Originally Posted by vertigo23
While Perderabo is right about the myriad of configurations a given box can have, on just about every Unix I've dealt with, 'ifconfig -a' will list the configuration, including IP address, for all your network interfaces.

Code:
#
#
# uname -srm
HP-UX B.11.11 9000/800
# ifconfig -a
ifconfig: no such interface
#

Quote:
Originally Posted by vertigo23
Also, it's certainly possible to configure a machine with no loopback interface. On BSD for example, just run 'ifconfig lo0 delete'.
The rfcs state that address 127.0.0.1 must never leave the originating system. Deleting the loopback interface will cause packets addressed to the loopback address to generate an error and this error constitutes a "contact". ;-)
Sponsored Links
    #5  
Old 11-01-2005
Registered User
 

Join Date: Nov 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
show windows ip address

ipconfig/all
Sponsored Links
    #6  
Old 11-02-2005
Registered User
 

Join Date: Aug 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
"ipconfig -an"
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
IP address of machine harneet2004us UNIX for Advanced & Expert Users 3 04-16-2008 04:54 PM
Getting Unix machine IP address asutoshch Shell Programming and Scripting 6 04-30-2006 08:14 AM
retrieve IP of local machine mridula Programming 1 01-23-2006 12:11 AM
How to get IP Address of machine? Ahsan Programming 7 10-24-2003 11:16 AM
Changing Machine IP address kkinnon UNIX for Advanced & Expert Users 7 08-27-2002 02:17 PM



All times are GMT -4. The time now is 11:33 PM.