Pinged computer names don't match actual computer IP address?

So at this school I go to, we have mac books, and we'd communicate to each other using SSH and VNC during class at times.
To get the IP addresses (local) of each other, we'd ping the computer name of the person we wanted, the computer name being clearly visible on each of our mac books.
From time to time, IP addresses would change, but that's not really much of a problem.
Thing is, for a few people, their actual IP address is different to what we'd get when we ping them, and hence we'd accidentally end up in someone else's mac book instead of the one we intended.
Does anyone have a clue as to what is going on here? Or a solution? (Other than getting them to go and find their IP addresses with "ifconfig" or through terminal?)
We're using OS X 10.6.4, btw 

Much appreciated

thegeeke6 years ago
It's possible that you are being connected to different networks. (I assume you are using WiFi?) Give an example of one of the IPs. If you are supposed to be doing this, ask your network admin. Your admin will be better able to fix it, as he/she knows the network configuration. If you aren't supposed to be doing this during class, than forget it.
.Unknown. (author)  thegeeke6 years ago
Ok, I got it, typing in "ssh [user]@[computer name]" instead of [ssh [user]@[IP address] gets me around that problem now...