While IPv4 addressing is basic knowledge for most of us, the same may not be true for IPv6 addressing. Below is a quick overview of some IPv4 key points, followed by a primer on IPv6.
An IPv4 address is expressed in either dotted-decimal notation (e.g. 22.214.171.124) or binary notation (11001000.01111101.11111000.00001100 in this case).
An IPv4 address is divided into two parts: the network ID and the host ID.
The network ID is used to determine what network a packet to send to, while the host ID is used to determine the host within that network. The only constant is that the network ID is always the first part, and the host ID is always the last part, and that both combined are always 32 bits long; the length of each part depends on the subnet mask.
To indicate what part of the 126.96.36.199 address is the network ID and what part is the host ID, we use a subnet mask. Two main notational conventions exist for the subnet mask: the traditional dotted-decimal notation (255.255.255.0, for example, indicates that the first three octets of the IP are the network ID, while the last octet is the host ID), or the newer slash notation ("Classless Inter Domain Routing" (CIDR) notation): /24, for example, indicates that the first 24 bits, or 3 octets, make up the network ID. Similarly, 255.255.0.0 is /16, 255.0.0.0 is /8, and so on.
Note: while the terms "Class A", "Class B", and "Class C" (for /8, /16, and /24, respectively) are still commonly used, they are obsolete.
The /24, /16, and /8 examples are simple, as they happen to coincide with complete octets. Subnet masks, though, are not limited to these values, and its important to know how to convert between them. Worth remembering here is that the number behind the slash indicates the number of one-bits in the address: /21, for example, is a subnet mask with 21 one-bits, or 11111111.11111111.11111000.00000000, which converts to 255.255.248.0.
When a computer needs to send an IP packet, it will first determine whether or not the packet needs to be sent locally, or remotely. To determine this, the computer looks at its own subnet mask, and compares the network ID of its own subnet mask to that of the packets. If the two match, the computer knows the packet is to be sent locally, and the packet is broadcast on the local network. If the two dont match, however, the computer knows that the packet is destined for a remote network, and the computer sends the packet to the default gateway (a router on the local network, determined by the default gateway setting on the local computer). That router, upon receiving the packet, checks the network ID, and forwards it to the correct network, where it is broadcast.
Automatic Private IP Address (APIPA): this address, in the 169.254.0.1 - 169.254.255.254 range, is used by the computer if it is configured to obtain an address automatically, but when no DHCP server is available.
Private Address: private addresses arent used on the Internet; rather, they are used within private networks. Ranges: 10.0.0.0 - 10.255.255.254, 172.16.0.0 - 172.16.255.254, and 192.168.0.0 - 192.168.255.254
Public Address: all the rest
Where IPv4 addresses consist of 32 bits, IPv6 addresses consist of eight blocks of 4 hexadecimal digits each. Four hexadecimal digits equals 16 bits, so an IPv6 address has 8*16 = 128 bits.
An example of an IPv6 address is 2001:4CEA:8D8C:0000:0000:0000:00D2:7A4B
IPv6 addresses can be shortened as follows:
First, you can get rid of all leading zeros, and our address becomes 2001:4CEA:8D8C:0:0:0:D2:7A4B
Next, you can replace all consecutive zeros with a single double colon: 2001:4CEA:8D8C::D2:7A4B
Remember how there are three main types of IPv4 addresses (APIPA, Private, and Public)? The same is true for IPv6, only they have different names:
Global Address (GA): this is the equivalent of IPv4s public address. These addresses start with a first block in the 2000-3FFF range (so the address in the "General" paragraph above is an IPv6 GA, as it starts with 2000)
Link-Local Address (LLA): this is the equivalent of the IPv4 APIPA address. These addresses always start with "fe80".
Unique Local Address (ULA): this is the equivalent of IPv4s private address. Where IPv4 private addresses fall within three ranges, ULAs always start with "fd"
If youre on Windows Vista or Server 2008, youll have built-in IPv6 support, and you can see your IPv6 address by opening a command prompt and typing "ipconfig /all". Heres actual output from my (Vista) machine:
Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : tx.rr.com Description . . . . . . . . . . . : Intel(R) 82562V 10/100 Platform LAN Connect Physical Address. . . . . . . . . : 00-19-D1-08-1B-6D DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::4cea:2560:8d8c:289d%8(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.1.102(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Lease Obtained. . . . . . . . . . : Monday, July 28, 2008 6:19:30 PM Lease Expires . . . . . . . . . . : Thursday, August 07, 2008 7:24:53 AM Default Gateway . . . . . . . . . : 192.168.1.1 DHCP Server . . . . . . . . . . . : 192.168.1.1 DNS Servers . . . . . . . . . . . : 188.8.131.52 184.108.40.206 NetBIOS over Tcpip. . . . . . . . : Enabled
Note how the machine has a private IPv4 address (192.168.1.102). It also has an IPv6 address (fe80::4cea:2560:8d8c:289d%8). First note the double colon in the IPv6 address; the actual address is fe80:0000:0000:0000:4cea:2560:8d8c:289d (per the rules above on IPv6 address shortening).
Secondly, note how the IPv6 address is an LLA (starts with "fe80"), and not a ULA as one would expect (since a ULA is the IPv6 equivalent of the private IPv4 address): the reason is simply that my router doesnt support IPv6, so it cant assign my computer an ULA IPv6 address.