Here's a little quicky program I wrote to display networked users
similar to the listu verb. It makes 2 important assumptions, 1),
networked users are nailed telnet, and 2) the pick port number is the
last three digits of the telnet host number. Maybe somebody will find it
SOURCE.IPS='' ; NEW.OUTPUT=''
OPEN 'PIBS' TO PIBS.FILE ELSE STOP 201,'PIBS'
EXECUTE '!netstat -n -a | grep "ESTABLISHED"' CAPTURING OUTPUT
HEAD ='Remote IP':SPACE(15):'Network connected Users':SPACE(10)
FOR LOOP1 = 1 TO NUM.LINES
LINE=TRIM(OUTPUT<LOOP1>) ; SOURCE.IP=FIELD(LINE,SPACE(1),5)
IF FIELD(SOURCE.IP,'.',1) NE 127 THEN
LOCATE SOURCE.IP IN SOURCE.IPS BY "AR" SETTING ATTR ELSE
INS SOURCE.IP BEFORE SOURCE.IPS<ATTR>
INS OUTPUT<LOOP1> BEFORE NEW.OUTPUT<ATTR>
FOR LOOP1 = 1 TO NUM.LINES
LINE=TRIM(OUTPUT<LOOP1>) ; HOST.IP=FIELD(LINE,SPACE(1),4)
READV LOC FROM PIBS.FILE,HOST.PORT,1 ELSE LOC='n/a'
PRINT SOURCE.IP "L#19 ":HOST.PORT:':':LOC "L#30 ":HOST.IP "L#20"
> Hey!, netstat -n -a | grep "192.168.4.42" is COOL!
> Doing netstat -n -a | grep "ESTABLISHED" shows you who's connected to
> your system (at least on my Aix box the ESTABLISHED is on the same line
> as the rest of it). If you want to see who is connected to a particular
> nic on your system (if you have more than one), doing:
> netstat -n -a | grep "(gateway)" where (gateway) is the ip address of
> the nic card shows who's in on that nic.
> In Patrick's example, the 192.168.4.31.telnet, on mine the "telnet" is
> replaced with the nailed telnet port number. So I'd have something like
> 192.168.4.31.10100, where 10100 is the host port number, typically
> associated with pick port 100. The number in the second column,
> 192.168.4.42.1301, does anybody know what the ".1301" means?
> I *LIKE* it! Thanks, Patrick!
>> who -q -m returned
>> bash-2.05a$ who -q -m
>> pa1371 (192.168.4.42)
>> The issue here is if you have name services running, the system will
>> report the domain name instead of the ip address. If this happens you
>> will have to do a reverse lookup.
>> I was playing with netstat and you could even figure out what D3/Aix
>> ip address they are connecting to.
>> bash-2.05a$ netstat -n -a | grep "192.168.4.42" | more
>> tcp4 0 0 192.168.4.31.telnet 192.168.4.42.1301
>>> Hi Guru's
>>> AIX server running multiple D3 virtual machines
>>> on the one physical machine.
>>> AIX server running single quad network card.
>>> Users connect to D3 using 4 unique ip addresses.
>>> Does anyone know of a way to retrieve the users ip address
>>> when they telnet into AIX.
>>> I need / would like to be able to automatically direct the login to a
>>> specific VM based on the ip address of the telnet
>>> Does anyone have any thoughts, I am fresh out of ideas.
>>> Regards Barry