Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Getting user's on network's IP address?

by The Elite Noob (Sexton)
on Apr 28, 2011 at 22:49 UTC ( [id://901880]=perlquestion: print w/replies, xml ) Need Help??

The Elite Noob has asked for the wisdom of the Perl Monks concerning the following question:

Hello!

So, I'm writing this script. However I'm facing a problem. So say I have a list of users on my network. Now all the IP address are dynamically assigned. However the user-names are constant. Now i need a way to get the IP address of a certain user on the network.

Say you have users and IP address.:

joe  -- 192.168.0.100
bob  -- 192.168.0.57
angel - 192.168.0.239
cady -- 192.168.0.12
Now, joe knows the name of each user on the network. So how can he find say angel. And then open a socket or connection to angels computer? This needs to be done in perl...

Thanks for the help!

Replies are listed 'Best First'.
Re: Getting user's on network's IP address?
by mr_mischief (Monsignor) on Apr 28, 2011 at 23:29 UTC

    This isn't NetworkMonks. You didn't even ask how to do random X in Perl.

    Basically, though, you already have one way to do it. Checking with the entity that assigns the IPs can be a good way to do it if you have some way to tie the usernames to the MAC address or the hostname of the system.

    Another way to do it is to have each user or an automated client program on their computer connect to a known place and authenticate. This can be a simple UDP or TCP server, a CGI web app, an authentication/authorization/accounting (AAA) server like RADIUS, or even a plug-in for a POP3 server anything that authenticates. Then, serve that info out. You could do that as easily as making it the resulting web page upon successful authentication, or making it a POP3 bulletin.

    You could use an extant VPN service like Hamachi that basically does the above.

    You could use a dynamic DNS service client on each system and connect to each other by the assigned DNS hostnames.

    You could set each machine up to check its IP every few minutes and email the new IP to someone. I used to use this method for my phone to get the update for my home system rather than worrying about messing with a dynamic DNS service. If each person needs the complete list, set up a mailing list.

    If each person is always on the same computer, use arp and set up a MAC-to-person table on each system or in a central location. If you're also doing the DHCP yourself, you could just assign the right IP based on the MAC. If you're assigning the IP based on the MAC, you could throw in your own local DNS server with a zone for your group that maps those names to the IPs and vice-versa statically since the IPs won't change for the same machine (unless the MAC changes, of course).

    If I tried, I'm sure I could come up with a dozen or more additional ways to do this, both practical and silly. What any of them has specifically to do with Perl I have no idea.

    Please ask questions about Perl here.

      Sorry, i updated it though
Re: Getting user's on network's IP address?
by Anonymous Monk on Apr 28, 2011 at 23:07 UTC
    Ask the entity that assigns IPs

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://901880]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-03-29 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found