Learning Python Network Programming

(Sean Pound) #1
Chapter 1

The new format IP addresses are written differently, they look like this:


2001:0db8:85a3:0000:0000:b81a:63d6:135b

Note the use of colons and hexadecimal format.


There are rules for writing IPv6 addresses in more compact forms as well.
This is principally done by omitting runs of consecutive zeros. For example,
the address in the preceding example could be shortened to:


2001:db8:85a3::b81a:63d6:135b

If a program needs to compare or parse text-formatted IPv6 addresses, then it will
need to be made aware of these compacting rules, as a single IPv6 address can be
represented in more than one way. Details of these rules can be found in RFC 4291,
which is available at http://www.ietf.org/rfc/rfc4291.txt.


Since colons may cause conflicts when used in URIs, IPv6 addresses need to
be enclosed in square brackets when they are used in this manner, for example:


http://[2001:db8:85a3::b81a:63d6:135b]/index.html

Also, in IPv6, it is now standard practice for network interfaces to have multiple IP
addresses assigned to them. IPv6 addresses are classified by what scope they are
valid in. The scopes include the global scope (that is, the public Internet) and the
link-local scope, which is only valid for the local subnet. An IP address's scope can
be determined by inspecting its high-order bits. If we enumerate the IP addresses of
local interfaces to use for a certain purpose, then we need to check if we have used
the correct address for the scope that we intend to work with. There are more details
in RFC 4291.


Finally, with the mind-boggling cornucopia of addresses that are available in IPv6,
the idea is that every device (and component, and bacterium) can be given a globally
unique public IP address, and NAT will become a thing of the past. Though it
sounds great in theory, some concerns have been raised about the implications that
this has for issues like user privacy. As such, additions designed for alleviating these
concerns have been made to the protocol (http://www.ietf.org/rfc/rfc3041.
txt). This is a welcome progression; however, it can cause problems for some
applications. So reading through the RFC is worth your while, if you're planning
for your program to employ IPv6.

Free download pdf