You are on page 1of 101

LAN Networks Part V TCP/IP

Objectives
IP Protocol

IP routing
TCP/UDP Protocols

Objectives
Principles of IP interconnection

IPV4 IPv6
Mobile IP ICMP Protocol

Principles of IP interconnection
At level 2, the protocols allow the transmission of the data in adapting to specificities of the physical support
Frame format, physical addresses

The differences between all the technologies used on the network should be transparent to the user.
Abstraction of each level of functionality which encapsulates the functionalities of lower level Abstraction of the details relating to the sub-layers and finally network itself.

Contrary to the protocols of level 2, it is better to have a reduced number of protocols of level 3 for the largest number of equipments.

Principles of IP interconnection
Application User

Network

User point of view

Network point of view

Principles of IP interconnection
The concept of interconnection ensures the implementation of a network layer masking the details of the physical network and the problems of routing to the applications. IP Protocol (Internet Protocol) of level 3 plays this part of unifier
Ensures heterogeneity of the equipment and the protocols,

Defines a structure of logical network : coherent, flexible and independent for the upper layers,
Each equipment is seen like a node of level 3 independently of its real function and nature.

Principles of IP interconnection
Universal interconnection
Nodes have a single address; Interconnection on very large scales; Two nodes communicate thanks to the other network nodes The packets are routed in a co-operative way on the basis of the receiver address ; Peer-to-peer interconnection.

Public and largely diffused technology (through RFCs). Largely validated since many years in a heterogeneous world. Technology independent from the manufacturers and available for any type of material.

Principles of IP interconnection
Provides best effort, connectionless packet delivery
motivated by the need to keep routers simple and to adapt quickly the topology to the failure of some nodes packets may be lost, out of order, or even duplicated higher layer protocols must deal with this (if required)

RFCs 791, 950, 919, 922, and 2474.


Internet protocol suite also includes:
Internet Control Message Protocol (ICMP), RFC 792 Internet Group Management Protocol (IGMP), RFC 1112

Principles of IP interconnection
The routers have a connection on each network Protocol of level 3

Network A

Network B

Protocol of level 2

Protocol of level 2

Router R transfers on the network B, the packets emitted on the network A whose destination is B (and resp.).

Principles of IP interconnection
P1 transfers on the network B, the packets emitted on the network A whose destination is the networks B and C P1 must be informed of the topology of the network; C has to be accessible from the network B. The routing is not handled on the basis of receiver node but on the basis of the network of the receiver.

Network A

P1

Network B

P2

Network C

Principles of IP interconnection
Two IP protocols : IPv4 and IPv6

IP provides a service of universal addressing allowing any

node to communicate with another one (whatever the network technology used).
Logical address (IP) physical address (MAC)
IP addressing is coherent, flexible and hierarchically built.
IP addressing is compact in order to ensure an efficient

routing.

IPv4 addresses
Classes of addresses
An address known as internet address or IP address = 32 bits composed by netid - hostid pair o netid identifies a network o hostid identifies a node on this network. This pair is structured into 5 predefined classes of addresses netid unique & administered by : o American Registry for Internet Numbers (ARIN) o Reseaux IP Europeens (RIPE) o Asia Pacific Network Information Centre (APNIC)
Dotted decimal notation of IP addresses

int1.int2.int3.int4 Each integer representes a byte of the IP address 10000000 00001010 00000010 00011110 is written: 128.10.2.30

IPv4 addresses
Class A
1.0.0.0 to 127.255.255.255. 24 bits for local addresses, 254^3 possibilities 128.0.0.0 to 191.255.255.255 16 bits for local addresses, 254^2 possibilities 192.0.0.0 to 223.255.255.255 8 bits for local addresses, 254 possibilities 224.0.0.0 to 231.255.255.255 Up to 250 million multicast groups Multicast addresses, point to multipoint transmission (ex: video conference) No structure, very specific use 232.0.0.0 to 255.255.255.255 Reserved use

Class B Class C Class D

Class E

IPv4 addresses
0 Class A 8 Net-id 16 Host-id 24 31

Class B

10

Net-id

Host-id

Class C

110

Net-id

Host-id

Class D

1110 11110

Multicast

Class E

Reserved

IPv4 private addresses


Specific ranges of IP addresses set aside for use in private networks (RFC 1918) Use restricted to private networks; routers in public Internet discard packets with these addresses Class A : 10.0.0.0 to 10.255.255.255 Class B : 172.16.0.0 to 172.31.255.255 Class C : 192.168.0.0 to 192.168.255.255 Network Address Translation (NAT) is used to convert private & global IP addresses

