The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > IP Networking
Google UNIX.COM


IP Networking Questions involving TCP/IP, Routers, Hubs, Network protocols, etc go here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Getting IP Address of a client fayette High Level Programming 0 03-24-2006 10:27 AM
Retrieving IP address of Client from Server matrixmadhan High Level Programming 4 03-21-2006 01:06 AM
client IP address rolly UNIX for Dummies Questions & Answers 2 03-17-2005 05:14 PM
Client Ip Address ovingtond IP Networking 1 09-15-2003 02:45 PM
IP address of telnet client vtran4270 UNIX for Dummies Questions & Answers 1 09-12-2002 01:34 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-20-2007
Registered User
 

Join Date: Nov 2007
Posts: 3
Stumble this Post!
ip address of a client

A client(PC) connects to an unix server via terminal emulator.
How can I obtain that client's IP address?

The unix server is an old SVR4.2 (NCR) and the "who" command
does not show ip addresses.

I need a command or a shell script or a C/C++ program that will
help me to obtain the client's IP address.

Could anyone help me?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 11-20-2007
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 709
Stumble this Post!
Depends heavily on the terminal emulator. If it's one in the truest sense of the name, they'll be connecting as though on a directly connected terminal - so no IP. In that case, you'd need to look on the emulator to find the IP.

If you mean a terminal emulator like a piece of software on their client machine and they come in over IP and talk to something that doesn't use login. Find the relevant process and see what IP's it's got open connections to.

Or have I misunderstood the question?
Reply With Quote
  #3 (permalink)  
Old 11-21-2007
sysgate's Avatar
Unix based
 

Join Date: Nov 2006
Location: /root
Posts: 1,160
Stumble this Post!
If I haven't misunderstood it too, the client's IP will appear somewhere in the logs.
Reply With Quote
  #4 (permalink)  
Old 11-21-2007
Registered User
 

Join Date: Nov 2007
Posts: 3
Stumble this Post!
Thanks for your answer.

The client connects to the server with telnet. i.e. on the terminal emulator
window of the client the user sees "login:" and then logs on to the unix server.

Below is what "ps" command displays - note that there is no ip, but just the termid - pts/29:
ka2d2 28144 28142 0 Nov 20 pts/29 0:00 -sh

I want to find out the ip of the client from which the user "ka2d2" logged in the server.
Reply With Quote
  #5 (permalink)  
Old 11-21-2007
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 709
Stumble this Post!
Ah, telnet clarifies things a fair bit.
If you can find a version of lsof for it you can use this to find the IP. Otherwise, I like sysgate's point that the IP will be in the logs at time of connection. So you can run the output of who through a grep of the logs (for the username and a login message), then tail off the last entry to get the IP.
Reply With Quote
  #6 (permalink)  
Old 11-22-2007
Registered User
 

Join Date: Mar 2006
Location: Ahmedabad
Posts: 115
Stumble this Post!
wtmp or utmp commands

"last" command may be helpful to you
Reply With Quote
  #7 (permalink)  
Old 11-26-2007
Registered User
 

Join Date: Nov 2007
Posts: 3
Stumble this Post!
Sumitpandya and all others, thank you for your answers.

I found the solution with the "last" command.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:32 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