Operating System - HP-UX
1829104 Members
4183 Online
109986 Solutions
New Discussion

Multiple telnet/IP Addresses

 
SOLVED
Go to solution
Julio Yamawaki
Esteemed Contributor

Multiple telnet/IP Addresses

Hi,

I have an environment with two unix box in cluster with two packages.
What I need to know is, when I have these two packages in one single server and users telnet to packages, from what IP address this user is telneting (relocatable ipd address from package).
Is it possible?

Thanks.
10 REPLIES 10
Pete Randall
Outstanding Contributor

Re: Multiple telnet/IP Addresses

Julio,

The "who -R" command will tell you either the hostname or the IP address. I think in the case of telnet, you will get the hostname, which you can then do a nslookup on to get the IP.

Does that help?


Pete

Pete
Marvin Strong
Honored Contributor

Re: Multiple telnet/IP Addresses

if you want the relocateable address you can find that in the package control script usually under /etc/cmcluster/{pkgname}

Or just do an nslookup on the name they use to connect to the server that should also be the relocatable address.

If you want to know what address they are using if they telnet out from the box. The easiest way I can think of would be to telnet to another machine and do a who and see what it registers as.


Julio Yamawaki
Esteemed Contributor

Re: Multiple telnet/IP Addresses

Pete/Marvin:

Thanks for your responses.
The problem that I have is:
. I don't want to know the client IP address who telnet'd (who -R)
. I need to know to WHAT relocatable IP addres the client telnet'd, i.e., I have two packages in a box, user can telnet to IP1 or IP2, I need to know, after user is logged in, to what IP (IP1 or IP2) user telnet'd.

Thanks.
Steven E. Protter
Exalted Contributor

Re: Multiple telnet/IP Addresses

Shalom,

If you look at the arp command you will see a hostname/ip address along with a MAC address. This may be useful in identifying which node in the cluster the sessions are connecting too.

The bottom line on floating ip addresses is the users are not supposed to be able to identify which system the session is with.

In addition, floating ip addresses are really virtual ip addresses of the actual ip address assigned to the NIC. The actual traffic if measured on netstat -in traverses the primary ip address.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Marvin Strong
Honored Contributor

Re: Multiple telnet/IP Addresses

well if you know what address they are coming from, you can grep it out of

netstat -an

tcp 0 48 10.248.31.165.22 10.248.111.226.46906 ESTABLISHED

that is my current connection to a machine.

so with a combination of who, nslookup and netstat you can get the information.
Victor BERRIDGE
Honored Contributor

Re: Multiple telnet/IP Addresses

Hi Julio,

Have you tried filtering the output of netstat -a?

Just thoughts...


All the best
Victor
Julio Yamawaki
Esteemed Contributor

Re: Multiple telnet/IP Addresses

Hi,

Thanks for all that responded.
Victor, netstat -a | grep telnet|grep was the best approach, but I still can't find the correct connection, because user can connect in two or more ip addresses simultaneously.

Mel Burslan
Honored Contributor
Solution

Re: Multiple telnet/IP Addresses

This what I am going to suggest below can be put in a script but due to lack of time, I am not going to be able to do that, but the method is pretty simple

1. find the telnet connections you are interested from the output of the follwoing command

netstat -a | grep telnet
tcp 0 0 *.telnet *.* LISTEN
tcp 0 2 crt00.telnet mel01.52763 ESTABLISHED


here mel01 is my workstation and crt00 is the serviceguard package name I telnet into. It may also be an IP address

then use lsof to find the PID of the person's telnet session:

lsof -i tcp | grep 52763

(52763 port comes from the output of netstat command above)


output will look something like this

telnetd 7863 root 0u inet 0x5c8cd7c0 0t0 TCP crt00:telnet->mel01:52763 (ESTABLISHED)

and you may see multiple instances of the same line. The PID of interest to you is 7863

Hope this helps.

by the way, if you do not have lsof installed, you can get it from

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.77/
________________________________
UNIX because I majored in cryptology...
Julio Yamawaki
Esteemed Contributor

Re: Multiple telnet/IP Addresses

Hi,

Thanks for all.
Mel, lsof was the answer.

Julio Yamawaki
Esteemed Contributor

Re: Multiple telnet/IP Addresses

Teste lsof, ok!