Conversion of an IP address 32-bit
- We will make a ping kioskea.net in view retrieve 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
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)
- 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