Q:

How are IP addresses stored?

2
Like
Answer
Comment
Flag
Thanks for your feedback!
A:

1 Answer

rank
1
1
Like
Comment
Flag
IP addresses are stored in the database as unsigned 32-bit integers. This format allows for more efficient storage as well as complex queries involving network masks. The database schema stores IP addresses in four fields: iphdr.ip_src, iphdr.ip_dst, acid_event.ip_src, acid_event.ip_dst . The following is a description of how to convert a 32-bit unsigned integer representation of an IP address into a human readable 4-byte format. [Theoretical] Let IP = the 32-bit unsigned integer representation of the IP address ip1 = octet 1 of 4 (high-order) ip2 = octet 2 of 4 ip3 = octet 3 of 4 ip4 = octet 4 of 4 (low-order) >> = bitwise shift right operator; takes an operand of the number bits to shift AND = bitwise AND operator Then, ip1 = IP >> 24 ip2 = (IP AND 00000000 11111111 00000000 00000000) >> 16 ip3 = (IP AND 00000000 00000000 11111111 00000000) >> 8 ip4 = (IP AND 00000000 00000000 00000000 11111111) IP = ip1 . ip2 . ip3 . ip4 [MySQL] MySQL provides a native function, inet_ntoa(), which ...  more

Related Videos

Add your answer...

Top Answerers

1.
Cheap SSL Certificates
7 Answers in the past week
2.
vanity fair
7 Answers in the past week
3.
Robert Turner
4 Answers in the past week

Top Askers

1.
Frank Bigaglow
3 Questions in the past week
2.
Frank Bell
2 Questions in the past week
3.
Deitty smith
3 Questions in the past week

Top Supporters

1.
Tom Wagner
9 Likes given in the past week
2.
CableAnd OtherThings Too
2 Likes given in the past week
3.
Sh Bailbonds
2 Likes given in the past week
...