An IP address is a 32 bit number. It is generally written in the "
dotted quad" notation: w.x.y.z. To convert an IP address to base 10, calculate w*16777216+x*65536+y*256+z.
Or use the following
Perl code, which takes as an argument as a string in dotted quad form:
sub dqtoint {
return hex ('0x' .
join '',
(map {
sprintf '%lx', $_
}
split (/\./, shift)));
}
m_turner suggests using bc to convert back:
obase=256;
< Enter your number here >
The output will be your ip address in dotted quad for (but without dots). m_turner further suggests to do the equivalent of my Perl above:
ibase=256;
< enter your number here in dotted quad form without dots >