page 1 comp210 network layer. page 2 the network layer the network layer is responsible for...
TRANSCRIPT
Page 1
COMP210
Network layer
Page 2
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 3
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 4
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
Virtual Circuit
Page 5
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
Virtual Circuit
Page 6
Implementation of Connection-Oriented Service
Routing within a virtual-circuit subnet.
Page 7
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
Datagram Each packet is routed independently
Page 8
Implementation of Connectionless Service
Routing within a diagram subnet.
Page 9
Comparison of Virtual-Circuit and Datagram
5-4
Page 10
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 11
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 12
Shortest Path Routing
Page 13
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 14
Adaptive Routing Methods
Distance Vector Routing each router exchanges routing
tables with its neighbours every x seconds
creates heavy network traffic can be out of date
Link State Routing each router broadcasts its
entire routing table at startup routers broadcast subsequent
updates
Page 15
Distance Vector Routing
Page 16
Distance Vector Routing (2)
The count-to-infinity problem.
Page 17
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 18
Learning about the Neighbors
Page 19
Measuring Line Cost
Page 20
Building Link State Packets
(a) A subnet. (b) The link state packets for this subnet.
Page 21
Distributing the Link State Packets
The packet buffer for router B in the previous slide
(Fig. 5-13).
Page 22
Hierarchical Routing
Hierarchical routing.
Page 23
Routing for Mobile Hosts
A WAN to which LANs, MANs, and wireless cells
are attached.
Page 24
Q of S Requirements
How stringent the quality-of-service requirements are.
5-30
Page 25
How Networks Differ
Some of the many ways networks can differ.
5-43
Page 26
Routers
Use Network and Physical (NIC card) addressing
Maintain routing tables to direct packets to correct network
Function at the network layer
Page 27
Routers
Routing terms hop count
number of routers a message passes to get to its 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 28
Gateways
Protocol translator Connecting two dissimilar
networks functions at the network
layer and above
Page 29
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 30
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 31
OSI Model versus TCP/IP
Page 32
Protocol layers
Page 33
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 34
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 35
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 36
Collection of Subnetworks
Page 37
OSPF – The Interior Gateway Routing Protocol
(a) Autonomous system. (b) Graph representation of (a)
Page 38
The relation between ASes, backbones, and areas in OSPF.
Page 39
The five types of OSPF messages.
5-66
Page 40
BGP – The Exterior Gateway Routing Protocol
(a) A set of BGP routers. (b) Information
sent to F.
Page 41
The IP Protocol
The IPv4 (Internet Protocol) header.
Page 42
The IP Protocol
Some of the IP options.
5-54
Page 43
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 44
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 45
Classes of IP Addresses
IP address formats.
Page 46
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 47
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 48
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 49
Classes of IP addresses
Class D used for special multicast
addresses first four bits 1110
Page 50
Classes of IP addresses
Class E used for experimental purposes first four bits 1111
Page 51
Special IP addresses.
Page 52
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 53
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 54
Subnets
A class B network subnetted into 64 subnets.
Page 55
Subnet Mask for Class B address
Page 56
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 57
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 58
P a g e 5 8
ROUTING EXAMPLE
Script started on Mon Mar 11 15:46:32 2002[root@clash ijirasek]# netstat -i
eth0 1500 0 1282464 0 0 0 309442 0 0 0 BRUeth1 1500 0 11233 0 0 0 13268 0 0 0 BRUlo 16436 0 16545 0 0 0 16545 0 0 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 59
ROUTING EXAMPLE - CONT
netstat -r
Kernel IP routing tablesentinel * 255.255.255.255 UH 40 0 0 eth1136.159.6.0 * 255.255.255.0 U 40 0 0 eth0192.168.66.0 * 255.255.255.0 U 40 0 0 eth1127.0.0.0 * 255.0.0.0 U 40 0 0 lodefault 136.159.6.1 0.0.0.0 UG 40 0 0 eth0
netstat -rn
192.168.66.1 0.0.0.0 255.255.255.255 UH 40 0 0 eth1136.159.6.0 0.0.0.0 255.255.255.0 U 40 0 0 eth0192.168.66.0 0.0.0.0 255.255.255.0 U 40 0 0 eth1127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo0.0.0.0 136.159.6.1 0.0.0.0 UG 40 0 0 eth0
Script done on Mon Mar 11 15:47:48 2002
Page 60
Classless InterDomain Routing - CIDR
CIDR Block Prefix # Equivalent Class C # of Host Addresses /27 1/8th of a Class C 32 hosts /26 1/4th of a Class C 64 hosts /25 1/2 of a Class C 128 hosts /24 1 Class C 256 hosts /23 2 Class C 512 hosts /22 4 Class C 1,024 hosts /21 8 Class C 2,048 hosts /20 16 Class C 4,096 hosts . . . . . .
. . . /13 2,048 Class C 524,288 hosts Example: Consider the following: Sidte ID: 194.24.16.0 11000010 00011000 00010000 00000000CIDR mask: /20 11111111 11111111 11110000 00000000Netmask: 255.255.255.192 11111111 11111111 11111111 11000000 The highest IP 194.24.31.255 11000010 00011000 00011111 11111111# of subnets: 2**6 -2# of hosts: 2**6 - 2
Page 61
CIDR examples
5-59
Page 62
Network Address Translation (NAT)
Method to connect multiple computers to Internet via one IP address
Private network ---------- NAT router ----- Internet (client) (server)
|Source Address| Source Port | Dest. Address | Dest. Port| -
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 63
NAT example
Page 64
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 65
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 66
BOOTP, DHCP functionality
1 BOOTP server will provide the client with the following information:
IP address and netmaskIP address of default routerIP 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 67
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 68
Dynamic Host Configuration Protocol(DHCP)
Operation of DHCP.
Page 69
The Main IPv6 Header
Page 70
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 71
Mobile IP
Design criteria:
1. Each mobile host must be able to use itshome 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 notmake detour.
5. No overheads when mobile host is at home
Page 72
Mobile IP
Purpose: To provide routing for nodes which move between radio ranges of routers.Components of mobile network:
Mobile node: Node on the moveHome network: Network to which Mobile
node belongs toHome 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 73
Routing for Mobile Hosts
A WAN to which LANs, MANs, and wireless cells
are attached.
Page 74
Routing for Mobile Hosts
Page 75
Mobile IP - cont
Permanent Address: IP address permanentlyassigned to the Mobile node
Care-of address: Temporary IP address assigned to Mobile node by Foreign agent
Correspondent: Node wishing to communicatewith Mobile node
Page 76
Mobile IP - cont
Functionality:
Correspondent sends a message addressed to the Permanent address. This message will arrive to the Home agent. Home agent forwardsthe message to Foreign agent. Foreign agentforwards it to Mobile node. Mobile node replies directly to Correspondent.
Page 77
Mobile IP - cont
Additional protocols required:
Agent discovery: Mobile node finds theForeign agent or Home agent
Registration with Home agent: Foreignagent sends Home agent Care-of address
Indirect routing of Correspondent’s datagrams: Rules about encapsulatingdatagrams forwarded to Mobile node byHome agent