IPv4 addresses
Specific addresses
Network address
o &IP whose the hostid part is equal to 0 o A hostid with 0 cannot be given to a real machine o Ex: 192.20.0.0 is a network adress of class C (netid = 192.20.0)

Hostid 0
o The hostid specifies the physical address of the node

Local machine address


o &IP whose the netid part is equal to 0

All = 0
o this address is used during the system boot when no IP address is allotted.

IPv4 addresses
Broadcast addresses
The hostid part is equal to 1

Limited broadcast addresses


Netid is equal to 1: only used on the associated physical network

Address of directed broadcast


Netid is a specific address network

The broadcast relates to all the nodes located on the specified network
Ex: 162.20.255.255 indicates all the nodes of network 162.20.

Consequently, an IP address whose value hostid does is equal to 1 cannot be allotted to a real node. Local loop address

The network address 127.0.0.0 is reserved for the local machine, i.e. for
the intra-node communication.

An 127 address network cannot be transmitted on a network and a router


never forwards a packet for the 127 network.

IPv4 addresses
0 8 Net-id 16 24 All to zero Network address All to zero Local node All to zero 31

Host-id

Hostid node on the current network


All to one Limited broadcast on the current network Net-id All to one Directed broadcast on the netid network 127 Anything (often 1)

Local loop

IPv4 addresses
128.135.40.1 H Interface Address is 128.135.10.2 Interface Address is 128.140.5.35 128.140.5.40 H

Network 128.135.0.0

Network 128.140.0.0

Multi-homed router
H 128.135.10.20 H 128.135.10.21

128.140.5.36
R = router H = host

Address with host ID=all 0s refers to the network Address with host ID=all 1s refers to a broadcast packet

Classless Inter-Domain Routing


CIDR deals with Routing Table Explosion Problem

Solution: Route according to prefix of address, not class


IP address assignment reflects physical topology of network Network topology follows continental/national boundaries
IP addresses should be assigned on this basis

Transit Routing Domains (TRDs) have unique IP prefix


carry traffic between routing domains interconnected across national boundaries all addresses attached to a TRD aggregated into 1 table entry

Implementation primarily through BGPv4 (RFC 1518-1520)

Subnet Addressing
Subnet addressing introduces another hierarchical level Transparent to remote networks Simplifies management of multiplicity of LANs Masking used to find subnet number

Original address

1 0

Net ID

Host ID

Subnetted address

1 0

Net ID

Subnet ID

Host ID

Subnet Addressing
Subnet mask
Equal to 1 : network part
Equal to 0 : node part Ex: 11111111 11111111 11111111 00000000 o 3 bytes for the network address , 1 byte for the node address

The bits of the mask identifying a subnetwork and a node have not to be contiguous
Ex: 11111111 11111111 00011000 01000000 Default mask : e.g. for a network of class B : 11111111 11111111 00000000 00000000

IPv4 datagram

The basic PDU on an Internet network is called datagram :


0 4 Version IHL 8 Type of Service Flags Protocol 16 19 24 Total Length Fragment Offset Header Checksum 31

Identification Time to Live

Source IP Address Destination IP Address Options Padding

Minimum 20 bytes Up to 40 bytes in options fields

IPv4 datagram
Version: current IP version is 4. Internet header length (IHL): length of the header in 32-bit words. Type of service (TOS): traditionally priority of packet at each router. Recent Differentiated Services redefines TOS field to include other services besides best effort. Total length: number of bytes of the IP packet including header and data, maximum length is 65535 bytes. Identification, Flags, and Fragment Offset: used for fragmentation and reassembly. Time to live (TTL): number of hops packet is allowed to traverse in the network.

Each router along the path to the destination decrements this value by one.
If the value reaches zero before the packet reaches the destination, the router discards the packet and sends an error message back to the source.

IPv4 datagram
Protocol: specifies upper-layer protocol that is to receive IP data at the destination. Examples include TCP (protocol = 6), UDP (protocol = 17), and ICMP (protocol = 1). Header checksum: verifies the integrity of the IP header. Source IP address and destination IP address

Options: Variable length field, allows packet to request special features such as security level, route to be taken by the packet, and timestamp at each router. Detailed descriptions of these options can be found in [RFC 791].
Padding: This field is used to make the header a multiple of 32-bit words.

Address Resolution Protocol (ARP)

IP address identifies a host, but packet is physically delivered by an underlying network which uses its own physical address (e.g., MAC address in Ethernet). ARP: How to map an IP address to a physical address?

