5. Network Layer and Internetworking - University of...

Post on 27-Aug-2018

213 views 0 download

transcript

1Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

5. Network Layer and Internetworking

2Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Outline

� Network layer design and Network services� Routing

• Shortest path routing (Dijkstra algorithm)• Distance vector routing • Link state routing

� Internetworking� The Internet

• IP protocol, address, subnet, CIDR, ICMP• Open Shortest Path First (OSF) protocol

� Advanced topics • IP multicast, Mobile IP, Security and IPv6

3Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Network layer design

� The goal is to provide end to end transmission:• Get packets from the source to the destination hosts

� To achieve the goals, each router try to:• Find out the subnet topology• Find routes to avoid overloading some of the links and routers• Deal with problems due to differences networks.

� Design issues:• Provide services independent of the subnet technology

(networks and routers)• Shield the Transport Layer from the subnet• Provide the Transport Layer with network addresses using

uniformed numbering plan

4Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Implementation of Connectionless Service

Routing within a datagram subnet.

5Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Implementation of Connection-Oriented Service

Routing within a virtual-circuit subnet.

6Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Virtual-Circuit vs Datagram Subnets

5-4

7Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Connectionless vs Connection Oriented Services

� Connectionless with full address in each packet - complexity in Transport Layer• Each router forwards the packet based on the routing table

� Connection oriented - complexity in network layer• Setting up connection based on the routing table• Terminate connection with a special identifier • Negotiate traffic parameters, quality of service, cost• Each packet with the identifier and forwarded along the

connection• Both directions in sequence• Flow control • Other optional properties: guaranteed, confirmation and priority

8Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Routing Algorithm

� Routeing algorithm is part of the network layer software� For datagrams, decision is made for each packet� For virtual circuit, decision is made when setting up� Desirable properties: correctness, simplicity, robustness,

stability, fairness, and optimality.� Two major classes of routeing algorithms: non-adaptive

(static routeing) and adaptive (dynamic routeing)� The optimality principle; if router J is on the optimal path

from router I to router K, then the optimal path from J to K also falls along the same route.

9Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Shortest path routeing (Dijkstra 1959)

� The nodes represent routers and arcs representing links

� Metrics include: hops or distances, mean queuing length and transmission delay

� Labels on the arcs can also be: function of the distance, bandwidth, average traffic, communication cost, mean queuing length, measured delay, and other factors

10Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Labelling method

1. Start from A (working node) marked as permanent node, and other node with infinite distance

2. Calculate nodes adjacent to A, re-labelling each one with the distance to A

3. The node (B) with smallest distance to A is made permanent, and become the new working node.

4. Then repeat 1-3 until all the nodes are reached and examined

11Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Distance vector routeing (used by RIP)

� Each router maintains a routeing table containing one entry for each router in the subnet

� Each entry contains two parts: the preferred out going line to use for that destination, and an estimated of time or distance to that destination.

� Assume that delay is used as a metric and that the router knows the delay to each of its neighbours

� Once every T seconds each router sends the table to its neighbours

� It also receives tables from its neighbours and updates its own table

From

12Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

The Count-to-Infinity problem

A B C D E

∞ ∞ ∞ ∞ Initially to A

1 ∞ ∞ ∞ After 1 exchange

1 2 ∞ ∞ After 2 exchange

1 2 3 ∞ After 3 exchange

1 2 3 4 After 4 exchange

A B C D E

1 2 3 4 Initially to A

3 2 3 4 After 1 exchange

3 4 3 4 After 2 exchange

5 4 5 4 After 3 exchange

5 6 5 6 After 4 exchange

7 6 7 6 After 5 exchange

∞ ∞ ∞ ∞

•Good news travels fast •Bad news travels slowly

13Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

The Split Horizon Hack

� The split horizon algorithm works the same way as distance vector routing

� Except that the distance to X is not reported on the line that packets from X are sent on (it reported as infinity)

• Split Horizon can also fails

A B

C

D

14Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Problems with distance vector algorithm

� Distance vector was used until 1979� The delay metric was queue length, it did not take

bandwidth into account� It takes too long to converge� The bandwidth changed from 56 Kbit/s to 230 or 1544

Kbit/s� The distance vector algorithm was replaced by an entirely

new algorithm (Link State routing)

15Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Link state routeing (used by OSPF)

To solve the problems with the distance vector, there are five steps in the link state algorithm:

1. Learning about the neighbours (network address): use a HELLO special packet

2. Measuring line cost or delay to its neighbours: use a special ECHO packet

3. Building link state packets 4. Distributing the link state packets: use flooding, sequence

numbers and ages5. Computing the new routes (shortest path) to every

