How to obtain a MAC address????

Discuss Networking
Post Reply
edwardsen35
user
user
Posts: 26
Joined: Mon Feb 10, 2003 9:11 am

How to obtain a MAC address????

Post by edwardsen35 »

I'm in college and I live off campus with a couple of friends. We have a cable modem that is hooked to a router which connects to each computer.

Within the router there is an option that allows you to limit which computers able to connect based on their MAC address. The problem is that the router isn't collecting everybody's MAC address.

Is there anyway to obtain their MAC address with out sitting down at their computer? I'm running Red Hat 8 and they run various versions of Windows.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

If they are Windows machines you can do an "nbtstat -A xxx.xxx.xxx.xxx" or "nbtstat -a hostname" and it will list the MAC address at the bottom of the output. You might also grab some from your arp cache (# arp -a). After you make any sort of connection to any machine it should show up in your arp cache.

edwardsen35
user
user
Posts: 26
Joined: Mon Feb 10, 2003 9:11 am

Post by edwardsen35 »

I ran netstat but I have no idea what the output means. I then ran arp -a and all it was list the ip address for my router and its MAC address.

Before I continue I think that I need to further explain what is going on. I have a four port router. I am able to obtain the MAC address for two of the four computers(My computer and Brian's computer). I also set up the router so that the IP addresses start at 192.168.123.107 and end at 192.168.123.110

I pinged Brian's computer. I ran arp -a again and it gave me his IP and MAC address.

I then tried to ping the other two IP addresses. I pinged 192.168.123.109 and I got "Destination Host Unreachable". I then pinged 192.168.123.110 and I got the same thing.

Is there away to determine what their IP address is? I think that their IP address have to be .109 or .110 but maybe I'm missing something?

Void Main, Thanks for the help so far.

-edwardsen35

edwardsen35
user
user
Posts: 26
Joined: Mon Feb 10, 2003 9:11 am

Post by edwardsen35 »

I went to my roommate's computer and I opened up a dos window. I typed ipconfig and it told me that the IP address was 192.168.123.1?

I have no idea why this is the IP address. I set the IP Pool Starting Address to 107 and IP Pool Ending Address at 110. I thought the IP would be 192.168.123.109 or 192.168.123.110.

Since I have the correct IP address I was able to obtain the MAC address but it would be nice to get the IP address without sitting down at the computer.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

If they have their IP configuration set to static then it won't matter what you set your DHCP server to (but I am sure you know this). If you set the range of IP addresses on your DHCP server the PCs are configured for DHCP they will not get one of the addresses in that range until you do a "release/renew" or the lease time expires.

Now, as far as getting their IP addresses are they configured for Windows networking? That is, do they show up in "Network Neighborhood"? If so ping them by name and it will give you their IP address. "nbtstat -a name" and it will give you their MAC address. If you make some sort of connection to them they will show up with "arp -a". A ping is not good enough to get them into the arp cache.

You can also do a broadcast ping as root on a Linux box:

# ping 192.168.123.255 -b

edwardsen35
user
user
Posts: 26
Joined: Mon Feb 10, 2003 9:11 am

Post by edwardsen35 »

I'm pretty sure that they don't have their IP configuration set to static but I'd have to look at my roomates computer so more to be positive. It's not a big deal since I got their IP but it was really bugging me.

Thank for the help!!!!!!!!!

-edwardsen33

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Here's one I forgot:

$ nmap -sP 192.168.123.0/24

Will give you the IP address of all the machines up on the 192.168.123.0/24 network.

# nmap -O -sS 192.168.123.0/24

Will give you a list machines that are up on the 192.168.123.0/24 network, what operating system they are, and what ports they have open. But nmap will not display the MAC addresses (that I am aware of). But you can use other tools for that as mentioned (nbtstat, arp, etc).

edwardsen35
user
user
Posts: 26
Joined: Mon Feb 10, 2003 9:11 am

Post by edwardsen35 »

did you type the name of the command correctly or is there another reason why the command might not be working? I type in: $ nmap -sP 192.168.123.0/24 and I get -bash: nmap: command not found. I tried netmap and map and I get the same error message.

you also told me to use nbtstat. I thought it was a mistake and I've been using netstat. Is that the correct command or do I not have nbtstat installed?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

You must not have "nmap" installed. There should also be a graphical front-end called "xnmap" or "nmapfe" which would be found in the "nmap-frontend" package. They should be on your distro's installation CD. And "nbtstat" is a Windows command, a similar command in Linux is "nmblookup" but nmblookup will not show the MAC address.

edwardsen35
user
user
Posts: 26
Joined: Mon Feb 10, 2003 9:11 am

Post by edwardsen35 »

Void Main, Thanks for the Help. I installed the nmap package and I got the nmap command to work. That is really cool!!!

Once again, Thanks for the Help!!!!!!!

-edwardsen35

edwardsen35
user
user
Posts: 26
Joined: Mon Feb 10, 2003 9:11 am

Post by edwardsen35 »

I don't know if anybody cares but I took a look at my roommate's computers. The reason that their IP addresses weren't 192.168.123.109 or 192.168.123.110 is because they were set to static. I should of checked that but it least it isn't bugging me any more.

-edwardsen35

Post Reply