Sunteți pe pagina 1din 87

Computer Network

Prof Vijay Ukani


Computer Science and Engineering Department Nirma University
Mail @ vijay.ukani@nirmauni.ac.in

Contents

Basics Internetworking Devices Network Layer Protocols Transport Layer Protocols Application Layer Protocols

Internet Protocols

Network Hardware and Software

Repeaters electronic devices that receive signals and regenerates and send them along the network Hub electronic device (with a number of ports) used in a LAN to link/connect groups of computers Bridge consists of hardware and/or software that allows communication between two similar networks Routers - electronic devices used to ensure messages are sent to their intended destinations Gateway consists of hardware and/or software that allows communications between dissimilar networks

Devices and the layers at which they operate


Layer 3 2 1 Name of Layer Network Data Link Physical Device Routers, layer 3 switches Switches, bridges, NICs Hubs

Network Interface Cards

This NIC has interfaces for twisted pair, thicknet, or thinnet connectors.

Repeaters

Signal attenuation or signal loss signal degrades over distance Repeaters clean, amplify, and resend signals that are weakened by long cable length. Built-in to hubs or switches

Hubs

OSI layer 1 hardware Hubs regenerate network signals Hubs propagate signals through the network They cannot filter network traffic They cannot determine best path They are used as network concentration points They are really multi-port repeaters

Bridges

A layer 2 device designed to create two or more LAN segments, each of which is a separate collision domain. The purpose is to filter traffic on a LAN, to keep local traffic local, yet allow connectivity to other segments of the network. Filter traffic by looking at the MAC address Frame filtering

Bridges

If the frame is addressed to a MAC address on the local side of the bridge, it is not forwarded to the other segment MAC addresses on the other segment are forwarded Bridges maintain a MAC address table for both segments they are connected to

Cycle of bridges

Bridged network can span many segments Broadcasts are sent to all segments

Bridges Distributed Spanning Tree

If all bridges forward broadcasts, infinite loops can occur Bridges perform DST on boot to determine which bridges will not forward broadcasts

Data Link Layer Switching


Multiple LANs connected by a backbone to handle a total load higher than the capacity of a single LAN.

Bridges from 802.x to 802.y


Operation of a LAN bridge from 802.11 to 802.3

Bridges from 802.x to 802.y (2)


The IEEE 802 frame formats

Local Internetworking
A configuration with four LANs and two bridges.

Spanning Tree Bridges


Two parallel transparent bridges

Spanning Tree Bridges (2)

(a) Interconnected LANs. (b) A spanning tree covering the LANs. The dotted lines are not part of the spanning tree.

Remote Bridges
Remote bridges can be used to interconnect distant LANs

Switched Networks

Shared Ethernet networks perform best when kept to 30-40 percent full capacity This is a result of CSMA/CD A LAN switch is a high-speed multiport bridge which segments each port into its own collision domain and can access the full bandwidth

Collision Domain

A collision domain is a logical network segment where data packets can collide with one another for being sent on a shared medium, in particular in the Ethernet networking protocol

Broadcast Domain

A broadcast domain is an area of the computer network made up of all the computers and networking devices able to be reached by sending a frame to the data link layer broadcast address Routers and Layer-3 Switches are used to segment broadcast domains

Collision Domain and Broadcast Domain

Switches

Each port is a simulated segment to itself Illusion of a separate LAN segment to other segments by bridges

Store and Forward Switches

Do error checking on each frame after the entire frame has arrived into the switch If the error checking algorithm determines there is no error, the switch looks in its MAC address table for the port to which to forward the destination device Highly reliable because doesnt forward bad frames Slower than other types of switches because it holds on to each frame until it is completely received to check for errors before forwarding

Cut Through Switch

Faster than store and forward because doesnt perform error checking on frames Reads address information for each frame as the frames enter the switch (first 14 bytes for Ethernet frame) After looking up the port of the destination device, frame is forwarded Forwards bad frames

Performance penalty because bad frames cant be used and replacement frames must be sent which creates additional traffic

Fragment free cut through switch

