The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SCO get MAC Address jcarter2333 High Level Programming 11 02-08-2007 05:51 AM
How to Achive IP address through MAC(Ethernet) address krishnacins IP Networking 3 08-29-2005 05:45 PM
ce0 and ce1 have the same mac address BG_JrAdmin SUN Solaris 2 07-08-2005 04:30 PM
network address and broadcast address? pnxi UNIX for Dummies Questions & Answers 7 11-10-2003 07:29 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-12-2002
Registered User
 

Join Date: Aug 2001
Posts: 60
IP address

Hi All,

I logged into to a unix machine, from $ prompt what should I type to get IP address of that machine?

Thanks inadvance,

Krishna
Forum Sponsor
  #2 (permalink)  
Old 03-12-2002
Registered User
 

Join Date: Feb 2002
Location: Central Ohio
Posts: 3
netstat is a good start. I don't know much about what it will tell you or the options running it. Try it and see. Hopefully someone else will have more information for you.
  #3 (permalink)  
Old 03-12-2002
LivinFree's Avatar
Goober Extraordinaire
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
Try typing ifconfig, then enter.
If it doesn't find that command, you'll have to specify the whole path. For example, you might have to enter "/sbin/ifconfig".
You should get something similar to the following:
Quote:
eth0 Link encap:Ethernet HWaddr 00:60:97:C7:9F:72
inet addr:10.2.9.122 Bcast:10.2.255.255 Mask:255.255.0.0
UP BROADCAST NOTRAILERS RUNNING MTU:1500 Metric:1
RX packets:4223201 errors:0 dropped:0 overruns:0 frame:0
TX packets:49783 errors:0 dropped:0 overruns:0 carrier:1
collisions:355 txqueuelen:100
Interrupt:9 Base address:0xfe80

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
You'll notice that there are two entries - one for each interface. The first one is eth0, my primary (and only) ethernet interface. In that block, a field named "inet addr" shows the ip address, in my case, 10.2.9.122.
The second block is lo, the loopback interface. It doesn't physically exist, but nearly every system should have one. It's address will always be 127.0.0.1.
Note that there may be more than one "real" interface. A single machine can technically have 255 (i think) IP addresses assigned to it.

By the way, your interface names may vary. This one is from a Linux box connected via ethernet.
  #4 (permalink)  
Old 03-13-2002
Registered User
 

Join Date: Mar 2002
Location: MILANO (ITALY)
Posts: 6
The easiest thing is:
uname -a and you will see the name of your machine
then ping namemachine
or grep namemachine /etc/hosts
That's it!
  #5 (permalink)  
Old 03-13-2002
Registered User
 

Join Date: Feb 2002
Location: www.freebsdforums.org
Posts: 67
You could also do it in 2 steps

#1 Type hostname
#2 nslookup (hit enter, then type the hostname or fully qualified hostname from #1)
__________________
FreeBSD: The best free Unix on this planet IMHO!!

FreeBSD Forums
www.freebsdforums.org
  #6 (permalink)  
Old 03-13-2002
auswipe's Avatar
Registered User
 

Join Date: Nov 2001
Location: Wide Awake Wylie, Texas
Posts: 536
Sometimes an `ifconfig` with no switches is not enough.

On my OpenBSD2.9 machine I have to either specify the individual nic or the "-a" switch to display all adapters. Oddly enough, the lone `ifconfig` is sufficient under FreeBSD4.5 to display all adapters and settings.
__________________
Not quite as cool as all the other Kids...
  #7 (permalink)  
Old 03-14-2002
DPAI's Avatar
Registered User
 

Join Date: Jul 2001
Posts: 112
Yup thats right
SOlaris takes a option -a to ifconfig
but IRIX needs to be passed its network interface as the argument , no -a works with it

nslookup is a good option too

But i would rather prefer vi /etc/hosts
Google UNIX.COM
Closed Thread

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:38 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0