Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IP-To-Hex Conversion

Status
Not open for further replies.

StarTAC

ISP
Jun 23, 2000
424
GH
hi all..

is there anyone who knows a good site that really explains how to convert IP addresses to Hexadecimal/MAC addresses..?..

all help appreciated..
 
I'm not sure if this is what you're looking for. Use your PC's built-in scientific calculator to convert between decimal and hex then use the following procedures.

Found this on:
To convert the more common "dotted decimal" IP address into its hex equivalent, convert each of the four groups of numbers in the IP address into hex. If the resulting hex number is only one digit, add a leading zero to it. Then append all four hex numbers together. For example, take the IP address 10.0.2.254. Convert each set of four numbers into hex, and add a leading zero where necessary:

10 = A or 0A
0 = 0 or 00
2 = 2 or 02
254 = FE or FE


Therefore, the IP address 10.0.2.254 in hex is: 0A0002FE
Orlando Palomar Jr
CCIE# 11206, CCNP
CIPT Operations Specialist
Phil-Data Business Systems, Inc.
 
Converting IP address to MAC address is done dynamically through a protocol called ARP (Address Resolution Protocol). There is no way of "calculating" the MAC address from a given IP address.

ARP just asks (with a broadcast) who has IP address x.x.x.x and the box which has it eventually answers with it's MAC address.

Do a ping to an IP address and when you get a response do "arp -a" to show the corresponding MAC address.

Cheers *Rob
 
thanx all for your help..

i understand ARP.. but i need to be able to convert multicast IP addresses [224.0.0.0 - 239.255.255.255] to MAC [layer 2] addresses, without any calculations... for instance, Orlando gave a good example.. but how about if it's a Class D type network..?..

thanks all for your help anyway.. i'll scour the web for more information on this..



 
Here's a simple way to convert from [IP]Decimal Notation to Hexadecimal notation...

IP Address: 10.0.2.254

1) First convert the IP Address, per octet, to Binary...

10 . 0 . 2 . 254
00001010.00000000.00000010.11111110

2) Now divide each octet in half... giving you...

0000 1010 0000 0000 0000 0010 1111 1110

3) On a piece of paper, write the following pattern on the top... 8 4 2 1 8 4 2 1

And remember that 10=A, 11=B, 12=C, 13=D, 14=E, 15=F.

And then place the divided binary digits under the pattern like this... And ADD the #'s above the 1's...
8 4 2 1 8 4 2 1
0 0 0 0 1 0 1 0
HEX --> 0=0 10=A
8 4 2 1 8 4 2 1
0 0 0 0 0 0 0 0
HEX --> 0=0 0=0
8 4 2 1 8 4 2 1
0 0 0 0 0 0 1 0
HEX --> 0=0 2=2
8 4 2 1 8 4 2 1
1 1 1 1 1 1 1 0
HEX --> 15=F 14=E
HEX----------> 0A0002FE
Decimal------> 10.0.2.254
Binary----->00001010.00000000.00000010.11111110

Jay Singh, CCNA
 
If I remember this correctly, I think I learned the procedure when I was still studying for my BCMSN. Anyway, you may correct me if I'm wrong. The following (as I remember) is how you convert a multicast address into an L2 MAC address.

It goes something like this:

For instance, for the multicast address 231.11.12.13, the L2 MAC address would be 01-00-5E-0B-0C-0D

Multicast MAC addresses would always start with "01-00-5E". The remaining values are obtained by converting the last three octets and converting them into HEX. (The first octet is dropped).

ie.
11 = 0B
12 = 0C
13 = 0D Orlando Palomar Jr
CCIE# 11206, CCNP
CIPT Operations Specialist
Phil-Data Business Systems, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top