Ask a question »

Conversion of an IP address 32-bit

May 2015


Conversion of an IP address 32-bit




Retrieving the IP adress


We will make a ping kioskea.net in view of retrieving the IP address (in bold)

$ Ping-c1 kioskea.net  
PING kioskea.net (194,169,240,130) 56 (84) data bytes.  
64 bytes from www.kisokea.org (194,169,240,130): icmp_seq = 1 ttl = 53 time = 53.2 ms 


--- kioskea.net ping statistics ---  
1 packets transmitted, 1 received, 0% packet loss, time 0ms  
rtt min / avg / max / mdev = 53.230/53.230/53.230/0.000 ms 
  • We now proceed with the conversion of IP using processors bits.
    • The number is about 32 bits. To get the whole, we skip each byte. The operator | allows for a bit.


Below is the binary representation

11,000,010 00,000,000 00,000,000 00,000,000 - 3,254,779,904 (194 <<24)  
00,000,000 10,101,001 00,000,000 00,000,000 - 11,075,584 (169 <<16) |  
00,000,000 00,000,000 11,110,000 00,000,000 - 61,440 (240 <<8) |  
00,000,000 00,000,000 00,000,000 10,000,010 - 130  
-----------------------------------  
11,000,010 10,101,001 11,110,000 10,000,010 - 3,265,917,058 (3,254,779,904 | 11075584 | 61440 | 130) 

Conversion


This is the command for converting the entire IP on 32 bits.

$ 194,169,240,130 echo | perl-ne 's / (\ d +) \. (\ D +) \. (\ D +) \. (\ D +) / $ 1 <<24 | $ 2 <<16 | $ 3 <<8 | $ 4 / e; print '  
3265917058 
  • Below is the result of using the ping number instead of the classical IP

$ Ping-c1 3265917058  
PING 3265917058 (194,169,240,130) 56 (84) bytes of data.  
64 bytes from 194,169,240,130: icmp_seq = 1 ttl = 53 time = 53.0 ms


--- 3265917058 ping statistics ---  
1 packets transmitted, 1 received, 0% packet loss, time 0ms 
rtt min/avg/max/mdev = 53.034/53.034/53.034/0.000 ms
For unlimited offline reading, you can download this article for free in PDF format:
Conversion-of-an-ip-address-32-bit.pdf

See also

In the same category

Published by deri58. - Latest update by jak58
This document entitled « Conversion of an IP address 32-bit » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.