Brain Dump

IP Address

Tags
networking

Is the address of a host in the internet protocol.

You can retrieve the IP address for each interface on your device using ifconfig (ipconfig on windows) command. The getaddrinfo syscall converts a human readable domain name into an IPv4 and IPv6 address through the DNS system (take care to free it afterwards using freeaddrinfo). The getnameinfo syscall converts a binary IP-address (a literal number address) into one of the readable forms described below.

Protocol Variants

IPv4

Is define as a 4-byte tuple (32-bytes) which is commonly presented as 4 octets separated by dots: 255.255.255.255. The 32-bit byte-size limits the maximum number of devices that can be connected to the same network by IPv4 as \( 2^{32} \) (roughly 4 billion).

IPv6

Is a newer variant address format that uses 128-bit addresses. It's written as a sequence of 8 4-digit hexadecimal values delimited by colons: 1F45:0000:0000:0000:0000:0000:0000:0000. By convention we often omit redundant 0 sections (1F45::).

Another advantage of IPv6 is simplified processing. As a performance improvement IPv4 and IPv6 headers are verified in hardware. As the IPv4 spec grew to accommodate an egregious amount of headers the hardware also need to become more advanced to support them.r IPv6 reorders the headers so that packets can be dropped and routed with fewer hardware cycles.

Special Addresses

Some addresses are defined by the IP spec as special. These are handled uniquely by the system.

Table 1: Listing of special IP addresses.
IPv4IPv6Description
127.0.0.10:0:0:0:0:0:0:1 (or ::1)Redirects to the current machine (localhost)

Links to this note