Network Layer
Download
Report
Transcript Network Layer
2016 session 1
TELE3118: Network Technologies
Week 4: Network Layer
Basics, Addressing
Some slides have been taken from:
Computer Networking: A Top Down Approach Featuring the Internet, 4th edition.
Jim Kurose, Keith Ross. Addison-Wesley, 2007. All material copyright.
J.F Kurose and K.W. Ross, All Rights Reserved.
Computer Networks, 4th edition. Andrew S. Tanenbaum. Prentice-Hall, 2003.
Network Layer
4-1
Why an internet layer?
Why not one big flat LAN?
Different LAN protocols
Flat address space not scalable
IP provides:
Global addressing
Scaling to WANs
Virtualization of network isolates
end-to-end protocols from network
details/changes
Why a single IP?
Maximise interoperability
Minimise service interfaces
Why a narrow IP?
Least common network functionality
“hourglass model”
(Steve Deering)
Network Layer
4-2
IP functions
Addressing
Transport packet from
address A to address B
Where does IP run?
application
transport
network
data link
physical
network
data link
physical
network
data link
physical
every host
every router
Mechanisms for:
Addressing: assigning
addresses to hosts/routers
Route determination:
algorithms to compute route
to get packet to destination
Forwarding: move packets
from source to destination
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
application
transport
network
data link
physical
Network Layer
4-3
Interplay between routing and forwarding
routing algorithm
local forwarding table
header value output link
0100
0101
0111
1001
3
2
2
1
value in arriving
packet’s header
0111
1
3 2
Network Layer
4-4
Network service model
Q: What service model for “channel” transporting
datagrams from sender to rcvr?
Connection-oriented network service:
Virtual Circuits
Connection-less network service:
Datagrams
Network Layer
4-5
Virtual circuits
“source-to-dest path behaves much like telephone
circuit”
performance-wise
network actions along source-to-dest path
call setup, teardown for each call before data can flow
each packet carries VC identifier (not destination host
address)
every router on source-dest path maintains “state” for
each passing connection
link, router resources (bandwidth, buffers) may be
allocated to VC
Network Layer
4-6
Datagram networks
no call setup at network layer
routers: no state about end-to-end connections
no network-level concept of “connection”
packets forwarded using destination host address
packets between same source-dest pair may take
different paths
application
transport
network
data link 1. Send data
physical
application
transport
2. Receive data network
data link
physical
Network Layer
4-7
Datagram or VC network: why?
Internet
data exchange among
Asynchronous Transfer
Mode (ATM)
computers
evolved from telephony
“elastic” service, no
human conversation:
strict timing req.
strict timing, reliability
“smart” end systems
requirements
(computers)
need for guaranteed
can adapt, perform
service
control, error recovery
“dumb” end systems
simple inside network,
telephones
complexity at “edge”
complexity inside
many link types
network
different characteristics
uniform service difficult
Network Layer
4-8
IP: Mid-life crisis
Network Layer
4-9
The Internet Network layer
Host, router network layer functions:
Transport layer: TCP, UDP
Network
layer
IP protocol
•addressing conventions
•datagram format
•packet handling conventions
Routing protocols
•path selection
•RIP, OSPF, BGP
forwarding
table
ICMP protocol
•error reporting
•router
“signaling”
Link layer
physical layer
Network Layer
4-10
Addressing
IP address:
4-bytes = 32-bits
Dot-notation
Globally unique
Hierarchical:
223.1.1.1
223.1.2.1
223.1.1.2
223.1.2.9
223.1.1.4
223.1.1.3
223.1.3.27
• network + host
IP versus Ethernet
Hierarchical vs. flat
Portability: “location” vs.
“identification”
223.1.2.2
223.1.3.2
223.1.3.1
223.1.1.1 = 11011111 00000001 00000001 00000001
223
1
1
Network Layer
1
4-11
Subnets
IP address:
subnet part (high
order bits)
host part (low order
bits)
What’s a subnet ?
device interfaces with
same subnet part of IP
address
can physically reach
each other without
intervening router
223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.27
LAN
223.1.3.1
223.1.3.2
network consisting of 3 subnets
Network Layer
4-12
Subnets
223.1.1.2
How many?
223.1.1.1
223.1.1.4
223.1.1.3
223.1.9.2
223.1.7.0
223.1.9.1
223.1.7.1
223.1.8.1
223.1.8.0
223.1.2.6
223.1.2.1
223.1.3.27
223.1.2.2
223.1.3.1
223.1.3.2
Network Layer
4-13
IP addressing: “class-full”
class
A
0 network
B
10
C
110
D
1110
1.0.0.0 to
127.255.255.255
host
network
128.0.0.0 to
191.255.255.255
host
network
multicast address
host
192.0.0.0 to
223.255.255.255
224.0.0.0 to
239.255.255.255
32 bits
Classful addressing:
inefficient use of address space, address space exhaustion
e.g., class B net allocated enough addresses for 65K hosts,
even if only 2K hosts in that network
Network Layer
4-14
IP addressing: “class-less”
CIDR: Classless InterDomain Routing
subnet portion of address of arbitrary length
address format: a.b.c.d/x, where x is # bits in
subnet portion of address
subnet
part
host
part
11001000 00010111 00010000 00000000
200.23.16.0/23
Network Layer
4-15
IP addresses: how to get one?
Q: How does host get IP address?
hard-coded by system admin in a file
Wintel: control-panel->network->configuration>tcp/ip->properties
UNIX: /etc/rc.config
DHCP: Dynamic Host Configuration Protocol:
dynamically get address from as server
“plug-and-play”
(more in next chapter)
Network Layer
4-16
IP addresses: how to get one?
Q: How does network get subnet part of IP
addr?
A: gets allocated portion of its provider ISP’s
address space
ISP's block
11001000 00010111 00010000 00000000
200.23.16.0/20
Organization 0
Organization 1
Organization 2
...
11001000 00010111 00010000 00000000
11001000 00010111 00010010 00000000
11001000 00010111 00010100 00000000
…..
….
200.23.16.0/23
200.23.18.0/23
200.23.20.0/23
….
Organization 7
11001000 00010111 00011110 00000000
200.23.30.0/23
Network Layer
4-17
Hierarchical addressing: route aggregation
Hierarchical addressing allows efficient advertisement of routing
information:
Organization 0
200.23.16.0/23
Organization 1
200.23.18.0/23
Organization 2
200.23.20.0/23
Organization 7
.
.
.
.
.
.
Fly-By-Night-ISP
“Send me anything
with addresses
beginning
200.23.16.0/20”
Internet
200.23.30.0/23
ISPs-R-Us
“Send me anything
with addresses
beginning
199.31.0.0/16”
Network Layer
4-18
Hierarchical addressing: more specific
routes
ISPs-R-Us has a more specific route to Organization 1
Organization 0
200.23.16.0/23
Organization 2
200.23.20.0/23
Organization 7
.
.
.
.
.
.
Fly-By-Night-ISP
“Send me anything
with addresses
beginning
200.23.16.0/20”
Internet
200.23.30.0/23
ISPs-R-Us
Organization 1
200.23.18.0/23
“Send me anything
with addresses
beginning 199.31.0.0/16
or 200.23.18.0/23”
Network Layer
4-19
IP addressing: the last word...
Q: How does an ISP get block of addresses?
A: ICANN: Internet Corporation for Assigned
Names and Numbers
allocates addresses
manages DNS
assigns domain names, resolves disputes
Network Layer
4-20
NAT: Network Address Translation
rest of
Internet
local network
(e.g., home network)
10.0.0/24
10.0.0.4
10.0.0.1
10.0.0.2
138.76.29.7
10.0.0.3
All datagrams leaving local
network have same single source
NAT IP address: 138.76.29.7,
different source port numbers
Datagrams with source or
destination in this network
have 10.0.0/24 address for
source, destination (as usual)
Network Layer
4-21
NAT: Network Address Translation
Motivation: local network uses just one IP address as
far as outside word is concerned:
no need to be allocated range of addresses from ISP:
- just one IP address is used for all devices
can change addresses of devices in local network
without notifying outside world
can change ISP without changing addresses of
devices in local network
devices inside local net not explicitly addressable,
visible by outside world (a security plus).
Network Layer
4-22
NAT: Network Address Translation
Implementation: NAT router must:
outgoing datagrams: replace (source IP address, port
#) of every outgoing datagram to (NAT IP address,
new port #)
. . . remote clients/servers will respond using (NAT
IP address, new port #) as destination addr.
remember (in NAT translation table) every (source
IP address, port #) to (NAT IP address, new port #)
translation pair
incoming datagrams: replace (NAT IP address, new
port #) in dest fields of every incoming datagram
with corresponding (source IP address, port #)
stored in NAT table
Network Layer
4-23
NAT: Network Address Translation
2: NAT router
changes datagram
source addr from
10.0.0.1, 3345 to
138.76.29.7, 5001,
updates table
2
NAT translation table
WAN side addr
LAN side addr
1: host 10.0.0.1
sends datagram to
128.119.40, 80
138.76.29.7, 5001 10.0.0.1, 3345
……
……
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
S: 138.76.29.7, 5001
D: 128.119.40.186, 80
138.76.29.7
S: 128.119.40.186, 80
D: 138.76.29.7, 5001
3: Reply arrives
dest. address:
138.76.29.7, 5001
3
1
10.0.0.1
10.0.0.4
S: 128.119.40.186, 80
D: 10.0.0.1, 3345
10.0.0.2
4
10.0.0.3
4: NAT router
changes datagram
dest addr from
138.76.29.7, 5001 to 10.0.0.1, 3345
Network Layer
4-24
NAT: Network Address Translation
16-bit port-number field:
60,000 simultaneous connections with a single
LAN-side address!
NAT is controversial:
routers
should only process up to layer 3
violates end-to-end argument
• NAT possibility must be taken into account by app
designers, eg, P2P applications
address
IPv6
shortage should instead be solved by
Network Layer
4-25