Example: H1 needs physical address of H3 -> broadcasts an ARP request

H1
150.100.76.20

H2
150.100.76.21

H3
150.100.76.22

H4
150.100.76.23

ARP request (what is the MAC address of 150.100.76.22?)

Every host receives the request, but only H3 replies with its physical address

H1

H2

H3

H4

ARP response (my MAC address is 08:00:5a:3b:94)

Internet Control Message Protocol (ICMP)


One of the core protocols of the Internet Protocol Suite.

ICMP relies on IP to perform its tasks


It is typically not used to send and receive data between end systems. It is usually not used directly by user network applications, with some exceptions (e.g. ping and traceroute tools)

ICMP messages are encapsulated as data in datagrams in the same way any other data is delivered using IP.

Error Reporting and Error Correction


ICMP is an error-reporting protocol for IP.

Unreachable Networks

Ping

Detecting Excessively Long Routes


Whether the actual path includes too many hops or a circular routing path exists, the packet will eventually reach the end of its life, known as its time-to-live (TTL).

ICMP Message Types

Destination Unreachable Message

Code Values for Destination Unreachable Messages

IP Suite Control Messages


Control messages are used to inform hosts of conditions such as network congestion or the existence of a better gateway to a remote network.

ICMP Redirect/Change Requests


The default gateway of the host may need to use a redirect/change request to inform the host of the best path to a certain network.

Clock Synchronization and Transit Time Estimation


The ICMP timestamp request message allows a host to ask for the current time according to the remote host. The remote host uses an ICMP timestamp reply message to respond to the request.

Router Discovery Message


When a host on the network boots, and the host has not been manually configured with a default gateway, it can learn of available routers through the process of router discovery.

Router Solicitation Message


A host generates an ICMP router solicitation message in response to a missing default gateway.

Congestion and Flow Control Messages


ICMP source-quench messages are used to reduce the amount of data lost from congestion.

Special Protocol: Mobile IP


Proliferation of mobile devices: PDAs, laptops, cellular phones,

As user moves, point-of-attachment to network necessarily changes


Problem: IP address specifies point-of-attachment to Internet
Changing IP address involves terminating all connections & sessions

Mobile IP (RFC 2002): device can change point-of-attachment while retaining IP address and maintaining communications

Operation of Mobile IP
Foreign Network Home Network Mobile Host #1 Foreign Agent

Mobile Host #2

Home Agent

Care-of-Address

Internet

Home Agent (HA) keeps track of location of each Mobile Host (MH) in its network; HA periodically announces its presence If MH is in Home Network, e.g. MH#1, HA forwards packet directly to it When MH moves to a Foreign Network, e.g. MH#2, MH obtains a care-ofaddress from foreign agent (FA) and registers this with its HA

Operation of Mobile IP
Home Network 2 Internet 1 Foreign Agent

Foreign network

Mobile Host

Home Agent

Correspondent Host

Correspondent Host (CH) sends packets as usual (1) Packets are intercepted by HA & forwarded to Foreign Agent (FA) (2) FA forwards packet to the MH & MH sends packet to CH as usual (3) Question: how does HA send packets to MH in foreign network?

IP-to-IP Encapsulation
HA uses IP-to-IP encapsulation IP packet has MH IP address Outer IP header has HAs address as source address and care-of-address as destination address FA recovers IP packet and delivers to MH
Outer IP header

IP header

IP header

IP payload

IP payload

Route Optimization
Going to HA inefficient if CH and MH are in same foreign network

When HA receives pkt from CH (1), it tunnels using care-of-address (2a); HA also sends care-of-address to CH (2b)
CH can then send packets directly to care-of-address (4)
Home Network Foreign Agent 2a Internet 2b 1

Foreign Network

Mobile Host

Home Agent

3 4

Correspondent Host

IPv6 (Next-Gen IP)


Provides logical growth path from IPv4 so that applications and network devices can handle new demands Replaces class-based addresses Designed to be CIDR-compliant Supports simpler and faster header processing

IPv6 Main Features


Longer address field
128 bits can support up to 3.4 x 1038 hosts

Simplified header format


Simpler format to speed up processing of each header All fields are of fixed size IPv4 vs IPv6 fields:

o Same: Version
o Dropped: Header length, ID/flags/frag offset, header checksum o Replaced: Datagram length by Payload length Protocol type by Next header TTL by Hop limit TOS by traffic class New: Flow label

IPv4 & IPv6 Packet Formats

