Download netwlayer

Document related concepts

Net bias wikipedia , lookup

Multiprotocol Label Switching wikipedia , lookup

Deep packet inspection wikipedia , lookup

CAN bus wikipedia , lookup

AppleTalk wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Dynamic Host Configuration Protocol wikipedia , lookup

Distributed firewall wikipedia , lookup

Internet protocol suite wikipedia , lookup

IEEE 1355 wikipedia , lookup

Network tap wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

Computer network wikipedia , lookup

I²C wikipedia , lookup

List of wireless community networks by region wikipedia , lookup

Airborne Networking wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Routing wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Routing in delay-tolerant networking wikipedia , lookup

Transcript
COMP210
Network layer
Page ‹#›
The Network Layer
 The network layer is responsible
for establishing, maintaining and
terminating connections
 The network layer provides:
Routing
 Flow and congestion control
 Internetworking
Page ‹#›
Routing
 Packets
originating from a
source must be
delivered to the
destination by
routing them
through several
intermediate nodes
 Routing involves
the selection of the
paths for the
packets
 When a stream of
packets need to be
delivered, the
network may handle
them in two ways:
 Virtual circuit
 Datagram
Page ‹#›
Virtual Circuit
 In this approach a preplanned route is
established before any packets are sent
 Packets are still buffered at each node
and queue up to use an outgoing link
Page ‹#›
Virtual Circuit
 Since all packets follow the same route,
sequencing of packets is maintained
 Virtual circuit is useful when two stations
exchange data over an extended period of
time
Page ‹#›
Implementation of
Connection-Oriented
Service
Routing within a virtualcircuit subnet.
Page ‹#›
Datagram
 Each packet is routed
independently
 The call setup phase is avoided
 It is more flexible and can respond to
congestion
 Packet sequencing may not be maintained
 Datagram is useful when only a few
packets are exchanged
Page ‹#›
Implementation of
Connectionless
Service
Routing within a diagram subnet.
Page ‹#›
Comparison of VirtualCircuit and Datagram
5-4
Page ‹#›
Routing Strategies
 The decision time for a route may
be made either at the packet level
(datagram) or at the virtual circuit
establishment time
 The routing decisions may be either
centralized or distributed
 Routing decisions are usually
based on topology, traffic load and
cost
Page ‹#›
Fixed Routing
 Each node needs to store only a
single row of the routing directory to
decide the next node to take for each
destination
 This strategy is simple, and works
well in a reliable network, but the
method is not flexible and cannot
adapt to network load
Page ‹#›
Shortest Path
Routing
Page ‹#›
Adaptive Routing
 These are dynamic algorithms and
react to changes in the network
conditions
 The routing decisions are more
complex and require more processing
at the nodes
 The network status information
