IP Network layer
Loose hierarchical structure of the Internet.
The transport layer (TCP or UDP) create chunks of data and use the services
of the IP layer to send them to their destination. The IP layer is responsible
for the routing and switching of datagrams through network. It is an unreliable,
datagram network, so if you want it reliability is built-in to the transport
layer. Fragmentation is done non-transparently, though an option exists
to disallow fragmentation of a packet. Maximum data size is 64k bytes,
but 1500 is more typical (to fit without fragmentation down Ethernet).
Frame format
| Version |
IHL |
Type of service |
Total length |
Id |
Fragment offset |
TTL |
Protocol |
Checksum |
Src Addr |
Dst Addr |
| 4 bits |
4 bits |
8 bits |
16 bits |
16 bits |
16 bits |
8 bits |
8 bits |
16 bits |
32 bits |
32 bits |
| allows for coexistence of multiple versions of IP protocol |
length of header in 32 bit words (min 5 bytes, options of up to 40
bytes) |
3 bit priority, then Reliable, Delay, Throughput fields
(usually ignored) |
total length of packet (header + data), max is 65535 bytes |
used to identify a group of fragments all belonging to same frame |
used to identify fragments for later reassembly |
supposed to be a time-to-live counter in seconds, but in practice just
counts hops; when 0 it is dropped |
designed to transport many possible transport protocols, this field
identifies which |
covers only header, not a CRC, recomputed at each hop (at least the
TTL field changes) |
|
|
The frame format can be extended with up to 40 additional bytes of header
options. This was to preserve flexibility for the future, experimentation.
Some options that have been used
Security - not useful in practice (IP provides no means of encryption)
Strict source routing - a complete path to follow, useful when routing
tables are corrupt
Loose source routing - a "must hit" list of routers, but not a complete
path
Record route - each router appends IP address, good for admin (40 bytes
not enough today)
Timestamp - each router appends address + timestamp (worse problem
than record route)
IP addresses
The DDN Internet was administered by the DDN Network Information Center,
and they hand out addresses. This has now been given to a commercial entity,
and the monopoly they have is being contested in court.
IP addresses are of two parts: network and host. Each machine on a network
has a unique-in-the-world address. Routers have one address for each network
they are attached to.
Five classes of addresses (A - E)
Class A networks
very large (ARPAnet, MILnet, NASAnet)
first bit = 0
1 byte is for network (126), 3 for host (16,777,216)
host portion: decimal 0 - 127
Class B networks
regional networks
first bits = 10
2 bytes are for network (16,382), 2 for host (65,536)
host portion: decimal 128 - 191
network addresses range from 128 to 191
Class C networks
small networks (e.g. LANs)
first bit = 110
3 bytes for network(2,097,152), 1 for host (254)
host portion: decimal 192 - 223
Class D networks
reserved for multicast addresses
first bit = 1110
host portion: decimal 224 - 239
Class E networks
reserved for future and experimental use
not used in practice
Some IP addresses are special
all 0s - identifies the host before it knows it's IP address on the
local net (booting), and to mean "any address" for creating a socket to listen on
all 1s - broadcast packet, might be limited to subnet
127.x.x.x - loopback addresses, packets are treated like they were
incoming
Private IP space
If you want to set up an IP network, but don't have legitimate IP addresses assigned to you, then you should use certain addresses reserved for this purpose
class A : 10.0.0.0 to 10.255.255.255
class B: 172.16.0.0 to 172.31.255.255
class C: 192.168.0.0 to 192.168.255.255
These are non-routable IP addresses intended for private networks.
IP Routing
Fundamental thing: routing is done on the network portion of
the address.
Basic actions for routing
-
Examine first few bits of dest addr to determine class of address
-
Remove host portion of address
-
Lookup network address in routing table
-
Send packet out corresponding interface
How many entries in each router's routing tables?
Too many if this simple scheme was used, since each router
would need an entry for every network (100,000s?)
Solution: use a default route.
How to remove host portion (the mechanics)?
AND the dest address with a class-specific bit misc
| address class |
network bitmask |
| A |
255.0.0.0 |
| B |
255.255.0.0 |
| C |
255.255.255.0 |
The IP routing tables contain the following entries
(network, 0) - how to reach distant networks via interfaces on this
router
(this-network, host) - how to reach local hosts (datalink addresses)
(default) - another router with better connections to "punt to"; keeps
routing tables small
(this-network, subnet, 0) - hosts on some other subnet, send to another
router
(this-network, this-subnet, host) - hosts on a directly-connected subnet,
sent directly
Remaining routing problem:
All packets for all GVSU hosts (148.61.x.y) come into GVSU on the same
router line
Internet cloud ---------------> GVSU internet cloud
How do we distribute packets internatlly?
We have a complicated network just by itself (remote campuses, multiple
LANs)
Too many to send all packets to all LANs - the network would collapse
with the traffic.
Subnetting
Each computer on the same network must have the same network number
portion. For an organization with a need for more than a single class C
network (254 hosts), the world (the routers in the Internet, the NIC) must
know that all packets bound for any of a set of class C networks go to
the same place. A class B network works much more nicely, but there aren't
that many of them (they ran out a few years ago), and a class B network
assumes you have a single, huge network, when in practice if you have more
than 254 hosts you're likely to have them on many different LANs.
Subnetting allows for the use of a class B network, and for the host
portion of the addresses (16 bits) to be subdivided into subnet and host
portions. The subdivision is totally up to the organization. Could be 2
networks of 32k hosts each, or could be 16k networks of 2 hosts each (0
and 1 are reserved).
Subnetting is not visible to the outside world, so routers only have
one entry for an organization, and the organization doesn't have to contact
the NIC everytime it wants to add a network.
Address crisis
Potential addresses: over 2 billion, but actual available addresses:
many less that that (partitioning of the space, too few class B addresses).
Routing tables are getting too large since each router must know about
all the other networks (126 + 16,382 + 2M). This is expensive (fast, static
RAM is used to store them) and means the algorithms for managing the tables
take a long time to run, and the exchange of routing data is costly.
Solution for the short term is CIDR (class-less internet domain routing).
Allows for multiple Class C addresses to be grouped together into contiguous
blocks, then treated as one entry by the routers. If an organization needed
500 addresses it could be given 2 contiguous class C addresses (254 * 2
hosts); if it needed 8000 hosts, it could be given 32 contiguous class
C addresses (32 * 254 = 8128 hosts). Routers treat the contiguous block
of addresses as one network address group, so they only have a single entry
for it in their tables.
The other improvement CIDR makes is to partition the world into Europe,
North America, Central & South America, and Asia/Pacific, then allocate
contiguous zones of 32 million class C addresses to each zone. Now North
American routers can know that any address in the range for Europe goes
to the best path to Europe, rather than having to have entries for each
of the European networks individually.
Routing protocols
Two routing protocols are needed. The first is for routing within an AS.
The second is for routing between ASs.
OSPF (Open Shortest Path First)
uses link state algorithm
considers cost and delay factors, as well as hops
does multi-path routing, so can use more than just the single best
route for load balancing
some security to authenticate routing messages
support for hierarchical routing (areas within the AS domain)
BGP (Border Gateway Protocol)
Used to route between ASs. Must take into account policy and politics.
For instance, a network service provider may be willing to act as a transit
only for traffic originating from its own customers.