Other IPv6 Features


Flexible support for options: more efficient and flexible options encoded in optional extension headers Flow label capability: flow label to identify a packet flow that requires a certain QoS Security: built-in authentication and confidentiality Large packets: supports payloads that are longer than 64 K bytes, called jumbo payloads. Fragmentation at source only: source should check the minimum MTU along the path No checksum field: removed to reduce packet processing time in a router

IPv6 Header Format


Version field same size, same location Traffic class to support differentiated services Flow: sequence of packets from particular source to particular destination for which source requires special handling
0 Version 4 Traffic Class Payload Length 12 16 24 Flow Label Next Header Hop Limit 31

Source Address

Destination Address

IPv6 Header Format


Payload length: length of data excluding header, up to 65535 B Next header: type of extension header that follows basic header Hop limit: # hops packet can travel before being dropped by a router
0
Version

4
Traffic Class

12

16

24
Flow Label Next Header

31

Payload Length

Hop Limit

Source Address

Destination Address

Six Extension Headers

Header code 0 43 44 51 52

Header type Hop-by-hop options header Routing header Fragment header Authentication header Encapsulating security payload header

60

Destination options header

IPv6 Addressing
Address Categories
Unicast: single network interface Multicast: group of network interfaces (at different locations). Packet sent to all. Anycast: group of network interfaces. Packet sent to only one interface in group (e.g., nearest)

Hexadecimal Notation
Groups of 16 bits (4 hex digits) separated by colons
o 4BF5:AA12:0216:FEBC:BA5F:039A:BE9A:2176

Shortened forms:
o 4BF5:0000:0000:0000:BA5F:039A:000A:2176 written as 4BF5:0:0:0:BA5F:39A:A:2176 (or 4BF5::BA5F:39A:A:2176)

Migration from IPv4 to IPv6


Gradual transition from IPv4 to IPv6

Dual IP stacks: routers run IPv4 & IPv6


Type field used to direct packet to IP version

IPv6 islands can tunnel across IPv4 networks


Encapsulate user packet insider IPv4 packet
Tunnel endpoint at source host, intermediate router, or destination host

Migration from IPv4 to IPv6


Source Tunnel head-end Tunnel

Tunnel tail-end

Destination

(a) IPv6 network

IPv6 header IPv4 network

IPv4 header

IPv6 network

Source Link

Destination

(b)
IPv6 network IPv6 network

Objectives
Introduction to routing principles

Static and dynamic routing

Route Types
Static route
Programmed route that a network administrator enters manually into a router

Dynamic route
Route that a routing protocol adjusts automatically for topology or traffic changes

Static Routing

Dynamic Routing

Routed Versus Routing Protocol

Autonomous Systems

Dynamic Routing Operations

Classes of Routing Protocols

Distance Vector Concepts

Distance Vector Network Discovery

Routing Metric Components

Distance Vector Updates

Problems
Routing Loops
Routing loops can occur when inconsistent routing tables are not updated due to slow convergence in a changing network.

Counting to Infinity

Solution: Defining a Maximum for Infinity

Solution: Split Horizon

Solution: Route Poisoning

Solution: Triggered Updates

Solution: Holddown Timers

Key Characteristics of RIP

Link-State Concepts

Link-State Network Discovery

Link-State Topology Changes

Link-State Concerns

Path Determination

Routing with Network Addressing

IP Routing Configuration Tasks

Routing Protocols

Interior/Exterior Routing Protocols

Objectives
UDP Protocol

TCP Protocol

TCP vs UDP
TCP : connection-oriented and reliable protocol
Provides flow control by providing sliding windows, Ensures reliability by providing sequence numbers and acknowledgments. TCP re-sends anything that is not received and supplies a virtual circuit between end-user applications Advantage of TCP: it provides guaranteed delivery of the segments

UDP : connectionless and unreliable protocol


Connectionless alternative to TCP that yields a lower overhead, but is less reliable Relies only on checksum to ensure reliability (optional) Handles and transmits data faster; performs no flow control, sequencing, or acknowledgment

UDP Overview
Best effort datagram service

Multiplexing enables sharing of IP datagram service


Simple transmitter & receiver
Connectionless: no handshaking & no connection state

Low header overhead


No flow control, no error control, no congestion control UDP datagrams can be lost or out-of-order

Applications
multimedia (e.g. RTP)
network services (e.g. DNS, RIP, SNMP)

UDP Multiplexing
All UDP datagrams arriving to IP address B and destination port number n are delivered to the same process Source port number is not used in multiplexing

