Lecture 20: IP Protocol
Download
Report
Transcript Lecture 20: IP Protocol
CS 453
Computer Networks
Lecture 20
Layer 3Network Layer
Network Layer of the Internet
Internet – Network Layer
The Internet is a world-wide economic,
social, educational and cultural force
It has literally changed the we conduct our
daily lives
IP protocol is the foundation of the Internet
It’s the glue that makes it all work
Internet – Network Layer
Design principles behind the IP protocol
It has to work – build and test prototypes before
committing the standards
Simplicity – don’t add unnecessary features and keep
the “necessary” ones to a minimum
Don’t create options – have a way to do something,
not several ways
Modularity – keep design in modules
Deal with heterogeneity – complex networks are
going to mixes of technology – design for this
Internet – Network Layer
Design principles behind the IP protocol
Negotiable parameters – allow devices to
negotiate parameters, don’t have fixed
parameters
Don’t shoot for perfect – don’t try to deal with
every possible wrinkle, strange requirements
Sender adheres to standard, receiver tries to
adapt
Scalability – design must be scalable
Cost/performance – must be within
acceptable limits
Internet – Network Layer
From: Tanenbaum, 2003, pg 433
Internet
See previous diagram from Tanenbaum
Interconnection of network
Across organizations
Across countries
Across continents
Across oceans
IP Protocol is the common thread
IP protocol was designed from its inception to
deal with networks of networks
IP stands for internet protocol – with a little i
0.0001% of the Internet– according
to Wikipedia.org
From:http://en.wikipedia.org/wiki/Internet
From: www.internet2.org
IP Protocol
IPv4 Header
From:http://en.wikipedia.org/wiki/IPv4
IP Protocol
IPv4 Header
From:http://en.wikipedia.org/wiki/IPv4
IPv4 Header
Header has 20 bytes of fixed fields
+ a variable length option part
Transmitted in Big-endian order
IPv4 Header
Header fields
Version – 4 bits – identify the version of
datagram – lets routers know how to handle
the packet
Header length – 4 bits because header has
optional part length can vary, must declare
header length – in N of 4 byte words – so max
header length = 60 bytes
Type Of Service (TOS) – allows for
differentiated services – low delay, high
throughput – allows routes to decide what to
do
IPv4 Header
Header fields
Datagram length – length of entire datagram –
16 bits so max datagram length = 65,535, but
usually 1500 or less (why?)
Identifier – 16 bits – ids the datagram, so
devices will know which datagram fragments
belong to
Flags – 3 bits – fragmentation flags
Bit 16 = 0
Bit 17 = DF (don’t fragment)
Bit 18 = MF (more fragments coming)
IPv4 Header
Header fields
Fragment offset – 13 bits – defines the
fragment’s slot in the datagram (for
reassembly)
In 8 byte slots
8192 slots = max datagram = 65,536
Time to Live (TTL) – measures life of
datagram in router hops – each hop TTL-1
If TTL reaches 0 datagram trashed and warning
sent to source
IPv4 Header
Header fields
Transport Layer Protocol – what transport
layer process should receive the datagram
(TCP, UDP, …)
Header Checksum – calculated check sum
but just for the header portion of the packet
Must be recalculated on each router hop
Source address – 32 bit address of packet
source
Destination address – 32 bit address of
packet destination recipient
IPv4 Header
Header fields
Option – variable length– intended to allow things not in the design
Some predefined options originally – list has grown
To see list go to
http://www.iana.org/assignments/ip_parameters
Option
Description
Security
Says routers should use secret
routes
Strict source routing
Define route to take
Loose source routing
Defines part of route to take
Record route
Record in route hops in options
field
Timestamp
Each router adds its address and
timestamp
IPv4
Then the payload
IP Addressing
All communications has a source and a
destination (or more)
IP address scheme defines source and
destination
IP address in IP Packet, not in frame
Each device on Internet has an IP address
Each address is unique – in theory (but
not really)
IP Addressing
Each address represents a network
interface
…not a host
IP address has 32 bits…
Represented (to us) in
Dotted quad notation
Dotted decimal notation
157.182.95.120
IP Addressing
But really it a string of bits
157.182.95.120
So this is –
10011101.10110110.0101111.01111000
Which internally is –
1001110110110110010111101111000
IP Addressing
Class addressing
Originally IP address were defined in terms of classes
Since the 32 address defines all hosts/interfaces in
the Internet…
… the Internet is a network of networks
Fixed portion of the IP address were defined to
represent a network…
…i.e. the first x bits
The network address was defined on even octet
boundries --- 8 bits, 16 bits, 24 bit
The left x bits is the network address
The right y bits is the host address
x+y=32
IP Addressing
Class addressing
From: Tanenbaum, 2003, pg. 437
IP Addressing
Class addressing
Special Addresses
From: Tanenbaum, 2003, pg. 438
IP Addressing
Class addressing
…was a bit of problem
If WVU was assigned a Class B address (as it
was sometime ago…
…then the first 16 bits was the network
address
…the right 16 bits was for the address of all
of the hosts in the network
…and every host at WVU was on the the
same network, right?
…maybe for a few days
IP Addressing
Class addressing
We need someway of defining smaller
networks (subnets) for departments,
buildings, etc.
And be able to aggregate these into the
designated network (left x bits)
That is called classless addressing
IP Addressing
Classless addressing
Generalize the idea of classes,
… but make them hierarchical
…and arbitrary size ( number of bits)
For example, suppose the left 16 bits
represent a network…
…the next 8 bits represent network addresses
within that network – or subnets
Since 8 bits can be left for the host address
part of the address
There can be ? Hosts in such a subnet
IP Addressing
Classless addressing
At any given level an IP address needs to
look like a network address and a host
address
157.182.95.120
At the highest network level –
157.182 is the network address
… and 95.120 is the host address…
But…
IP Addressing
Classless addressing
subnet mask
A string of bits that acts as a bitmap
Left x bits are set to 1 to say this many bit is
the network address
Right x bit is set to 0 to say this many bits is
the host address…
11111111.11111111.11111111.00000000
Or…
255.255.255.0
IP Addressing
Classless addressing
This subnetting process can be done
recursively
University gets a network
College creates a subnet
Department creates a subsubnet
Lab creates a subsubnet
IP Addressing
Classless addressing
Subnet mask is used as a bit mask
ANDed with address to see if
Address in in local network or ..
Needs to be routed to another network
IP Addressing
Classless addressing
Subnet mask is used as a bit mask
ANDed with address to see if
Address in in local network or ..
Needs to be routed to another network
IP Network Address Translation
NAT
NAT
IP Network Address Translation
NAT
NAT
From: Tanenbaum, 2003, 446
IP Network Address Translation
NAT
NAT
NAT really irks a lot in the IP community
Violates the IP unique address rule
IP is connectionless, NAT creates a
connection
Must track state
Violates protocol layer convention
Dips into IP header (port address)
Breaks on some protocols (payload imbedded
addresses
Might not be able to scale to large subnet