Combines speed of cut through switch with error checking functionality Forwards all frames initially, but determines that if a particular port is receiving too many bad frames, it reconfigures the port to store and forward mode Preferred switching solution

Layer 3 switch

By definition a switch filters or forwards frames based on MAC addresses. This makes a switch a layer 2 device. Layer 3 switches have routing capability. If a data frame cant be switched it is routed. Each port is a separate LAN port, but the forwarding engine actually calculates and stores routes based on IP addresses, not MAC addresses Usually support only IP or IP and IPX

VLAN Switches

Virtual local area network Each port on a switch defines a collision domain The entire switch forms a single broadcast domain VLANs can define multiple broadcast domains Network traffic that is directed to all computers on the network can be segmented to transmit only on a specific VLAN. Improves bandwidth on a the VLANs because each VLAN filters the network-to-network broadcast traffic as well as the collision traffic from other VLANs

Physical Layer Broadcast

Physical layer broadcasts implemented by non-switched Ethernet networks through shared cabling and hubs

Each bit that is transmitted is physically received by every station Switches and VLANs dont do physical layer broadcasts

MAC-level broadcast

MAC-level broadcast deal with how to handle MAC level broadcast frames; that is the data frames that have a broadcast destination MAC address MAC-level broadcast frames are addressed to all MAC addresses on a given network (not a network segment, but an actual network as defined by its network address) A regular switch forwards all broadcast frames out all ports, but a VLAN switch forwards broadcast frames only to ports that are part of the same VLAN Multiple switches can be part of the same VLAN

VLAN Switches

None of the VLANs can communicate unless each VLAN is connected to a router or layer 3 switch Each VLAN is separating collision traffic associated with MAC Addresses (layer 2) and each VLAN is separating the network-tonetwork broadcast traffic. In other words each VLAN is acting as a separate network so a layer 3 device is necessary for them to communicate

Advantages of Switches
Switches divide a network into several isolated channels (or collision domains) Reduce the possibility of collision
Collision only occurs when two devices try to get access to one channel Can be solved by buffering one of them for later access

Each channel has its own network capacity


Suitable for real-time applications, e.g. video conferencing

Since isolated, hence secure


Data will only go to the destination, but not others

33

Brouters

Hybrid device Functions as a router for routable protocols Functions as a bridge for non-routable protocols Operates at Data Link and Network layers

Gateways

A gateway is a combination of hardware and software Translate between different protocol suites Operates on all 7 layers of the OSI model Most negative on network performance

Latency

Network Layer

Implementation of Connectionless Service


Routing within a diagram subnet

Implementation of ConnectionOriented Service


Routing within a virtual-circuit subnet

The IP Protocol
The IPv4 (Internet Protocol) header.

IP Addresses
IP address formats

IP Addresses (2)
Special IP addresses

Subnets
A campus network consisting of LANs for various departments.

Subnets (2)

A class B network subnetted into 64 subnets.

Subnet Masks

The simplest form of subnet masking uses a technique called constant-length subnet masking (CLSM), in which each subnet includes the same number of hosts and represents a simple division of the address space made available by subnetting into multiple equal segments

Another form of subnet masking uses a technique called variable-length subnet masking (VLSM) and permits a single network address to be subdivided into multiple subnets, in which subnets need not all be the same size

44

Subnetting Example 1:

An large organization is assigned with the network address 190.10.0.0/16. It needs to support about 150 subnets for different locations. In each subnet, it needs to support about 200 hosts. As the first step, decide the number of bits needed from host bits to represent the subnet ID.

45

Subnetting Example 1:

Subnetting the network 190.10.0.0 by using 8 bits of the 16 host id bits


Subnet mask: 255.255.255.0 Possible subnets: 2^8 => 256 Possible hosts per subnet: 2^8 - 2 => 254 Addresses of subnetworks:

