Learning Python Network Programming

(Sean Pound) #1
Chapter 1

There are some special IP address ranges. IANA has defined ranges of private
addresses. These ranges will never be assigned to any organization, and as such
these are available for anyone to use for their networks. The private address ranges
are as follows:



  • 10.0.0.0 to 10.255.255.255

  • 172.16.0.0 to 172.31.255.255

  • 192.168.0.0 to 192.168.255.255


You may be thinking that if anybody can use them, then would'nt that mean that
devices on the Internet will end up using the same addresses, thereby breaking IP's
unique addressing property? This is a good question, and this problem has been
avoided by forbidding traffic from private addresses from being routed over the
public Internet. Wherever a network using private addresses needs to communicate
with the public Internet, a technique called Network Address Translation (NAT)
is used, which essentially makes the traffic from the private network appear to be
coming from a single valid public Internet address, and this effectively hides the
private addresses from the Internet. We'll discuss NAT later on.


If you inspect the output of ip addr or ipconfig /all on your home network, then
you will find that your devices are using private range addresses, which would have
been assigned to them by your broadband router through DHCP.


Packets


We'll be talking about network traffic in the following sections, so let's get an idea of
what it is.


Many protocols, including the principle protocols in the Internet protocol suite,
employ a technique called packetization to help manage data while it's being
transmitted across a network.


When a packetizing protocol is given some data to transmit, it breaks it up into small
units — sequences of bytes, typically a few thousand bytes long and then it prefixes
each unit with some protocol-specific information. The prefix is called a header, and
the prefix and data together form a packet. The data within a packet is often called
its payload.

Free download pdf