# IP address from MAC address?



## spike (Jan 13, 2002)

Hi,

Im not sure if this question belongs here. But anyway....

IP address from MAC address?

Im guessing there must be some unix tool to do this, but I cant seem to find any info on one.

The reason I need it is that I have an ethernet switch for which I know the MAC address. And the darn thing only has an RS-232 port on it for direct connection. Which is kinda useless to me and PB. But if I know the IP I can telnet in to configure it.

Thanks. Spike.


----------



## mcasteel (Jan 14, 2002)

First, your switch doesn't necessarily have an IP address, or at least not one that you could access from your own IP address (it might not be in your network).

What you're asking to do is 'reverse ARP', but I don't see it (rarp) in OS X. But, if the switch has an IP address on your network, and does any talking on your network, an 'arp -a' in the terminal will show you all the MAC/IP address pairs OS X knows about, so you might find it there.

If your network has a DHCP server, and the switch uses DHCP to configure its IP address, you should see its IP assignment in the DHCP log on the server.

Another approach might be to do a ping from your OS X terminal to the broadcast address for your network. If the switch has an address that's on your network, you could see it in the replies. You wouldn't see the MAC address, but look for an IP you didn't know about. Ping it and it will put an entry in the ARP table you can check with 'arp -a'. My network, for example, is 10.0.1.0 with broadcast address 10.0.1.255, and I can see multiple hosts with a broadcast ping ('ping 10.0.1.255') from OS X. Your broadcast address is shown in the Mac OS X terminal with 'ifconfig -a'.

If your switch does NOT have an IP address on your network, none of this has much meaning.

Check the docs on your switch to see what they say. Some early devices initialized to some default IP address, and if you didn't want to use the serial port, you had to plug a computer to the switch and configure it on a 'private network' (same as the switch's default) to configure it with an IP address on your network. If it has an IP stack and isn't real old, it probably does DHCP, so checking the server log for that MAC address should work.


----------



## spike (Jan 14, 2002)

Thanks mcasteel,

But the problem is that I have inherited this switch and no one has any idea what its IP address is or the range of the previous network. And its just me with an iMac, a G4 PB and this 24 port switch. So if I pinged a broadcast address I would have to ping all addresses, wouldnt I? 
Im guessing that would take ages. 

No entry for it came up in the arp -a list either.

Its a fairly decent 10/100 Switch though - CentreCom 8124XL.
Its working, but id like to be able to telnet to it so I can play around with it etc... 
Ya gotta learn about these things somehow. 

I read the instruction for it and to reset it I need to connect to it via the RS232 port whilst holding down the reset button on the switch. (or something like that).The problem is that I dont have access to anything with an RS232 port.

I know what the MAC address is because its on a label on the front of it. 

Thanks, Spike.


----------



## mcasteel (Jan 14, 2002)

> _Originally posted by spike _
> *[...] So if I pinged a broadcast address I would have to ping all addresses, wouldnt I?
> Im guessing that would take ages. *



Not at all. One ping on my broadcast address returns at this time two replies from both other IP hosts on my network in about 6 milliseconds. I just go, 'ping 10.0.1.255' and watch the replies come in.

However, from what you say, having inherited the switch suggests that you're not going to succeed with this approach. Here's something that might work:

1. Get into OS X terminal and read up on 'man tcpdump'. You'll have to 'sudo -s' to root in order to use it, I expect. Start tcpdump with the options to show all traffic to/from the MAC address of your switch. Better still, just have it dump all traffic regardless and unplug your other computers to cut the noise.

2. Power the switch down, wait a tick, then power it back up. If it does DHCP or even some other protocols, this should trigger it to do a request.

3. Any traffic originating at the switch should be visible in tcpdump. If it's IP traffic, you'll see the IP address.

If you are able to determine the IP address, in order to talk to it you'll have to configure your Mac with an IP address in the same network in order to 'talk' to it. Happily, this is super-easy in OS X.

If this doesn't work, you may need a USB/Serial converter and suitable cable to access the serial port if you need to change settings on the switch.


----------