190.10.0.0 (Subnet #0) 190.10.1.0 (Subnet #1) . 190.10.255.0 (Subnet #255)


46

Subnetting Example 1 ...

For Subnet #0:

A typical host address is 190.10.0.x where x = 1 to 254 (eg: 190.10.0.5), with a subnet mask of 255.255.255.0 Also written as: 190.10.0.5/24 (without having to write the subnet mask) - Binary Count notation 24 identifies the number of contiguous 1 bits in the subnet mask and is called the length of the Extended-Network-Prefix Directed broadcast addresses of subnet #0:

190.10.0.255
47

Variable Length Subnet Masks (VLSM)

A limitation of having only a single subnet mask across a given network-prefix is that once the mask is selected, it locks the organization into a fixed number of fixed-sized subnets. In Subnetting Example 1 (subnetting 190.10.0.0 using 8 bits of the host id), there are 256 possible subnets with 254 hosts each.

If a small subnet needs only a max. of 10 hosts, this wastes IP addresses

A solution is to allow a subnetted network to use more than one subnet mask
48

VLSM Example:

An organization is assigned the network number 140.25.0.0/16. It plans to divide the address space into 16 equal sized blocks (subnets 0-15), and then to subdivide subnet #14 into 16 equal-sized blocks. Using 4 bits for subnet id, 16 subnets of the 140.25.0.0/16 address block are:
Base net: Subnet #0: Subnet #1: . Subnet #14: Subnet #15: 10001100.00011001.00000000.00000000 10001100.00011001.00000000.00000000 10001100.00011001.00010000.00000000 10001100.00011001.11100000.00000000 10001100.00011001.11110000.00000000 = 140.25.0.0/16 = 140.25.0.0/20 = 140.25.16.0/20 = 140.25.224.0/20 = 140.25.240.0/20

49

VLSM Example ...

Using 4 more bits for sub-subnet id, 16 sub-subnets of Subnet #14 are:
Subnet #14: 10001100.00011001.11100000.00000000 = 140.25.224.0/20 Subnet #14-0: 10001100.00011001.11100000.00000000 = 140.25.224.0/24 Subnet #14-1: 10001100.00011001.11100001.00000000 = 140.25.225.0/24 . Subnet #14-14: 10001100.00011001.11101110.00000000 = 140.25.238.0/24 Subnet #14-15: 10001100.00011001.11101111.00000000 = 140.25.239.0/24

Host addresses for Subnet #14-1:


Host #1: Host #2: . Host #254: 10001100.00011001.11100001.00000001 10001100.00011001.11100001.00000010 10001100.00011001.11100001.11111110 = 140.25.225.1/24 = 140.25.225.2/24 = 140.25.225.254/24

Broadcast address for Subnet #14-1= 140.25.225.255

50

The Vanishing IP Address Space

Interim solutions for IPv4 address depletion problem:


IETF introduced a new way to carve up the IP address spaceClassless Inter-Domain Routing (CIDR) RFC 1918 reserves three ranges of IP addresses for private use

a single Class A (10.0.0.0-10.255.255.255) 16 Class Bs (172.16.0.0-172.31.255.255) 256 Class Cs (192.168.0.0-192.168.255.255)

When used together with Network Address Translation (NAT), private IP addresses can help lift the cap on public IP addresses
51

Classless Inter-Domain Routing (CIDR)

Abandons the rigid address classes to eliminate the inefficiency in classful addressing CIDR ignores the traditional A, B, and C class designations for IP addresses, and can therefore set the network-host ID boundary wherever it wants to. To use a CIDR address on any network, all routers in the routing domain must understand CIDR notation

52

Classless Inter-Domain Routing (CIDR)

Allows more efficient aggregation of routing info

Route Aggregation: Use of a single entry in a routing table to represent address space of several networks Reduces the size of routing tables in routers Using contiguous blocks of Class C addresses to simulate a single, large address space

Allows Super netting

Documented in RFCs 1517 to 1520 Eg: 192.125.61.8/20 identifies a network with a 20bit network prefix
53

CIDR Classless InterDomain Routing


A set of IP address assignments.
5-59

Network

CDR Classless InterDomain Routing


Routing Table at Router 1 Address Mask Interface

Cambridge
Edinberg Oxford

194.24.0.0
194.24.8.0 194.24.16.0

21
22 20

Eth0
Eth1 Eth2

Consider a packet with 194.24.17.4. Compare to all the entries and use longest matching entry Routing Table at Router 2 Address Cambridge Edinberg 194.24.0.0 194.24.8.0 Mask 21 22 Interface Eth0 Eth0

Oxford
Aggregated Routing Table at Router 2 All

194.24.16.0
Address 194.24.0.0

20
Mask 19

Eth0
Interface Eth0

Supernets

Supernetting takes the opposite approach to subnetting: by combining contiguous network addresses, it steals bits from the network portion and uses them to create a single, larger contiguous address space for host addresses Example: An organization has the following contiguous Class C addresses
212.56.132.0/24
212.56.133.0/24 212.56.134.0/24

11010100 00111000 10000100 00000000


11010100 00111000 10000101 00000000 11010100 00111000 10000110 00000000

212.56.135.0/24

11010100 00111000 10000111 00000000

57

Supernets

The common prefix for all the 4 addresses is:


11010100 00111000 100001

They can be aggregated as: 212.56.132.0 / 22


In the Supernet, the network ID has 22 bits and the host ID has 10 bits

The network address of supernet: 212.56.132.0/22


The broadcast address of supernet: 212.56.135.255/22

Valid Host addresses:


212.56.132.1/22 - 212.56.135.254/22
58

NAT: Network Address Translation


Motivation: demand for IP addresses increases with the arrival of small devices. NAT solution: local network uses just one IP address as far as outside world is concerned allocate addresses to 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). widespread use Private IP addresses: 10.0.0.0 - 10.255.255.255 172.16.0.0 - 172.31.255.255 192.168.0.0 - 192.168.255.255
59