needs to be exchanged among the
nodes, imposing further traffic among
the nodes
Page ‹#›
Adaptive Routing Methods
• Distance Vector Routing
– each router exchanges routing
tables with it's neighbours every
x seconds
– creates heavy network traffic
– can be out of date
• Link State Routing
– each router broadcasts it's
entire routing table at startup
– routers broadcast subsequent
updates
Page ‹#›
Distance Vector
Routing
Page ‹#›
Distance Vector
Routing (2)
The count-to-infinity problem.
Page ‹#›
Link State Routing
Each router must do the
following:
• Discover its neighbors, learn
their network address.
• Measure the delay or cost to
each of its neighbors.
• Construct a packet telling all it
has just learned.
• Send this packet to all other
routers.
• Compute the shortest path to
every other router.
Page ‹#›
Learning about the
Neighbors
Page ‹#›
Measuring Line Cost
Page ‹#›
Building Link State
Packets
(a) A subnet. (b) The link state
packets for this subnet.
Page ‹#›
Distributing the Link
State Packets
The packet buffer for router
B in the previous slide (Fig.
5-13).
Page ‹#›
Hierarchical Routing
Hierarchical routing.
Page ‹#›
Routing for Mobile
Hosts
A WAN to which LANs,
MANs, and wireless cells
are attached.
Page ‹#›
Q of S Requirements
How stringent the quality-ofservice requirements are.
5-30
Page ‹#›
How Networks Differ
5-43 many ways
Some of the
networks can differ.
Page ‹#›
Routers
• Use Network and Physical
(NIC card) addressing
• Maintain routing tables to
direct packets to correct
network
• Function at the network
layer
Page ‹#›
Routers
• Routing terms
– hop count
• number of routers a message
passes to get to it's destination
– tick count
• time required to deliver a
message. One tick is 1/8 sec
– TTL Time To Live
• how many routers will a
message pass until it is
undeliverable
Page ‹#›
Gateways
• Protocol translator
• Connecting two dissimilar
networks
• functions at the network
layer and above
Page ‹#›
IP addressing-History
• 1969 ARPANET used by
U.S. Department of Defence
• 1970+TCP/IP developed
and used as the common
protocol
• Developed to link
educational an
governmental agencies
(military)
Page ‹#›
IP addressing-History
(cont)
• 1984 National Science
Foundation (NSF) decided
to build "network of
networks" (Internet) based
on TCP/IP
• 1997 5 Million + internet
users
• Made up of non proprietary
protocols
• changed by RFC (request
for comment)
Page ‹#›
OSI Model versus
TCP/IP
Page ‹#›
Protocol layers
Page ‹#›
Internet Protocol (IP)
• defining the datagram
• defining the internet
addressing scheme
• moving data between the
Network Access Layer and
the Transport Layer
• routing datagrams to
remote hosts
Page ‹#›
IP (cont)
• performing fragmentation
and re-assembly of
datagrams
• connectionless protocol
does not exchange control
information (handshake) to
establish end to end
connection before
transmitting data
Page ‹#›
IP (cont)
• relies on other protocols to
establish connection if
required
• unreliable contains no error
detection, does not check if
message is delivered (Time
To Live)
• relies on other protocols for
this
Page ‹#›
Collection of Subnetworks
Page ‹#›
OSPF – The Interior Gateway
Routing Protocol
(a) Autonomous system.
(b) Graph representation of (a)
Page ‹#›
The relation between ASes,
backbones, and areas in
OSPF.
Page ‹#›
The five types of OSPF
messages.
5-66
Page ‹#›
BGP – The Exterior
Gateway Routing
Protocol
(a) A set of BGP routers.
(b) Information sent
to F.
Page ‹#›
The IP Protocol
The IPv4 (Internet Protocol)
header.
Page ‹#›
The IP Protocol
Some of the IP options.
5-54
Page ‹#›
IP address
• The IP address is a 32 bit
address
– identifies the network and the
host on a given network
– divided into two parts first part
identifies the network, second
part identifies the host on the
network
– the format is not the same for
each address
Page ‹#›
IP Address
• the 32 bit number is
represented in the following
format
• xxx.xxx.xxx.xxx
• where xxx is the decimal
representation of the binary
bit string
• Example: 142.110.3.4
•
10001110 01101110 00000011 00000100
Page ‹#›
Classes of IP Addresses
IP address formats.
Page ‹#›
Classes of IP addresses
• Class A
– used for small number of
networks and large number of
hosts
– first byte (8 bits) represent the
network address
– last 3 bytes (24 bits) represent
the host address
– class A address have a first bit of
0
– class A network addresses range
from 0 to 127
Page ‹#›
Classes of IP addresses
• Class B
– Provide an equal number of
networks and hosts
– first two bytes are network
address and last two bytes are
host addresses
– first two bits of a class B address
are 10
– network addresses range from
128 to 191
Page ‹#›
Classes of IP addresses
• Class C
– greater number of network
addresses fewer host addresses
– first three bits are 110
– network addresses range form
192-223
Page ‹#›
Classes of IP addresses
• Class D
– used for special multicast
addresses
– first four bits 1110
Page ‹#›
Classes of IP addresses
• Class E
– used for experimental purposes
– first four bits 1111
Page ‹#›
Special IP addresses.
Page ‹#›
Subnets
• subnets are used to divide
a large network into smaller
networks
• each address allows for one
network address and many
hosts (ie all hosts are on
the same network)
• subnet masks are used to
create many subnets within
the same network address
Page ‹#›
Subnet masks
• a bit string applied to an
address
• if the bit is on the
corresponding bit in the
address is considered to be
a network bit
• the network mask is known
locally only
Page ‹#›
Subnets
A class B network subnetted into
64 subnets.
Page ‹#›
Subnet Mask for Class B
address
Page ‹#›
Subnet Example #1
•
•
•
•
IP Address
130.97.16.132
Subnet Mask
255.255.255.192
•
•
11111111 11111111 11111111 11000000
10000010 01100001 00010000 10000100
• Network
•
10000010 01100001 00010000 10000000
• 130.97.16.128
• Host
•
00000000 00000000 00000000 00000100
• 4
Page ‹#›
Subnet Example #2
•
•
•
•
IP Address
130.97.17.132
Subnet Mask
255.255.254.0
•
•
11111111 11111111 11111110 00000000
10000010 01100001 00010001 10000100
• Network
•
10000010 01100001 00010000 00000000
• 130.97.16.
• Host
•
00000000 00000000 00000001 10000100
• 1.132
Page ‹#›
ROUTING EXAMPLE
Script started on Mon Mar 11 15:46:32 2002
[root@clash ijirasek]# netstat -i
eth0 1500 0 1282464
eth1 1500 0
11233
lo
16436 0
16545
0
0
0
0
0
0
0 309442
0 13268
0 16545
0
0
0
0
0
0
0 BRU
0 BRU
0 LRU
[root@clash ijirasek]# ifconfig eth0
eth0
Link encap:Ethernet HWaddr 00:10:5A:98:02:F5
inet addr:136.159.6.32 Bcast:136.159.6.255
Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500
Metric:1
RX packets:1282496 errors:0 dropped:0 overruns:0 frame:0
TX packets:309466 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:10 Base address:0x6800
Page 58
Page ‹#›
ROUTING EXAMPLE - CONT
netstat -r
Kernel IP routing table
sentinel
*
136.159.6.0 *
192.168.66.0 *
127.0.0.0
*
default
136.159.6.1
255.255.255.255 UH
255.255.255.0
U
255.255.255.0
U
255.0.0.0
U
0.0.0.0
UG
40 0
40 0
40 0
40 0
40 0
0 eth1
0 eth0
0 eth1
0 lo
0 eth0
netstat -rn
192.168.66.1
136.159.6.0
192.168.66.0
127.0.0.0
0.0.0.0
0.0.0.0
255.255.255.255 UH
0.0.0.0
255.255.255.0
U
0.0.0.0
255.255.255.0
U
0.0.0.0
255.0.0.0
U
136.159.6.1 0.0.0.0
UG
40 0
40 0
40 0
40 0
40 0
0 eth1
0 eth0
0 eth1
0 lo
0 eth0
Script done on Mon Mar 11 15:47:48 2002
Page ‹#›
Classless InterDomain Routing - CIDR
CIDR Block Prefix
# Equivalent Class C
# of Host Addresses
/27
/26
/25
/24
/23
/22
/21
/20
.
.
.
/13
1/8th of a Class C
1/4th of a Class C
1/2 of a Class C
1 Class C
2 Class C
4 Class C
8 Class C
16 Class C
.
.
.
.
.
.
2,048 Class C
32 hosts
64 hosts
128 hosts
256 hosts
512 hosts
1,024 hosts
2,048 hosts
4,096 hosts
524,288 hosts
Example: Consider the following:
Sidte ID: 194.24.16.0
CIDR mask: /20
Netmask: 255.255.255.192
11000010 00011000 00010000 00000000
11111111 11111111 11110000 00000000
11111111 11111111 11111111 11000000
The highest IP 194.24.31.255
# of subnets: 2**6 -2
# of hosts: 2**6 - 2
11000010 00011000 00011111 11111111
Page ‹#›
CIDR examples
5-59
Page ‹#›
Network Address Translation (NAT)
Method to connect multiple computers to Internet via one IP
address
Private network
(client)
----------0 NAT router -----0 Internet
(server)
|Source Address| Source Port | Dest. Address | Dest. Port| -0
When the packet arrives from the Private Network to NAT
router NAT router will:
1. Insert |Source Address| Source Port| into a table
2. Change Source address to NAT router address
3. Change Source Port to the table offset
4. Send the modified packet to destination
When the response comes back NAT router replaces the
modified Source info with the original source info and sends
it to the client.
Outside node cannot initiate the communication
Reserved addresses:10.0.0.0 - 10.255.255.255/8
172.16.0.0 – 172.31.255.255/12
192.168.0.0 – 192.168.255.255/16
Page ‹#›
NAT example
Page ‹#›
PROBLEMS WITH NAT
1. If NAT box fails all the connections are lost
2. Violates the OSI layers independency
3. Some applications insert IP address as a part
of the message. Those applications will fail
4. NAT changes the content of the IP datagram.
This in incompatible with the secure data
communication
Page ‹#›
NIC card address <--> IP Address translation
1. IP address -> NIC card address
Address Resolution Protocol (ARP)
Each node broadcasts its IP address and NIC card address
in the boot time. Other nodes on the subnet store the info.
Alternatively, a node can broadcast the question: What
NIC card has IP address .
2. NIC card address -> IP address
Reverse Address Resolution Protocol (RARP)
Used for diskless workstation. Diskless workstation has to be
booted from remote file server. After the boot the
workstation will broadcast the messageMy NIC card
address is Who knows my IP address?RARP server will
know the answer
3. BOOTP: Similar to RARP. Uses UDP protocol
4. DHCP: Extension of BOOTP. Current technology
Page ‹#›
BOOTP, DHCP functionality
1
BOOTP server will provide the client with the
following information:
IP address and netmask
IP address of default router
IP address of DNS server
The assignment between IP address and NIC
card address is static (manual)
2. DHCP (Dynamic Host Configuration Protocol)
Same functionality as BOOTP plus dynamic IP
addresses assignment. DHCP server is given a
block of IP addresses to choose from.
Page ‹#›
BOOTP, DHCP functionality - cont
Work station (client) creates a following UDP message:
Source IP address: 0.0.0.0
Destination IP address: 255.255.255.255
Source Port #: 68
Destination Port #: 67
Message:Here is my NIC address. What is my IP address?
Server answers with a following UDP message:
Source IP address: Its own address
Destination IP address: 255.255.255.255
Source port #: 67
Destination port #: 68
Message: Machine with NIC card address .! Your IP is ..
Routers know about it and make exception in limited
broadcast forwarding
Page ‹#›
Dynamic Host
Configuration Protocol
(DHCP)
Operation of DHCP.
Page ‹#›
The Main IPv6 Header
Page ‹#›
Internet Control Message Protocol
(ICMP)
Used to:
1. Transmit error messages (type 3 message)
2. Pass router info (type 9, 10 message)
ICMP is also used to facilitate mobile networking
Page ‹#›
Mobile IP
Design criteria:
1. Each mobile host must be able to use its
home IP address anywhere
2. Software changes to fixed hosts not permitted
3. Changes to router software not permitted
4. Most packets for mobile hosts should not
make detour.
5. No overheads when mobile host is at home
Page ‹#›
Mobile IP
Purpose: To provide routing for nodes which
move between radio ranges of routers.
Components of mobile network:
Mobile node: Node on the move
Home network: Network to which Mobile
node belongs to
Home agent: Router in Home Network
which provides mobility
management
Foreign network: Network where Mobile
node resides
Foreign agent: Router in the Foreign
network which provides
mobility management
Page ‹#›
Routing for Mobile
Hosts
A WAN to which LANs,
MANs, and wireless cells
are attached.
Page ‹#›
Routing for Mobile
Hosts
Page ‹#›
Mobile IP - cont
Permanent Address: IP address permanently
assigned to the Mobile node
Care-of address: Temporary IP address
assigned to Mobile node by
Foreign agent
Correspondent: Node wishing to communicate
with Mobile node
Page ‹#›
Mobile IP - cont
Functionality:
Correspondent sends a message addressed to
the Permanent address. This message will
arrive to the Home agent. Home agent forwards
the message to Foreign agent. Foreign agent
forwards it to Mobile node. Mobile node
replies directly to Correspondent.
Page ‹#›
Mobile IP - cont
Additional protocols required:
Agent discovery: Mobile node finds the
Foreign agent or Home agent
Registration with Home agent: Foreign
agent sends Home agent Care-of address
Indirect routing of Correspondent’s
datagrams: Rules about encapsulating
datagrams forwarded to Mobile node by
Home agent
Page ‹#›