2 ... n

2 ... n

2 ... n

UDP

UDP

UDP

IP
A B

IP
C

IP

UDP Datagram
Source and destination port numbers
Client ports are ephemeral

Server ports are well-known


Max number is 65,535

UDP length
Total number of bytes in datagram (including header) 8 bytes length 65,535 UDP Checksum : detects errors in UDP datagram (but this is optional)
0 Source Port UDP Length 16 31 Destination Port UDP Checksum

0-255 Well-known ports 256-1023 Less well-known ports 1024-65536 Ephemeral client ports

Data

UDP Port Numbers


Port Number 49 53 67 68 69 137 138 123 161 1645 1646 TACACS authentication server DNS BOOTP server BOOTP client TFTP NETBIOS name service NETBIOS datagram service NTP SNMP RADIUS authentication server RADIUS accounting server Purpose

2049

NFS

TCP Overview
Reliable byte-stream service

More complex transmitter & receiver


Connection-oriented: full-duplex unicast connection between client & server processes Connection setup, connection state, connection release

Higher header overhead


Error control, flow control, and congestion control Higher delay than UDP

Most applications use TCP


For example: HTTP, SMTP, FTP, TELNET,

Example: HTTP uses service of TCP


HTTP client
GET Port 1127

HTTP server
Response

Port 80

TCP Response GET 80, 1127 TCP

GET bytes 1127, 80 TCPResponse

TCP Multiplexing
A TCP connection is specified by a 4-tuple (source IP address, source port, destination IP address, destination port) TCP allows multiplexing of multiple connections between end systems to support multiple applications simultaneously Arriving segment directed according to connection 4-tuple
1 2 ... m 1 2 ... n 1 2 ... k

TCP IP A (A, 6234, B, 80) (A, 5234, B, 80)

TCP IP B (C, 5234, B, 80)

TCP IP C

TCP Port Numbers


Port Number Purpose Port Number Purpose

Multiplexing

53

DNS Server apps

25

SMTP e-mail applications

79

Find active users application

15

Network Status

102

Service access point

20

FTP Data

103

Standard email services

21

FTP Commands

119

News transfers

23

Telnet applications

139

NetBIOS applications

TCP Segment Format


0 4 10 Source port Sequence number Acknowledgment number Header length Reserved Checksum
U A P R S F R C S S Y I G K H T N N

16

24 Destination port

31

Window size Urgent pointer

Options

Padding

Data

TCP Header
Port Numbers

A socket identifies a connection endpoint


IP address + port

A connection specified by a socket pair Well-known ports


FTP Telnet DNS HTTP 20 23 53 80

Sequence Number

Byte count, First byte in segment


32 bits long 0 SN 232-1 Initial sequence number selected during connection setup

TCP Header
Ack Number
SN of next byte expected by receiver
Acknowledges that all prior bytes in stream have been received correctly Valid if ACK flag is set

Header Length
4 bits Length of header in multiples of 32-bit words Minimum header length is 20 bytes Maximum header length is 60 bytes

TCP Header
Control
6 bits
URG: urgent pointer flag
o Urgent message end = SN + urgent pointer

ACK: ACK packet flag PSH: override TCP buffering RST: reset connection
Upon receipt of RST, connection is terminated and application layer notified

SYN: establish connection FIN: close connection

TCP Header
Window Size
16 bits to advertise window size
Used for flow control Sender will accept bytes with SN from ACK to ACK + window Maximum window size is 65535 bytes

TCP Checksum
Internet checksum method
TCP pseudo header + TCP segment Variable length NOP (No Operation) option is used to pad TCP header to multiple of 32 bits Time stamp option is used for round trip measurements

Options

Flow Control
Buffer limitations & speed mismatch can result in loss of data that arrives at destination Receiver controls rate at which sender transmits to prevent buffer overflow
Application Transport buffer segments advertised window size < B

buffer used
buffer available = B

Congestion Control
Available bandwidth to destination varies with activity of other users Transmitter dynamically adjusts transmission rate according to network congestion as indicated by RTT (round trip time) & ACK messages

Elastic utilization of network bandwidth


Application Transport
RTT buffer Estimation

segments ACKS buffer

TCP Congestion Control


Advertised window size is used to ensure that receivers buffer will not overflow

However, buffers at intermediate routers between source and destination may overflow Router

Packet flows from many sources

R bps

Congestion occurs when total arrival rate from all packet flows exceeds R over a sustained period of time Buffers at multiplexer will fill-up and packets will be lost

You might also like