NAT: Network Address Translation


rest of Internet local network (e.g., home network) 10.0.0.0/8
10.0.0.4 138.76.29.7 10.0.0.3 10.0.0.1

10.0.0.2

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.0/8 address for source, destination (as usual)

60

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 NAT translation table WAN side addr LAN side addr

138.76.29.7, 5001 10.0.0.1, 3345

1: host 10.0.0.1 sends datagram to 128.119.40.186, 80

S: 10.0.0.1, 3345 D: 128.119.40.186, 80

10.0.0.1

S: 138.76.29.7, 5001 D: 128.119.40.186, 80

10.0.0.4
S: 128.119.40.186, 80 D: 10.0.0.1, 3345

10.0.0.2

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

10.0.0.3 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345
61

NAT Implementation
Private Addr Private Port External Addr External Port NAT Addr NAT Port

16 bit port# Protocol

nb-addr nb-addr

nb-port1 nb-port2

yahoo dns.sjsu

80 53

gw-addr gw-addr

3001 3002

tcp udp

nb-addr
pc-addr

nb-port3
pc-port1

yahoo
yahoo

80
80

gw-addr
gw-addr

3003
3004

tcp
tcp

outgoing: replace (src IP addr, port #) to (NAT addr, NAT port #)


. . . remote will respond to (NAT addr, NAT port #)

remember (in NAT translation table) every (src IP addr, port #) to (NAT addr, NAT port #) translation pair incoming: replace (NAT addr, NAT port #) in dest fields of every incoming datagram with corresponding (src IP add, port #) stored in NAT table

62

IP companion protocols

Internet Control Messaging Protocol (ICMP) Internet Group Management Protocol (IGMP) Address Resolution Protocol (ARP) Reverse Address Resolution Protocol (RARP)

Internet Control Message Protocol


The principal ICMP message types
5-61

ARP The Address Resolution Protocol

65

Four cases using ARP

66

Features of IPv6

Larger Address Space Aggregation-based address hierarchy Efficient and Extensible IP datagram Security (IPsec mandatory) Mobility

128-bit IPv6 Address


3FFE:085B:1F1F:0000:0000:0000:00A9:1234

8 groups of 16-bit hexadecimal numbers separated by : Leading zeros can be removed


3FFE:85B:1F1F::A9:1234

:: = all zeros in one or more group of 16-bit hexadecimal numbers

Header comparison
0 vers hlen identification 20 bytes TTL protocol 15 16 TOS flags total length flag-offset 31

Removed (6)
ID, flags, flag offset TOS, hlen header checksum

header checksum

source address destination address options and padding

Changed (3)
total length => payload protocol => next header TTL => hop limit

IPv4
vers traffic class flow-label next header hop limit

Added (2)
traffic class flow label

payload length

40 bytes

source address

destination address

Expanded
address 32 to 128 bits

IPv6

Packet Format Details


Simpler format than v4 Version = 6 Traffic class same as v4 ToS Treat all packets with the same Flow Label equally

Support QoS and fair bandwidth allocation

Payload length does not include header limits packets to 64KB

There is a jumbogram option

Hop limit = TTL field Next header combines options and protocol

If there are no options then NextHeader is the protocol field


Ordered list of tuples 6 common types

Options are extension header that follow IP header


Quickly enable a router to tell if the options are meant for it

Eg. routing, fragmentation, authentication encryption

70

Key differences in header

No checksum

Bit level errors are checked for all over the place Fixed format speeds processing

No length variability in header

No more fragmentation and reassembly in header


Incorrectly sized packets are dropped and message is sent to sender to reduce packet size Hosts should do path MTU discovery But of course we have to be able to segment packets!
71

Extension Headers

Routing Extended routing, like IPv4 loose list of routers to visit Fragmentation Fragmentation and reassembly Authentication Integrity and authentication, security Encapsulation Confidentiality Hop-by-Hop Option Special options that require hop-by-hop processing Destination Options Optional information to be examined by the destination node

Fragmentation Extension

Similar to v4 fragmentation

Implemented as an extension header

Placed between v6 header and data (if it is the only extension used)

13 bit offset Last-fragment mark (M) Larger fragment ID field than v4


0 next header 8 reserved ID

Fragmentation is done on end host


16
offset 29 31 M

reserved

73

Routing Extension

Without this header, routing is essentially the same as v4 With this header essentially same as the source routing option in v4

Loose or strict

Header length is in 64-bit words Up to 24 addresses can be included

Packet will go to nearest of these in anycast configuration

Segments left tracks current target


0 Next header 8 Hd. Ext. Len 1 24 addresses 16 0 24 31

Segmnts left
74

Transition from v4 to v6

Dual stack operation v6 nodes run in both v4 and v6 modes and use version field to decide which stack to use

Nodes can be assigned a v4 compatible v6 address


Allows a host which supports v6 to talk v6 even if local routers only speak v4 Signals the need for tunneling Add 96 0s (zero-extending) to a 32-bit v4 address eg. ::10.0.0.1 Allows a host which supports both v6 and v4 to communicate with a v4 hosts Add 2 bytes of 1s to v4 address then zero-extend the rest eg. ::ffff:10.0.0.1

Nodes can be assigned a v4 mapped v6 address


Tunneling is used to deal with networks where v4 router(s) sit between two v6 routers

Simply encapsulate v6 packets and all of their information in v4 packets until you hit the next v6 router

75

Transport Layer

Services Provided to the Upper Layers


The network, transport, and application layers

Transport Service Primitives

The primitives for a simple transport service

Transport Service Primitives (2)


The nesting of TPDUs, packets, and frames

Transport Service Primitives (3)

A state diagram for a simple connection management scheme. Transitions labeled in italics are caused by packet arrivals. The solid lines show the client's state sequence. The dashed lines show the server's state sequence.

Transport Protocol

(a) Environment of the data link layer. (b) Environment of the transport layer.

Addressing
TSAPs, NSAPs and transport connections.

Connection Establishment

How a user process in host 1 establishes a connection with a time-of-day server in host 2.

Connection Establishment

Three protocol scenarios for establishing a connection using a three-way handshake. CR denotes CONNECTION REQUEST. (a) Normal operation, (b) Old CONNECTION REQUEST appearing out of nowhere. (c) Duplicate CONNECTION REQUEST and duplicate ACK.

Connection Release

Abrupt disconnection with loss of data.

Connection Release
Four protocol scenarios for releasing a connection. (a) Normal case of a three-way handshake. (b) final ACK lost.
6-14, a, b

Connection Release
(c) Response lost. (d) Response lost and subsequent DRs lost.
6-14, c,d

S-ar putea să vă placă și