neighbour router

16Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Learning about the neighbours

� Each router is identified uniquely

� When a router is booted, it sending a special HELLO packet on each point-to-point link to learn who its neighbours are

� LAN is modelled as a node

17Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Measuring line cost

� Measure the round trip time (RTT) by sending special ECHO packet over the line that the other side is required to send back immediately

� The delay can be estimated by the RTT divided by 2� To take load into account, the timer must be started

when the ECHO packet is queued� To ignore the load, the timer should be started when

the ECHO packet reaches the front of the queue� Should the load be taken into account ?

18Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Building link state packets

19Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Distributing the link state packets

� Using Flooding method� Each packet contains a

sequence number� Include the packet age � Each router keeps track of all

the (source router, sequence) pairs it sees

� Forward new packets and discard packets seen already

� Make it more robust by holding the packet for a short while before flooding

Packet comes from

Packet floods to

Packetacks to

20Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Computing the new routes

� Once a router has accumulated a full set of link state packets, it can construct the entire subnet graph

� Dijkstra’s algorithm can be run locally to construct the shortest path to all possible destinations

� The memory requirement is proportional to the number of the routers (n) and number of neighbours (k) each has: kn

� Some possible problems: hardware or software problem, routing calculated wrongly, and the probability of some routers failing occasionally becomes non-negligible

� OSPF uses a link state algorithm

21Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Hierarchical routeing

� The routeing tables grow proportionally with the network size.

� Large networks can be organised hierarchically into the regions, further the regions into clusters, clusters into zones, the zones into groups, so on.

� The optimal number of layer for an N router subnet is lnN, and each router requires elnNentries for its routeing table

22Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Internetworking

� Layer 1 at bit level: Repeaters � Layer 2 at frame level: Bridges� Layer 3 at packet level: Routers

� Layer 4 at byte streams level: transport gateway

� Layer 5: application gateway above level 4

23Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Tunnelling

� The source and destination hosts are the same type of networks, but there is a different network in between

� The example shows that two Ethernets are interconnected by a WAN

� Tunnelling technique: put the IP packet into an encapsulating packet before sending at the source router and take out the IP packet from the encapsulating packet at the destination router

24Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Internet Routeing

� Routing through an internet is similar to routing within a single subnet, but with some added complications

� The example shows an internet and an graph of the internet

� There is a two-level routing algorithm: interior gateway protocol and exterior gateway protocol

25Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Fragmentation

� Each network imposes some maximum size on its packets due to:• Hardware• Operating systems• Protocols• Compliance with some

standard• Reduce errors

� The example shows two fragmentation strategies

26Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Fragmentation example

27Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

The Internet

� A collections of subnetworks or Autonomous Systems (ASes)

� Backbones consist of high bandwidth lines and routers

� Then the regional or national networks attached to the backbones

� Then, LANs at university, companies and ISP

� All use Internet Protocol (IP)� In theory datagrams are up to

64 Kbytes, but in practice 1500 bytes

� Provide best effort service

28Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

The IP protocol

� Version: 4� IHL: Internet Header Length� DF: Don’t fragment� MF: More fragment

� Option code: one bytes� Option length: one bytes� Option data: less than 40

bytes, normally a few bytes

29Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

IP addressing

30Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Special IP addresses

31Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Subnets and subnet masks

• At University of Surrey (UniS)network number: netmask:131.227.0.0 255.255.255.0

32Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

CIDR - Classless InterDomain Routeing

� In 1996, 100,000th network was connected.� Class A is too large (16 million), class C is too small (256),

class B is just right (65,536).� In Class C, use 10 bit instead of 8 bits for the host

number, allowing 1024 hosts per network.� The CIDR is to solve the problem of address explosion.� The idea is to allocate remaining class C address in

variable size blocks of 1024 (RFC 1519). For example:• 194.0.0.0 to 195.255.255.255 for Europe• 198.0.0.0 to 199.255.255.255 for North America• 200.0.0.0 to 201.255.255.255 for Central and south America• 202.0.0.0 to 203.255.255.255 for Asia and the Pacific

33Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

CDR – Classless InterDomain Routing

A set of IP address assignments.

5-59

34Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

CIDR in binary format

� Cambridge: 194.24.0.0 - 194.24.7.255 mask: 255.255.248.011000010.00011000.00000000.00000000, 11000010.00011000.00000111.11111111

Mask: 11111111.11111111.11111000.00000000

� Oxford: 194.24.16.0 - 194.24.31.255 mask: 255.255.240.011000010.00011000.00010000.00000000, 11000010.00011000.00011111.11111111

Mask: 11111111.11111111.11110000.00000000

� Edinburgh: 194.24.8.0 - 194.24.11.255 mask: 255.255.252.011000010.00011000.00001000.00000000, 11000010.00011000.00001011.11111111

Mask: 11111111.11111111.11111100.00000000

� Coming Packet: 194.24.17.411000010.00011000.00010001.00000100 (Boolean-AND with the masks and compare)

Will match Edinburgh? No Oxford? Yes Cambridge? No

35Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

NAT – Network Address Translation

Placement and operation of a NAT box.

36Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

(RFC792) Internet Control Message Protocol (ICMP)

•The utility ping, traceroute and MTU discovery utilize the ICMP protocol

37Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

(RFC826) Address Resolution Protocol (ARP)

� Routers need to know MAC / Physical address) for sending packets

� Each machine is assigned an IP address and subnet mask.

� It runs ARP to get mapping from IP to Ethernet address; and it caches the results.

� The request packet also carries its mapping

� Broadcast its mapping when it boots

� Use proxy ARP or default MAC address for remote addresses

38Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

(RFC903) Reverse Address Resolution Protocol (RARP)

� Given an Ethernet address to find the IP address � This problem occurs when booting a diskless

workstation� It needs to broadcast the request� A RARP server is needed to reply to the request

39Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

The interior gateway routing protocol: Open Shortest Path First (OSPF)

� Original: distance vector (RIP)

� 1979: link state protocols� 1988: IETF began work on

OSPF� 1990: became a standard� OSPF support three kinds of

connections and networks� Point-to-point lines between

exactly two routers� Multicast networks (LANs)� Multi-access networks

without broadcasting (WANs)

Requirements:� Published in Open literature� Support a variety of distance

metrics� Adaptive to changes in topology

automatically and quickly� Support routeing based on type of

services, and real time traffic� Support load balancing� Support for hierarchical systems� Some levels of security� Deal with routes connected to the

internet via a tunnel

40Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

OSPF - Protocol messages

� When booting, a router sends HELEO message. Adjacent routers (designated routers in the each LANs) exchange information.

� Each router periodically floods link state information to each of its adjacent routers. Database description messages includes the sequence numbers of all the link state entries, sent at IP packets.

� Using flooding, each router informs all the other neighbour routers. This allows each router to construct the graph for its area and compute the shortest path.

41Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

The exterior gateway routing protocol: Board Gateway Protocol (BGP)

� All an interior gateway protocol has to do is move packets as efficient as possible.

� Exterior gateway routers have to worry about politics a great deal.

� BGP is fundamentally a distance vector protocol, but quite different from most others such as RIP.

� Each BGP router keeps track of the exact path used. This also solves the count-to-infinity problem.

42Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Advanced topics

� IP multicast � Mobile IP � Security � IPv6

43Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

IP multicast

� IP multicast routing issues� Internet Group Management Protocol (IGMP)� Multicast addresses examples:

� 224.0.0.1 All systems on a LAN� 224.0.0.2 All routers on a LAN� 224.0.0.5 All OSPF routers on a LAN� 224.0.0.6 All designated OSPF routers on a LAN

� Multicast backbone (Mbone)

44Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Routeing for mobile hosts

� Periodically foreign agents broadcast, or user request

� Mobile host registers: home address, MAC address, security info

� Foreign agent contacts home agent with security info

� Home agents examines the security info and acknowledges with a timestamp to let proceed

� Foreign agent registers the mobile host after receiving the acknowledgement

45Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Security firewalls

� Two routers do packet filtering� The inside one checks outgoing packets� The outside one checks incoming

packets� An application gateway does further

examination� This configuration is to make sure that no

packets get in or out without having to pass through the application gateway

� Packet filters are table driven, check the the raw packets

� The application gateway checks contents, message sizes, headers

46Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

IPv6

� Support more host address� Reduce the size of the routing

table� Simplify the protocol to allow

routers to process packets fast� Better security (authentication

and privacy)� Type of service, real time data� Aid multicasting (allow scopes)� Mobility (roam without changing

address)� Allow the protocol to evolve� Permit coexist of old and new

protocols.

47Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Extension Headers

IPv6 extension headers.

48Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Extension Headers (2)

The hop-by-hop extension header for large datagrams (jumbograms).

The extension header for routing.

49Computer and Data Networks, 5. Network layer and internetworking ©Dr.Z.Sun

Summary

� Network layer design, Networks and services� Routing

• Shortest path routing (Dijkstra’s algorithm)• Distance vector routing • Link state routing

� The Internet • IP protocol• IP address• ICMP• Subnet • CIDR

� Advanced topics: multicast, Mobile IP, Security, IPv6