563
Networks and Protocols ’2006 urgen Sch ¨ onw ¨ alder [email protected] International University Bremen Campus Ring 1 28725 Bremen, Germany http://www.faculty.iu-bremen.de/jschoenwae/np-2006/ slides.tex – Networks and Protocols ’2006 – J¨ urgen Sch ¨ onw ¨ alder – 9/10/2006 – 8:18 – p. 1

Networks and Protocols '2006

Embed Size (px)

Citation preview

Page 1: Networks and Protocols '2006

Networks and Protocols ’2006Jurgen Schonwalder

[email protected]

International University Bremen

Campus Ring 1

28725 Bremen, Germany

http://www.faculty.iu-bremen.de/jschoenwae/np-2006/

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 1

Page 2: Networks and Protocols '2006

0. Preface

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 2

Page 3: Networks and Protocols '2006

Networks & Distributed Systems

• General CS I 1st Semester• Nat. Sci. Lab Module (C) 1st Semester• General CS II 2nd Semester• Nat. Sci. Lab Module (C++) 2nd Semester• Algorithms and Data Structures 3rd Semester• Computer Arch. and Operating Systems 4th Semester• Networks and Protocols 5th Semester• Distributed Systems 6th Semester

• Advanced Networking Fall Semester• Advanced Distributed Systems Fall Semester

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 3

Page 4: Networks and Protocols '2006

Course Content

1. Introduction

2. Fundamental Concepts

3. Local Area Networks (IEEE 802)

4. Internet Network Layer (IPv4, IPv6)

5. Internet Routing (RIP, OSPF, BGP)

6. Internet Transport Layer (UDP, TCP)

7. Firewalls and Network Address Translators

8. Abstract Syntax Notation 1 (ASN.1)

9. External Data Representation (XDR)

10. Augmented Backus Naur Form (ABNF)

11. Domain Name System (DNS)

12. Electronic Mail (SMTP, IMAP)

13. Document Access and Transfer (HTTP, FTP)

14. Operations and Management (SNMP)

15. Remote Procedure Calls (ONC RPC)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 4

Page 5: Networks and Protocols '2006

Course Objectives

• Introduce fundamental data networking concepts• Focus on widely deployed Internet protocols• Prepare students for further studies in networking• Combine theory with practical experiences• Raise awareness of weaknesses of the Internet

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 5

Page 6: Networks and Protocols '2006

Reading Material

• A.S. Tanenbaum, "Computer Networks", 4th Edition, PrenticeHall, 2002

• W. Stallings, "Data and Computer Communications", 6thEdition, Prentice Hall, 2000

• C. Huitema, "Routing in the Internet", 2nd Edition, PrenticeHall, 1999

• D. Comer, "Internetworking with TCP/IP Volume 1: PrinciplesProtocols, and Architecture", 4th Edition, Prentice Hall, 2000

• J.F. Kurose, K.W. Ross, "Computer Networking: A Top-DownApproach Featuring the Internet", 3rd Edition,Addison-Wesley 2004.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 6

Page 7: Networks and Protocols '2006

Grading Scheme

• Final examination (30%)◦ Covers the whole lecture◦ Open book (and closed computers / networks)

• Midterm examination (30%)◦ Covers the first part of the lecture◦ Open book (and closed computers / networks)

• Quizzes (20%)◦ Control your continued learning success

• Mini projects / homeworks / labs (20%)◦ Gain some practical experience

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 7

Page 8: Networks and Protocols '2006

Reasons for not taking this course

• You do not have the time required for this course• You do not have the required background• You just want to know how to configure your system(s)• You find the topics covered by this course boring• You are not ready for some hard work• You are unable to do some programming in C/Unix• You are not ready to take initiative such as

◦ reading book chapters and specifications, or◦ programming exercises

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 8

Page 9: Networks and Protocols '2006

1. Introduction

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 9

Page 10: Networks and Protocols '2006

The Internet

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 10

Page 11: Networks and Protocols '2006

Autonomous Systems

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 11

Page 12: Networks and Protocols '2006

Growth of the Internet

• How would you count hosts on the Internet?

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 12

Page 13: Networks and Protocols '2006

Growth of the World Wide Web

• This may be a bit easier to count?• Do not take these figures too serious!

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 13

Page 14: Networks and Protocols '2006

Growth of Problems

• CERT Coordination Center (CERT/CC) is a center of Internetsecurity expertise

• Located at the Software Engineering Institute operated byCarnegie Mellon University (CMU)

Year Incidents Advisories

1988 6 1

1989 132 7

1990 252 12

1991 406 23

1992 773 21

1993 1334 19

1994 2340 15

1995 2412 18

Year Incidents Advisories

1996 2573 27

1997 2134 28

1998 3734 13

1999 9859 17

2000 21756 22

2001 52658 37

2002 82094 37

2003 137529 28

• Statistics taken from http://www.cert.org/stats/slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 14

Page 15: Networks and Protocols '2006

Networking Challenges

• Hot topics:◦ Routing and Convergence◦ Security, Trust, and Key Management◦ Network Management and Operations◦ Ad-hoc networks and self-organizing networks◦ Scalable Inter-Domain Quality of Service (QoS)◦ Measurement and Modeling◦ Killer Applications◦ Disappearing (invisible) Networks◦ Interplanetary Internet

=⇒ See RFC 3869 for further information on Internet Research.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 15

Page 16: Networks and Protocols '2006

Internet Model

Media Media

Subnetwork

Internet

Transport

Subnetwork

NetworkInternet

Transport Router

Application

End System

Application ProcessApplication Process

Endsystem

Application

Subnetwork

• Subnetworks only have to provide very basic services• Even the Internet layer can be used as a subnetwork

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 16

Page 17: Networks and Protocols '2006

Design Principles

• Connectivity is its own reward• All functions which require knowledge of the state of

end-to-end communication should be realized at theendpoints (end-to-end argument)

• There is no central instance which controls the Internet andwhich is able to turn it off

• Addresses should uniquely identify endpoints• Intermediate systems should be stateless wherever possible• Implementations should be liberal in what they accept and

stringent in what they generate• Keep it simple (when in doubt during design, choose the

simplest solution)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 17

Page 18: Networks and Protocols '2006

Internet Addresses

• Four byte IPv4 adresses are typically written as four decimalnumbers separated by dots where every decimal numberrepresents one byte (dotted quad notation). A typicalexample is the IPv4 address 212.201.48.1

• Sixteen byte IPv6 addresses are typically written as asequence of hexadecimal numbers seperated by colons (: )where every hexadecimal number represents two bytes

• Leading nulls in IPv6 addresses can be omitted and twoconsecutive colons can represent a sequence of nulls

• The IPv6 address 1080:0:0:0:8:800:200C:417A can bewritten as 1080::8:800:200C:417A

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 18

Page 19: Networks and Protocols '2006

Internet Domain Names

nl de edu org net bizcom

iu−bremen

faculty

toplevel

3rd level

4th levelwww

virtual root

2nd level

• The Domain Name System (DNS) provides a distributedhierarchical name space which supports the delegation ofname assignments

• DNS name resolution translates DNS names into one ormore Internet addresses

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 19

Page 20: Networks and Protocols '2006

Autonomous Systems

• The global Internet consists of a set of inter-connectedautonomous systems

• An autonomous system (AS) is a set of routers and networksunder the same administration

• Autonomous systems are identified by 16-bit numbers, calledthe AS numbers

• IP packets are forwarded between autonomous systems overpaths that are established by an Exterior Gateway Protocol(EGP)

• Within an autonomous system, IP packets are forwardedover paths that are established by an Interior GatewayProtocol (IGP)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 20

Page 21: Networks and Protocols '2006

Internet Layer

• The Internet Protocol version 4 (IPv4) provides fortransmitting datagrams from sources to destinations using 4byte IPv4 addresses

• The Internet Control Message Protocol version 4 (ICMPv4) isused for IPv4 error reporting and testing

• The Address Resolution Protocol (ARP) maps IPv4addresses to IEEE 802 addresses

• The Internet Protocol version 6 (IPv6) provides fortransmitting datagrams from sources to destinations using 16byte IPv6 addresses

• The Internet Control Message Protocol version 6 (ICMPv6) isused for IPv6 error reporting, testing, auto-configuration andaddress resolution

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 21

Page 22: Networks and Protocols '2006

Internet Routing Protocols

• The Routing Information Protocol (RIP) is a simple distancevector IGP routing protocol based on the Bellman-Fordshortest paths algorithm

• The Open Shortest Path First (OSPF) IGP routing protocolfloods link state information so that every node can computeshortest paths using Dijkstra’s shortest path algorithm

• The Intermediate System to Intermediate System (IS-IS)routing protocol is another link state routing protocol adoptedfrom the ISO/OSI standards

• The Border Gateway Protocol (BGP) EGP routing protocolpropagates reachability information between ASs, which isused to make policy-based routing decisions

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 22

Page 23: Networks and Protocols '2006

Internet Transport Layer

• The User Datagram Protocol (UDP) provides a simpleunreliable best-effort datagram service

• The Transmission Control Protocol (TCP) provides abidirectional, connection-oriented and reliable data stream

• The Stream Control Transmission Protocol (SCTP) providesa reliable transport service supporting sequenced delivery ofmessages within multiple streams, maintaining applicationprotocol message boundaries (application protocol framing)

• The Datagram Congestion Control Protocol (DCCP) providesa congestion controlled, unreliable flow of datagrams suitablefor use by applications such as streaming media

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 23

Page 24: Networks and Protocols '2006

Application Layer

• The TELNET protocol provides a bi-directional, eight-bit byteoriented network virtual terminal

• The File Transfer Protocol (FTP) transports files betweencomputers, shielding differences in storage systems

• The Simple Mail Transfer Protocol (SMTP) is used to transferemail reliably and efficiently

• The Internet Message Access Protocol (IMAP) allows aclient to access and manipulate electronic mail messages ona server

• The Hypertext Transfer Protocol (HTTP) is anapplication-level protocol for distributed, collaborative,hypermedia information systems

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 24

Page 25: Networks and Protocols '2006

Application Layer

• The Secure Shell (SSH) protocol provides a secure remotelogin and other secure network services over an insecurenetwork

• The Network News Transfer Protocol (NNTP) is used for thedistribution, inquiry, retrieval, and posting of Netnews articles

• The Real-Time Transport Protocol (RTP) provides atransport service for real-time multi-media applications wheredifferent data streams have to be synchronized, usuallyimplemented on top of UDP

• The Open Network Computing Remote Procedure Call(ONC-RPC) protocol allows programs to invoke procedureson remote computers

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 25

Page 26: Networks and Protocols '2006

Infrastructure

• The Domain Name System (DNS) protocol is primarily usedto resolve DNS names to Internet addresses

• The Network Time Protocol (NTP) provides the mechanismsto synchronize time and coordinate time distribution in alarge, diverse internet

• The Simple Network Management Protocol (SNMP) can beused to monitor and control network elements

• The Lightweight Directory Access Protocol (LDAP) providesaccess to directories (yellow pages services)

• The Transport Layer Security (TLS) protocol allowsclient/server applications to communicate in a way that isdesigned to prevent eavesdropping, tampering, or messageforgery

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 26

Page 27: Networks and Protocols '2006

Sockets

• Sockets are abstract communication endpoints with a rathersmall number of associated function calls

• The socket API consists of◦ address formats for various network protocol families◦ functions to create, name, connect, destroy sockets◦ functions to send and receive data◦ functions to convert human readable names to addresses

and vice versa◦ functions to multiplex I/O on several sockets

• Sockets are the de-facto standard communication APIprovided by operating systems

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 27

Page 28: Networks and Protocols '2006

Socket Types

• Stream sockets (SOCK_STREAM) represent bidirectionalreliable communcation endpoints

• Datagram sockets (SOCK_DGRAM) represent bidirectionalunreliable communcation endpoints

• Raw sockets (SOCK_RAW) represent endpoints which cansend/receive interface layer datagrams

• Reliable delivered message sockets (SOCK_RDM) aredatagram sockets with reliable datagram delivery

• Sequenced packet scokets (SOCK_SEQPACKET) are streamsockets which retain data block boundaries

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 28

Page 29: Networks and Protocols '2006

Generic Socket Addresses

#include <sys/socket.h>

struct sockaddr {

uint8_t sa_len / * address length (BSD) * /

sa_family_t sa_family; / * address family * /

char sa_data[...]; / * data of some size * /

};

struct sockaddr_storage {

uint8_t ss_len; / * address length (BSD) * /

sa_family_t ss_family; / * address family * /

char padding[...]; / * padding of some size * /

};

• A struct sockaddr represents an abstract address,typically casted to a struct for a concrete address format

• A struct sockaddr_storage provides storage space

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 29

Page 30: Networks and Protocols '2006

IPv4 Socket Addresses

#include <sys/socket.h>

#include <netinet/in.h>

typedef ... sa_family_t;

typedef ... in_port_t;

struct in_addr {

uint8_t s_addr[4]; / * IPv4 address * /

};

struct sockaddr_in {

uint8_t sin_len; / * address length (BSD) * /

sa_family_t sin_family; / * address family * /

in_port_t sin_port; / * transport layer port * /

struct in_addr sin_addr; / * IPv4 address * /

};

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 30

Page 31: Networks and Protocols '2006

IPv6 Socket Addresses

#include <sys/socket.h>

#include <netinet/in.h>

typedef ... sa_family_t;

typedef ... in_port_t;

struct in6_addr {

uint8_t s6_addr[16]; / * IPv6 address * /

};

struct sockaddr_in6 {

uint8_t sin6_len; / * address length (BSD) * /

sa_family_t sin6_family; / * address family * /

in_port_t sin6_port; / * transport layer port * /

uint32_t sin6_flowinfo; / * flow information * /

struct in6_addr sin6_addr; / * IPv6 address * /

uint32_t sin6_scope_id; / * scope identifier * /

};

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 31

Page 32: Networks and Protocols '2006

Connection-Less Communication

data

data

close()

socket()

recvfrom()

sendto()

sendto()

recvfrom()

socket()

bind()

bind()

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 32

Page 33: Networks and Protocols '2006

Connection-Oriented Communication

bind()

listen()

accept()

data

connect()

write()

read()data

connection release

read()

write()

close() close()

socket()

socket()

connection setup

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 33

Page 34: Networks and Protocols '2006

Socket API Summary

#include <sys/types.h>

#include <sys/socket.h>

#include <unistd.h>

#define SOCK_STREAM ...

#define SOCK_DGRAM ...

#define SCOK_RAW ...

#define SOCK_RDM ...

#define SOCK_SEQPACKET ...

#define AF_LOCAL ...

#define AF_INET ...

#define AF_INET6 ...

#define PF_LOCAL ...

#define PF_INET ...

#define PF_INET6 ...

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 34

Page 35: Networks and Protocols '2006

Socket API Summary

int socket(int domain, int type, int protocol);

int bind(int socket, struct sockaddr * addr,

socklen_t addrlen);

int connect(int socket, struct sockaddr * addr,

socklen_t addrlen);

int listen(int socket, int backlog);

int accept(int socket, struct sockaddr * addr,

socklen_t * addrlen);

ssize_t write(int socket, void * buf, size_t count);

int send(int socket, void * msg, size_t len, int flags);

int sendto(int socket, void * msg, size_t len, int flags,

struct sockaddr * addr, socklen_t addrlen);

ssize_t read(int socket, void * buf, size_t count);

int recv(int socket, void * buf, size_t len, int flags);

int recvfrom(int socket, void * buf, size_t len, int flags,

struct sockaddr * addr, socklen_t * addrlen);

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 35

Page 36: Networks and Protocols '2006

Socket API Summary

int shutdown(int socket, int how);

int close(int socket);

int getsockopt(int socket, int level, int optname,

void * optval, socklen_t * optlen);

int setsockopt(int socket, int level, int optname,

void * optval, socklen_t optlen);

int getsockname(int socket, struct sockaddr * addr,

socklen_t * addrlen);

int getpeername(int socket, struct sockaddr * addr,

socklen_t * addrlen);

• All API functions operate on abstract socket addresses• Not all functions make equally sense for all socket types

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 36

Page 37: Networks and Protocols '2006

Mapping Names to Addresses

#include <sys/types.h>

#include <sys/socket.h>

#include <netdb.h>

#define AI_PASSIVE ...

#define AI_CANONNAME ...

#define AI_NUMERICHOST ...

struct addrinfo {

int ai_flags;

int ai_family;

int ai_socktype;

int ai_protocol;

size_t ai_addrlen;

struct sockaddr * ai_addr;

char * ai_canonname;

struct addrinfo * ai_next;

};

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 37

Page 38: Networks and Protocols '2006

Mapping Names to Addresses

int getaddrinfo(const char * node,

const char * service,

const struct addrinfo * hints,

struct addrinfo ** res);

void freeaddrinfo(struct addrinfo * res);

const char * gai_strerror(int errcode);

• Many books still document the old name and addressmapping functions◦ gethostbyname()◦ gethostbyaddr()◦ getservbyname()◦ getservbyaddr()

which are IPv4 specific and should not be used anymore

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 38

Page 39: Networks and Protocols '2006

Mapping Addresses to Names

#include <sys/types.h>

#include <sys/socket.h>

#include <netdb.h>

#define NI_NOFQDN ...

#define NI_NUMERICHOST ...

#define NI_NAMEREQD ...

#define NI_NUMERICSERV ...

#define NI_NUMERICSCOPE ...

#define NI_DGRAM ...

int getnameinfo(const struct sockaddr * sa,

socklen_t salen,

char * host, size_t hostlen,

char * serv, size_t servlen,

int flags);

const char * gai_strerror(int errcode);

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 39

Page 40: Networks and Protocols '2006

Multiplexing

#include <sys/select.h>

typedef ... fd_set;

FD_ZERO(fd_set * set);

FD_SET(int fd, fd_set * set);

FD_CLR(int fd, fd_set * set);

FD_ISSET(int fd, fd_set * set);

int select(int n, fd_set * readfds, fd_set * writefds,

fd_set * exceptfds, struct timeval * timeout);

int pselect(int n, fd_set * readfds, fd_set * writefds,

fd_set * exceptfds, struct timespec * timeout,

sigset_t sigmask);

• select() works with arbitrary file descriptors• select() frequently used to implement the main loop of

event-driven programsslides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 40

Page 41: Networks and Protocols '2006

References[1] B. Carpenter. Architectural Principles of the Internet. RFC 1958, IAB, June 1996.

[2] B. Carpenter. Internet Transparency. RFC 2775, IBM, February 2000.

[3] R. Gilligan, S. Thomson, J. Bound, J. McCann, and W. Stevens. Basic Socket InterfaceExtensions for IPv6. RFC 3493, Intransa Inc., Cisco, Hewlett-Packard, February 2003.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 41

Page 42: Networks and Protocols '2006

2. Fundamental Concepts

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 42

Page 43: Networks and Protocols '2006

Topologies

Meshed NetworkRing

Bus

Line

Star

• The topology of a network describes the way in which nodesattached to the network are interconnected

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 43

Page 44: Networks and Protocols '2006

Topologies

• Star:◦ Nodes are directly connected to a central node◦ Simple routing◦ Good availability if central node is highly reliable

• Ring:◦ Nodes are connected to form a ring◦ Simple routing◦ Limited reliability, failures require reconfiguration

• Meshed Network:◦ Nodes are directly connected to all other nodes◦ Very good reliability

◦ Requires n(n−1)2 links for n nodes

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 44

Page 45: Networks and Protocols '2006

Topologies

• Bus:◦ Nodes are attached to a shared medium◦ Simple routing◦ Good availability if the bus is highly reliable

• Line:◦ Nodes are connected to form a line◦ Average reliability◦ Network position influences transmission delays

• Line topologies are especially important in the case n = 2(point to point links)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 45

Page 46: Networks and Protocols '2006

Structured Cabling

• Networks in office buildings are typically hierarchicallystructured:◦ Every floor has a (potentially complex) network segment

(usually using star topologies)◦ The floor network segments are connected by a backbone

network◦ Multiple buildings are interconnected by connecting the

backbone networks of the buildings• Cabling infrastructure in the buildings should be useable for

different purposes (voice network, data network)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 46

Page 47: Networks and Protocols '2006

Lifetimes of Network Components

• Typical lifetimes:◦ Network rooms and cable ways (20-40 years)◦ Fibre wires (about 15 years)◦ Copper wires (about 8 years)◦ Cabling should survive 3 generations of active network

components

• For more details on structured cabling, see the internationalstandard ISO/IEC 11801

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 47

Page 48: Networks and Protocols '2006

Communication Channel Model

physical transmission medium

ouput signal y(t)input signal x(t)

source

encoder

signal x’(t) signal y’(t)

decoder

distortion z’(t)

sink

• Signals are in general modified during transmission

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 48

Page 49: Networks and Protocols '2006

Transmission Impairments

• Attenuation:◦ The strength of a signal falls off with distance over any

transmission medium◦ For guided media, attenuation is generally an exponential

function of the distance◦ For unguided media, attenuation is a more complex

function of distance and the makeup of the atmosphere• Delay distortion:

◦ Delay distortion occurs because the velocity ofpropagation of a signal through a guided medium varieswith frequency

◦ Various frequency components of a signal will arrive atthe receiver at different times

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 49

Page 50: Networks and Protocols '2006

Transmission Impairments

• Noise◦ Thermal noise (white noise) is due to thermal agitation of

electrons and is a function of temperature◦ Intermodulation noise can occur if signals at different

frequencies share the same transmission medium◦ Crosstalk is an unwanted coupling between signal paths◦ Impulse noise consists of irregular pulses or noise spikes

of short duration and of relatively high amplitude

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 50

Page 51: Networks and Protocols '2006

Channel Characteristics

• The data rate (bit rate) describes the data volume that canbe transmitted per time interval (e.g., 100 Mbit/s)

• The bit width is the time needed to transmit a single bit (e.g.,1 microsecond for 1 Mbit/s)

propagation delay

����������������������������������������������������

����������������������������������������������������

1. bit

transmission delay

last bit

• The delay is the time needed to transmit a message from thesource to the sink

• The delay consists of the propagation delay and thetransmission delay

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 51

Page 52: Networks and Protocols '2006

Transmission Media

• Copper wires:◦ Simple wires◦ Twisted pair◦ Coaxial cables

• Optical wires:◦ Fibre (multimode and single-mode)

• Air:◦ Radio waves◦ Micro waves◦ Infrared waves◦ Light waves

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 52

Page 53: Networks and Protocols '2006

Simple Electrical Wires

• Simple two-wire open lines are the simplest transmissionmedium

• Adequate for connecting equipment up to 50 m apart usingmoderate bit rates

• The signal is typically a voltage or current level relative tosome ground level

• Simple wires can easily experience crosstalk caused bycapacitive coupling

• The open structure makes wires suspectible to pick-up noisesignals from other electrical signal sources

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 53

Page 54: Networks and Protocols '2006

Twisted Pairs

• A twisted pair consists of two insulated copper wires• Twisting the wires in a helical form cancels out waves• Unshielded twisted pair (UTP) of category 3 was the

standard cabling up to 1988• UTP category 5 and above are now widely used for wiring

(less crosstalk, better signals over longer distances)• Shielded twisted pair (STP) cables have an additional shield

further reducing noise

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 54

Page 55: Networks and Protocols '2006

Coaxial Cable

Insulation

Core Protective plasticOuter conductor

• Coax cables are shielded (less noise) and suffer less fromattenuation

• Data rates of 500 mbps over several kilometers with a errorprobability of 10−7 achievable

• Widely used for cable television broadcast networks (whichin some countries are heavily used for data communicationtoday)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 55

Page 56: Networks and Protocols '2006

Fibre

Core

Cladding

Jacket

Sheath

• The glass core is surrounded by a glass cladding with alower index of refraction to keep the light in the core

• Multimode fiber have a thick core (20-50 micrometer) andpropagate light using continued refraction

• Single-mode fiber have a thin core (2-10 micrometer) whichguides the light through the fiber

• High data rates, low error propability, thin, lightweight, immueto electromagnetic interference

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 56

Page 57: Networks and Protocols '2006

Electromagnetic Spectrum

100 102 104 106 108 1010 1012 1014 1016 1018 1020 1022 1024

104 106 108 1010 1012 1014 1016

FMradio

AMradio

UV

f(Hz)

f(Hz)

TV

LWL

radio waves micro waves infrared waves

light waves

xray waves gamma waves

satellites

micro waves

twisted pair

coax cables

• Usage of most frequencies is controlled by legislation• The Industrial/Scientific/Medical (ISM) band (2400-2484

MHz) can be used without special licenses

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 57

Page 58: Networks and Protocols '2006

Parallel vs. Serial Data Transmission

• Parallel:◦ A data word (e.g., a byte) is transmitted in a single step

(all bits transmitted concurrently)◦ Requires multiple channels/connections between sender

and receiver• Serial:

◦ A data word (e.g., a byte) is transmitted as an orderedsequence of bits

◦ Only one channel necessary between sender and receiver

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 58

Page 59: Networks and Protocols '2006

Digital Signal Encoding

• Bits must be encoded as high/low frequencies or voltages• Important characteristics:

◦ Clocking· Must be able to detect the start and the end of a bit· Usually no common clock between sender and receiver

◦ DC component· Reduce the DC component of the transmission

◦ Resynchronization· Allow receivers to synchronize at the beginning of a

transmission

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 59

Page 60: Networks and Protocols '2006

Return-To-Zero Encoding

0 1 0 0 0 1 1

high

low

• 1s are represented by high signals and 0s by low signals• The width of a 1 rectangle is only half of the bit interval• Signal rate (baud rate) higher than the data rate (bit rate)• No clock regeneration, potentially high DC component

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 60

Page 61: Networks and Protocols '2006

Non-Return-To-Zero Encoding

0 1 0 0 0 1 1

high

low

• 1s are represented by high signals and 0s by low signals• Changes of the signal level only occur at bit boundaries• No clock regeneration, potentially high DC component

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 61

Page 62: Networks and Protocols '2006

Non-Return-To-Zero-Mark Encoding

0 1 0 0 0 1 1

low

high

• NRZ-M changes the signal level when a 1 is transmitted• A 0 bit does not change the signal level• Differential encoding technique (signal changes are easier to

detect under noise)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 62

Page 63: Networks and Protocols '2006

Non-Return-To-Zero-Inverse Encoding

0 1 0 0 0 1 1

low

high

• NRZ-I changes the signal level when a 0 is transmitted• A 1 bit does not change the signal level• Differential encoding technique (signal changes are easier to

detect under noise)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 63

Page 64: Networks and Protocols '2006

Manchester Encoding

0 1 0 0 0 1 1

low

high

• A 1 bit is represented by a signal level change from high tolow in the middle of the bit interval

• A 0 bit is represented by a signal level change from low tohigh in the middle of the bit interval

• At least on signal level change per bit interval (clocking)• Every bit interval has a high and low signal level

(no DC component)slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 64

Page 65: Networks and Protocols '2006

Alternate Mark Insertion Encoding

0 1 0 0 0 1 1

high

zero

low

• The representation of a 1 bit alternates between high(positive) and low (negative) signal level.

• A 0 bit is represented by the signal level zero.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 65

Page 66: Networks and Protocols '2006

Media Access

fixed raster

time division multiplexing

media access

dynamic

decentralized centralized

concurrent ordered

frequency division multiplexing

• Shared transmission media require coordinated access tothe medium (media access control)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 66

Page 67: Networks and Protocols '2006

Frequency Devision Multiplexing

��������������������������������������������������������������������������������������������

��������������������������������������������������������������������������������������������

��������������������������������������������������������������������������������������������

��������������������������������������������������������������������������������������������

channel 1

channel 2

channel 3

channel 4

channel 5

time

frequency

• Signals are carried simultaneously on the same medium byallocating to each signal a different frequency band

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 67

Page 68: Networks and Protocols '2006

Wavelength Division Multiplexing (WDM)

• Optical fibers carry multiple wavelength at the same time• WDM allows very large data rates over a single optical fiber• Dense WDM (DWDM) is a variation where the wavelengths

are spaced close together, which results in a larger numberof channels.

• Theoretically, there is room for 1250 10 Gbps channels (=12.5 Tbps) on a single fiber.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 68

Page 69: Networks and Protocols '2006

Time Division Multiplexing

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

������������������������

frequency

chan

nel 1

chan

nel 3

chan

nel .

..

chan

nel n

chan

nel 2

time

chan

nel 1

chan

nel 2

chan

nel 3

chan

nel .

..

chan

nel n

• Signals from a given sources are assigned to specific timeslots

• Time slot assignment might be fixed (synchronous TDM) ordynamic (statistical TDM)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 69

Page 70: Networks and Protocols '2006

Pure Aloha

������������

������������

������������

������������

������������

������������

Station A:

Station B:

Station C:

time

• Developed in the 1970s at the University of Hawai• Sender sends data as soon as data becomes available• Collisions are detected by listening to the signal• Retransmit after a random pause after a collision• Not very efficient (≈ 18 % of the channel capacity)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 70

Page 71: Networks and Protocols '2006

Slotted Aloha

������������

������������

������������

������������Station A:

Station B:

Station C:

time

• Senders do not send immediately but wait for the beginningof a time slot

• Time slots may be advertised by short control signals• Collisions only happen at the start of a transmission• Avoids sequences of partially overlaying data blocks• Slightly more efficient (≈ 37 % of the channel capacity)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 71

Page 72: Networks and Protocols '2006

Carrier Sence Multiple Access (CSMA)

������������

������������

������������

������������

Station A:

Station B:

Station C:

time

• Sense the media whether it is unused before starting atransmission

• Collisions are still possible (but less likely)• 1-persistent CSMA: sender sends with probability 1• p-persistent CSMA: sender sends with probability p• non-persistent CSMA: sender waits for a random time period

before it retries if the media is busy

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 72

Page 73: Networks and Protocols '2006

CSMA with Collision Detection (CSMA-CD)

����

����

����

����

Station A:

Station B:

Station C:

time

• Terminate the transmission as soon as a collision has beendetected (and retry after some random delay)

• Let τ be the propagation delay between two stations withmaximum distance

• Senders can be sure that they successfully acquired themedium after 2τ time units

• Used by the classic Ethernet developed at Xerox Parc

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 73

Page 74: Networks and Protocols '2006

Multiple Access with Collision Avoidance (MACA)

Station A:

Station B:

Station C:

CTSRTS

time

• A station which is ready to send first sends a short RTS(ready to send) message to the receiver

• The receiver respondes with a short CTS (clear to send)message

• Stations who receive RTS or CTS must stay quiet• Solves the hidden station and exposed station problem

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 74

Page 75: Networks and Protocols '2006

Token

Station A:

Station B:

Station C:

time

• A token is a special bit pattern circulating between stations -only the station holding the token is allowed to send data

• Token mechanisms naturally match physical ring topologies -logical rings may be created on other physical topologies

• Care must be taken to handle lost or duplicate token

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 75

Page 76: Networks and Protocols '2006

Transmission Error Detection

• Data transmission often leads to transmission errors thataffect one or more bits

• Simple parity bits can be added to code words to detect biterrors

• Parity bit schemes are not very strong in detecting errorswhich affect multiple bits

• Computation of error check codes must be efficient (inhardware and/or software)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 76

Page 77: Networks and Protocols '2006

Cyclic Redundancy Check (CRC)

• A bit sequence (bit block) bnbn−1 . . . b1b0 is represented as apolynomial B(x) = bnxn + bn−1x

n−1 + . . . + b1x + b0

• Arithmetic operations:

0 + 0 = 1 + 1 = 0 1 + 0 = 0 + 1 = 1

1 · 1 = 1 0 · 0 = 0 · 1 = 1 · 0 = 0

• A generator polynomial G(x) = grxr + . . . g1x + g0 with gr = 1

and g0 = 1 is agreed upon between the sender and thereceiver

• The sender transmits U(x) = xr · B(x) + t(x) with

t(x) = (xr · B(x)) mod G(x)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 77

Page 78: Networks and Protocols '2006

Cyclic Redundancy Check (CRC)

• The receiver tests whether the polynomial corresponding tothe received bit sequence can be divided by G(x) without aremainder

• Efficient hardware implementation possible using XOR gatesand shift registers

• Only errors divisible by G(x) will go undetected

• Example:◦ Generator polynomial G(x) = x3 + x2 + 1 (corresponds to

the bit sequence 1101)◦ Message M = 1001 1010 (corresponds to the polynomial

B(x) = x7 + x4 + x3 + x)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 78

Page 79: Networks and Protocols '2006

CRC Computation

1001 1010 000 : 1101

1101

----

100 1

110 1

-----

10 00

11 01

-----

1 011

1 101

-----

1100

1101

----

1 000

1 101

-----

101 => transmitted bit sequence 1001 1010 101

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 79

Page 80: Networks and Protocols '2006

CRC Verification

1001 1010 101 : 1101

1101

----

100 1

110 1

-----

10 00

11 01

-----

1 011

1 101

-----

1100

1101

----

1 101

1 101

-----

0 => remainder 0, assume no transmission error

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 80

Page 81: Networks and Protocols '2006

Choosing Generator Polynomials

• G(x) detects all single-bit errors if G(x) has more than onenon-zero term

• G(x) detects all double-bit errors, as long as G(x) has afactor with three terms

• G(x) detects any odd number of errors, as long as G(x)contains the factor (x + 1)

• G(x) detects any burst errors for which the length of the burstis less than or equal to r

• G(x) detects a fraction of error bursts of length r + 1; thefraction equals to 1 − 2−(r−1)

• G(x) detects a fraction of error bursts of length greater thanr + 1; the fraction equals to 1 − 2−r

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 81

Page 82: Networks and Protocols '2006

Well-known Generator Polynomials

• The HEC polynomial G(x) = x8 + x2 + x + 1 is used by theATM cell header

• The CRC-16 polynomial G(x) = x16 + x15 + x2 + 1 detects allsingle and double bit errors, all errors with an odd number ofbits, all burst errors with 16 or less bits and more than 99% ofall burst errors with 17 or more bits

• The CRC-CCITT polynomial G(x) = x16 + x15 + x5 + 1 is usedby the HDLC protocol

• The CRC-32 polynomial G(x) =

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1is used by the IEEE 802 standards

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 82

Page 83: Networks and Protocols '2006

Internet Checksum

uint16_tchecksum(uint16_t * buf, int count){

uint32_t sum = 0;while (count--) {

sum += * buf++;if (sum & 0xffff0000) {

sum &= 0xffff;sum++;

}}return ˜(sum & 0xffff);

}

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 83

Page 84: Networks and Protocols '2006

Internet Checksum Properties

• Summation is commutative and associative• Computation independent of the byte order• Computation can be parallelized on processors with word

sizes larger than 16 bit• Individual data fields can be modified without having to

recompute the whole checksum• Can be integrated into copy loop• Often implemented in assembler or special hardware• For details, see RFC 1071, RFC 1141, and RFC 1624

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 84

Page 85: Networks and Protocols '2006

Further Error Situations

• Despite bit errors, the following transmission errors can occur◦ Loss of complete data frames◦ Duplication of complete data frames◦ Receipt of data frames that we never send◦ Reordering of data frames during transmission

• In addition, the sender must adapt its speed to the speed ofthe receiver (end-to-end flow control)

• Finally, the sender must react to congestion situations in thenetwork (congestion control)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 85

Page 86: Networks and Protocols '2006

Sequence Numbers

• The sender assigns growingsequence numbers to all dataframes

• Receiver can detect reorderedor duplicated frames

• Loss of a frame can bedetermined if a missing framecannot travel in the networkanymore

• Sequence numbers can growquickly on fast networks

sender

1

2

3

4

5

6

7

8

1

3

4

6

5

4

7

8

receiver

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 86

Page 87: Networks and Protocols '2006

Acknowledgements

• Retransmit to handle errors• A positive acknowledgement

(ACK) is sent to inform thesender that the transmission ofa frame was successful

• A negative acknowledgement(NACK) is sent to inform thesender that the transmission ofa frame was unsuccessful

• Stop-and-wait protocol: a frameis only transmitted if the previousframe was been acknowledged

sender

n

ACK n

n+1

n+1 (error)

ACK n

NACK n+1

n+1

n+1

ACK n+1

ACK n+1

NACK n+1

n

receiver

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 87

Page 88: Networks and Protocols '2006

Timers

• Timer can be used to detect theloss of frames oracknowledgments

• Sender can use a timer toretransmit a frame if noacknowledgment has beenreceived in time

• Receiver can use a timer toretransmit acknowledgments

• Problem: Timers must adapt tothe current delay in the network

sender

n

nACK n

nACK n

ACK n

n

n+1

n+1

n+1ACK n+1

ACK n+1

receiver

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 88

Page 89: Networks and Protocols '2006

Flow Control

• Allow the sender to sendmultiple frames before waitingfor acknowledgments

• Improves efficiency and overalldelay

• Sender must not overflow thereceiver

• The stream of frames should besmooth and not bursty

• Speed of the receiver can varyover time

n+0

n+0ACK n+0

ACK n+3

ACK n+3

n+3

n+6

n+6ACK n+6

ACK n+6

n+1

n+2

n+4

n+1

n+3

n+2ACK n+1

ACK n+2ACK n+1

ACK n+2

ACK n+0

n+5

n+6

n+4

n+5ACK n+5n+6ACK n+6n+4ACK n+4

n+7

n+8

n+9

n+7

n+8

n+9

ACK n+7

ACK n+8

ACK n+9

ACK n+4

ACK n+7

ACK n+8

ACK n+9

ACK n+5

sender receiver

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 89

Page 90: Networks and Protocols '2006

Sliding Window Flow Control

• Sender and receiver agree on a window of the sequencenumber space

• The sender may only transmit frames whose sequencenumber falls into the sender’s window

• Upon receipt of an acknowledgement, the sender’s window ismoved

• The receiver only accepts frames who sequence numbersfall into the receiver’s window

• Frames with increasing sequence number are delivered andthe receiver window is moved.

• The size of the window controls the speed of the sender andmust match the puffer capacity of the receiver

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 90

Page 91: Networks and Protocols '2006

Sliding Window Implementation

• Implementation on the sender side:◦ SWS(send window size)◦ LAR (last ack received)◦ LFS (last frame send)◦ Invariant: LFS - LAR+ 1 ≤ SWS

• Implementation on the receiver side:◦ RWS(receiver window size)◦ LFA (last frame acceptable)◦ NFE(next frame expected)◦ Invariant: LFA - NFE+ 1 ≤ RWS

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 91

Page 92: Networks and Protocols '2006

Congestion Control

• Flow control is used to control adapt the speed of the senderto the speed of the receiver

• Congestion control is used to adapt the speed of the senderto the speed of the network

• Principles:◦ Sender and receiver reserve bandwidth and puffer

capacity in the network◦ Intermediate systems drop frames under congestion and

signal the event to the senders involved◦ Intermediate systems send control messages (choke

packets) when congestion builds up to slow down senders

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 92

Page 93: Networks and Protocols '2006

OSI Reference Model

End System

Physical

Data Link

Transport

Session

Presentation

Application

Transport

Physical

Data Link

Network Network

Media Media

Application Process

Apl

icat

ion

Sys

tem

Tra

nspo

rt S

yste

m

Application Process

End System

Transport S

ystemA

pplication System

Application

Presentation

Session

Network

Data Link

Physical

Transit System

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 93

Page 94: Networks and Protocols '2006

Physical and Data Link Layer

• Physical Layer:◦ Transmission of an unstructured bit stream◦ Standards for cables, connectors and sockets◦ Encoding of binary values (voltages, frequencies)◦ Synchronization between sender and receiver

• Data Link Layer:◦ Transmission of bit sequences in so called frames◦ Data transfer between directly connected systems◦ Detection and correction of transmission errors◦ Flow control between senders and receivers◦ Realization usually in hardware

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 94

Page 95: Networks and Protocols '2006

Network and Transport Layer

• Network Layer:◦ Determination of paths through a complex network◦ Multiplexing of end-to-end connections over an

intermediate systems◦ Error detection / correction between network nodes◦ Flow and congestion control between end systems◦ Transmission of datagrams or packets in packet switched

networks• Transport Layer:

◦ Reliable end-to-end communication channels◦ Connection-oriented and connection-less services◦ End-to-end error detection and correction◦ End-to-end flow and congestion control

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 95

Page 96: Networks and Protocols '2006

Session and Presentation Layer

• Session Layer:◦ Synchronization and coordination of communicating

processes◦ Interaction control (check points)

• Presentation Layer:◦ Harmonization of different data representations◦ Serialization of complex data structures◦ Data compression

• Application Layer:◦ Fundamental application oriented services◦ Terminal emulationen, name and directory services, data

base access, network management, electronic messagingsystems, process and machine control, . . .

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 96

Page 97: Networks and Protocols '2006

3. Local Area Networks (IEEE 802)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 97

Page 98: Networks and Protocols '2006

IEEE 802 Overview

802.1 Bridging

802.2 Logical Link Control

Physical802.3

Ethernet

Physical802.4

Token Bus

Physical802.5

Token Ring

Physical802.6

Physical802.9

Physical802.11

Physical802.12

WaveLan

Medium802.3

Access

802.4MediumAccess

802.5MediumAccess

802.6MediumAccess

802.9MediumAccess

802.12MediumAccess

802.11MediumAccess

DQDB

802.

1 M

anag

emen

t

802

Ove

rvie

w a

nd A

rchi

tect

ure

• IEEE 802 standards are developed since the mid 1980s• Dominating technology in local area networks (LANs)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 98

Page 99: Networks and Protocols '2006

IEEE 802 Layers

End−System

Physical

Data Link

Transport

Application

Network

Application S

ystemT

ransport System

Physical (PHY)

Media Access Control (MAC)

Logical Link Control (LLC)

IEE

E 802

Representation

Session

Application Process

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 99

Page 100: Networks and Protocols '2006

IEEE 802 Layers

• The Logical Link Control (LLC) layer provides a serviceinterface which is the same for all IEEE 802 protocols

• The Medium Access Control (MAC) layer defines the methodused to access the media being used

• The Physical (PHY) layer defines the physical properties forthe various transmission media that can be used with acertain IEEE 802.x protocol

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 100

Page 101: Networks and Protocols '2006

IEEE 802 Addresses

• IEEE 802 addresses, sometimes also called MACaddresses, are 6 bytes (48 bit) long

• The common notation is a sequence of hexadecimalnumbers with the bytes separated from each other usingcolons or hyphens ( 00:D0:59:5C:03:8A or00-D0-59-5C-03-8A )

• The highest bit indicates whether it is a unicast address (0)or a multicast address (1). The second highest bit indicateswhether it is a local (1) or a global (0) address

• The broadcast address, which represents all stations within abroadcast domain, is FF-FF-FF-FF-FF-FF

• Globally unique addresses are created by vendors who applyfor a number space delegation by the IEEE

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 101

Page 102: Networks and Protocols '2006

IEEE 802.3 (Ethernet)

• Evolution of Ethernet Technology:1976 Original Ethernet paper published1990 10 Mbps Ethernet over twisted pair (10BaseT)1995 100 Mbps Ethernet1998 1 Gbps Ethernet2002 10 Gbps Ethernet2010* 100 Gbps Ethernet (predicted)

• Classic Ethernet used CSMA/CD and a shared bus• Today’s Ethernet is using a star topology with full duplex links• Link aggregation allows to “bundle” links

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 102

Page 103: Networks and Protocols '2006

IEEE 802.3 Frame Format

start−of−frame delimiter (SFD)

destination MAC address

source MAC address

length / type field

preamble

data

frame check sequence (FCS)

(network layer packet)

1 Byte

7 Byte

6 Byte

6 Byte

2 Byte

46−1500 Byte

4 Byte

padding (if required)

64−1

518

Byt

eslides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 103

Page 104: Networks and Protocols '2006

Transmitting IEEE 802.3 Frames

wait for frame to transmit

format frame for transmission

carrier sense signal on?

wait interframe gap time

start transmission

collision detected?

complete transmission andset status transmission done

set status attempt limit exceeded

transmit jam sequence andincrement # attempts

attempt limit reached?

compute and wait backoff time

YN

N

N

Y

Y

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 104

Page 105: Networks and Protocols '2006

Receiving IEEE 802.3 Frames

incoming signal detected?

set carrier sense signal on

obtain bit sync and wait for SFD

receive frame

FCS and frame size OK?

destination address matchesown or group address?

pass data to higher-layerprotocol entity for processing

discard frame

N

N

N

Y

Y

Y

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 105

Page 106: Networks and Protocols '2006

Ethernet Media Types

Name Medium Max. Length

10Base2 coax, ø=0.25 in 200 m

10Base5 coax, ø=0.5 in 500 m

10BaseT twisted pair 100 m

10BaseF fiber optic 2000 m

100BaseT4 twisted pair 100 m

100BaseTX twisted pair 100 m

100BaseFX fiber optic 412 m

1000BaseLX fiber optic 500 / 550 / 5000 m

1000BaseSX fiber optic 220-275 / 550 m

1000BaseCX coax 25 m

1000BaseT twisted pair 100 m

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 106

Page 107: Networks and Protocols '2006

Bridged IEEE 802 Networks

B1

B2

10Base2

10Base2

10Base5

100BaseT

B3

802.11

802.5

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 107

Page 108: Networks and Protocols '2006

IEEE 802 Bridges

IEEE 802.3 PHY

IEEE 802.3 MAC

Network

IEEE 802.2 LLC

IEEE 802.3 MAC

IEEE 802.11 PHY

IEEE 802.11 MAC

IEEE 802.3 PHY

IEEE 802.2 LLC

Bridge

IEEE 802.11 PHY

IEEE 802.11 MAC

Network

IEEE 802.2 LLC

• Source Routing Bridges: Sender has to route the framethrough the bridged network

• Transparent Bridges: Bridges are transparent to senders andreceivers

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 108

Page 109: Networks and Protocols '2006

Transparent Bridges (IEEE 802.1D)

Station Portnumberaddress

Forwardingdatabase

Bridge

protocol

entity

Port

management

software

MACchipset

Memorybuffers

MACchipset

Port 1 Port 2

• Lookup an entry with a matching destination address in theforwarding database and forward the frame to the associatedport.

• If no matching entry exists, forward the frame to all outgoingports except the port from which the frame was received(flooding).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 109

Page 110: Networks and Protocols '2006

Backward Learning

• Algorithm:◦ The forwarding database is initially empty.◦ Whenever a frame is received, add an entry to the

forwarding database (if it does not yet exist) using theframe’s source address and the incoming port number.

◦ Reinitialize the timer attached to the forwarding baseentry for the received frame.

• Aging of unsused entries reduces forwarding table size andallows bridges to adapt to topology changes.

• Backward learning requires an cyclic-free topology.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 110

Page 111: Networks and Protocols '2006

Spanning Tree

1. The root of the spanning tree is selected (root bridge). Theroot bridge is the bridge with the highest priority and thesmallest bridge address.

2. The costs for all possible paths from the root bridge to thevarious ports on the bridges is computed (root path cost).Every bridge determines which root port is used to reach theroot bridge at the lowest costs.

3. The designated bridge is determined for each segment. Thedesignated bridge of a segment is the bridge which connectsthe segment to the root bridge with the lowest costs on itsroot port. The ports used to reach designated bridges arecalled designated ports.

4. All ports are blocked which are not designated ports. Theresulting active topology is a spanning tree.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 111

Page 112: Networks and Protocols '2006

Port States

• Blocking: A port in the blocking state does not participate inframe forwarding.

• Listening: A port in the transitional listening state has beenselected by the spanning tree protocol to participate in fameforwarding.

• Learning: A port in the transitional learning state is preparingto participate in frame forwarding.

• Forwarding: A port in the forwarding state forwards frames.• Disabled: A port in the disabled state does not participate in

frame forwarding or the operation of spanning tree protocol.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 112

Page 113: Networks and Protocols '2006

Port State Transitions

Blocking

Listening

Forwarding

Learning

Disabled

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 113

Page 114: Networks and Protocols '2006

Broadcast Domains

• A bridged LAN defines a single broadcast domain:◦ All frames send to the broadcast address are forwarded

on all links in the bridged networks.◦ Broadcast traffic can take a significant portion of the

available bandwidth.◦ Devices running not well-behaving applications can cause

broadcast storms.◦ Bridges may flood frames if the MAC address cannot be

found in the forwarding table.• It is desirable to reduce the size of broadcast domains in

order to separate traffic in a large bridged LAN.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 114

Page 115: Networks and Protocols '2006

IEEE 802.1Q Virtual LANs

• VLANs allow to separate the traffic on an IEEE 802 network• A station connected to a certain VLAN only sees frames

belonging to that VLAN• VLANs can reduce the network load; frames that are

targeted to all stations (broadcasts) will only be delivered tothe stations connected to the VLAN.

• Stations (especially server) can be a member of multipleVLANs simultaneously

• Separation of logical LAN topologies from physical LANtopologies

• VLANs are identified by a VLAN identifier (1..4094)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 115

Page 116: Networks and Protocols '2006

IEEE 802.1Q Tagged Frames

start−of−frame delimiter (SFD)

destination MAC address

source MAC address

preamble

1 Byte

7 Byte

6 Byte

6 Byte

length / type field

data

frame check sequence (FCS)

(network layer packet)

2 Byte

46−1500 Byte

4 Byte

padding (if required)

2 Bytetag protocol identifier

vlan identifierpriority CF

I

64−1

522

Byt

e

• The tag protocolidentifier indicates atagged frame.

• Tagged 802.3 framesare 4 bytes longerthan original 802.3frames.

• Tagged frames shouldonly appear on linksthat are VLAN aware.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 116

Page 117: Networks and Protocols '2006

VLAN Membership

• Bridge ports can be assigned to VLANs in different ways:◦ Ports are administratively assigned to VLANs (port-based

VLANs)◦ MAC addresses are administratively assigned to VLANs

(MAC address-based VLANs)◦ Frames are assigned to VLANs based on the payload

contained in the frames (protocol-based VLANs)◦ Members of a certain multicast group are assigned to

VLAN (multicast group VLANs)• The Generic Attribute Registration Protocol (GARP) can

(among other things) propagate VLAN membershipinformation.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 117

Page 118: Networks and Protocols '2006

IEEE 802.1x Port Access Control

• Port based access control grants access to the a switch portbased on the identity of the connected machine.

• The components involved in 802.1x:◦ The supplicant runs on a machine connecting to a bridge

and provides authentication information.◦ The authenticator runs on a bridge and enforces

authentication decisions.◦ The authentication server is a (logically) centralized

component which provides authentication decisions(usually via RADIUS).

• The authentication exchange uses the ExtensibleAuthentication Protocol (EAP).

• IEEE 802.1x is becoming increasingly popular as a roamingsolution for IEEE 802.11 wireless networks.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 118

Page 119: Networks and Protocols '2006

IEEE 802.11

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 119

Page 120: Networks and Protocols '2006

References

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 120

Page 121: Networks and Protocols '2006

4. Internet Network Layer

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 121

Page 122: Networks and Protocols '2006

Internet Model

Media Media

Subnetwork

Internet

Transport

Subnetwork

NetworkInternet

Transport Router

Application

End System

Application ProcessApplication Process

Endsystem

Application

Subnetwork

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 122

Page 123: Networks and Protocols '2006

Terminology

• A node is a device which implements an Internet Protocol(such as IPv4 or IPv6).

• A router is a node that forwards IP packets not addressed toitself.

• A host is any node which is not a router.• A link is a communication channel below the IP layer which

allows nodes to communicate with each other (e.g., anEthernet).

• The neighbors is the set of all nodes attached to the samelink.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 123

Page 124: Networks and Protocols '2006

Terminology (cont.)

• An interface is a node’s attachement to a link.• An IP address identifies an interface or a set of interfaces.• An IP packet is a bit sequence consisting of an IP header

and the payload.• The link MTU is the maximum transmission unit, i.e.,

maximum packet size in octets, that can be conveyed over alink.

• The path MTU is the the minimum link MTU of all the links ina path between a source node and a destination node.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 124

Page 125: Networks and Protocols '2006

Internet Network Layer Protocols

• The Internet Protocol version 4 (IPv4) provides fortransmitting datagrams from sources to destinations using 4byte IPv4 addresses

• The Internet Control Message Protocol version 4 (ICMPv4) isused for IPv4 error reporting and testing

• The Address Resolution Protocol (ARP) maps IPv4addresses to IEEE 802 addresses

• The Internet Protocol version 6 (IPv6) provides fortransmitting datagrams from sources to destinations using 16byte IPv6 addresses

• The Internet Control Message Protocol version 6 (ICMPv6) isused for IPv6 error reporting, testing, auto-configuration andaddress resolution

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 125

Page 126: Networks and Protocols '2006

Reserved IPv4 Address Blocks0.0.0.0/8 "This" Network [RFC1700]

10.0.0.0/8 Private-Use Networks [RFC1918]

14.0.0.0/8 Public-Data Networks [RFC1700]

24.0.0.0/8 Cable Television Networks [RFC3330]

39.0.0.0/8 Class A Subnet Experiment [RFC1797]

127.0.0.0/8 Loopback [RFC1700]

128.0.0.0/16 Reserved by IANA [RFC3330]

169.254.0.0/16 Link Local [RFC3330]

172.16.0.0/12 Private-Use Networks [RFC1918]

191.255.0.0/16 Reserved by IANA [RFC3330]

192.0.0.0/24 Reserved by IANA [RFC3330]

192.0.2.0/24 Test-Net / Documentation [RFC3330]

192.88.99.0/24 6to4 Relay Anycast [RFC3068]

192.168.0.0/16 Private-Use Networks [RFC1918]

198.18.0.0/15 Network Interconnect / Device Benchmark Testing [RFC2544]

223.255.255.0/24 Reserved by IANA [RFC3330]

224.0.0.0/4 Multicast [RFC3171]

240.0.0.0/4 Reserved for Future Use [RFC1700]slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 126

Page 127: Networks and Protocols '2006

IPv4 Packet Format

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

|Version| IHL |Type of Service| Total Length |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Identification |Flags| Fragment Offset |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Time to Live | Protocol | Header Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Source Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Destination Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Options | Padding |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 127

Page 128: Networks and Protocols '2006

IPv4 Forwarding

• IPv4 addresses can be devided into a part which identifies anetwork (netid) and a part which identifies an interface of anode within that network (hostid).

• The number of bits of an IPv4 address which identifies thenetwork is called the address prefix.

• The address prefix is commonly written as a decimalnumber, appended to the usual IPv4 address notation byusing a slash (/) as a separator (e.g., 192.0.2.0/24).

• The forwarding table realizes a mapping of the network prefixto the next node (next hop) and the local interface used toreach the next node.

• For every IP packet, the entry in the forwarding table has tobe found with longest matching network address prefix(longest prefix match).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 128

Page 129: Networks and Protocols '2006

IPv4 Forwarding Example

H1

134.169.246.34

134.169.34.12

R2

134.169.9.10

134.169.34.0/24

134.169.0.0/16

134.169.2.1

Next Hop Interface

eth0

H2

134.169.34.1

134.169.2.1

R1

Prefix

0.0.0.0/0134.169.246.34 eth0134.169.34.12 eth1

134.169.0.0/16134.169.34.0/24

134.169.0.0/16134.169.34.0/240.0.0.0/0

Prefix

0.0.0.0/0

Prefix

134.169.34.0/24134.169.34.12

Next Hop

134.169.34.1

Interface

eth0eth0

Interface

eth0eth0eth0

Next Hop

134.169.2.1134.169.246.34134.169.9.10

• Default forwarding table entries use the IPv4 prefix 0.0.0.0/0.• This example identifies directly reachable hosts by using the

IP address of a local interface as the next hop.• Other representations use an explicit direct/indirect flag.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 129

Page 130: Networks and Protocols '2006

Longest Prefix Match: Binary Trie

0 1

H

0 01 1

C D C

B

B

G

F

D

E

1

1

11

0

0

0

0

0

0

A

D J

CD

G

G

0

0

0

0

0

0

0

0

1

1 1

1

1 0

• A binary trie is the representation of the binary prefixes in atree.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 130

Page 131: Networks and Protocols '2006

Longest Prefix Match: Path Compressed Trie

0 1

H

0 01 1

C D C

B

B G

F

D E

1

1 1

1

0

0

0

0

A

D J

C

D

G

G

0 0

0 0

0

1

1 1

1

1

2

3 3

2

3

4 4 4 5

5 5

• A path compressed trie is obtained by collapsing all one-waybranch nodes.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 131

Page 132: Networks and Protocols '2006

Longest Prefix Match: Two-bit stride multibit Trie

00 10

H

01 11

C D C

B F

B E

D JAA

D

00

00

00 1001 11

G G

01

D

00 01

G C C

01 10 11

00 01 10

G D D

100100

B

00 01 10

• A two-bit multibit trie reduces the number of memoryaccesses.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 132

Page 133: Networks and Protocols '2006

IPv4 Error Handling (ICMPv4)

• The Internet Control Message Protocol (ICMP) is used toinform nodes about problems encountered while forwardingIP packets.◦ Echo Request/Reply messages are used to test

connectivity.◦ Unreachable Destination messages are used to report

why a destination is not reachable.◦ Redirect messages are used to inform the sender of a

better (shorter) path.• ICMPv4 is an integral part of IPv4 (even though it is a

different protocol).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 133

Page 134: Networks and Protocols '2006

ICMPv4 Echo Request/Reply

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Identifier | Sequence Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Data ...

+-+-+-+-+-

• The ICMP echo request message (type = 8, code = 0) asksthe destination node to return an echo reply message (type =0, code = 0).

• The Identifier and Sequence Number fields are used tocorrelate incoming replies with outstanding requests.

• The data field may contain any additional data.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 134

Page 135: Networks and Protocols '2006

ICMPv4 Unreachable Destinations

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| unused |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

• The Type field has the value 3 for all unreachable destinationmessages.

• The Code field indicates why a certain destination is notreachable.

• The data field contains the beginning of the packet whichcaused the ICMP unreachable destination message.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 135

Page 136: Networks and Protocols '2006

Unreachable Destination Codes

0 Net Unreachable

1 Host Unreachable

2 Protocol Unreachable

3 Port Unreachable

4 Fragmentation Needed and Don’t Fragment was Set

5 Source Route Failed

6 Destination Network Unknown

7 Destination Host Unknown

8 Source Host Isolated

9 Communication with Destination Network is Administratively Prohibited

10 Communication with Destination Host is Administratively Prohibited

11 Destination Network Unreachable for Type of Service

12 Destination Host Unreachable for Type of Service

13 Communication Administratively Prohibited

14 Host Precedence Violation

15 Precedence cutoff in effect

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 136

Page 137: Networks and Protocols '2006

ICMPv4 Redirect

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Router Internet Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

• The Type field has the value 5 for redirect messages.• The Code field indicates which type of packets should be

redirected.• The Router Internet Address field identifies the IP

router to which packets should be redirected.• The data field contains the beginning of the packet which

caused the ICMP redirect message.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 137

Page 138: Networks and Protocols '2006

Redirect Codes

0 Redirect datagrams for the Network.1 Redirect datagrams for the Host.2 Redirect datagrams for the Type of Service and Network.3 Redirect datagrams for the Type of Service and Host.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 138

Page 139: Networks and Protocols '2006

IPv4 Fragmentation

• IPv4 packets that do not fit the outgoing link MTU will getfragmented into smaller packets that fit the link MTU.◦ The Identification field contains the same value for

all fragments of an IPv4 packet.◦ The Fragment Offset field contains the relative

position of a fragment of an IPv4 packet (counted in 64-bitwords).

◦ The flag More Fragments (MF) is set if morefragments follow.

• The Don’t Fragment (DF) flag can be set to indicate thata packet should not be fragmented.

• IPv4 allows fragments to be further fragmented withoutintermediate reassembly.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 139

Page 140: Networks and Protocols '2006

Fragmentation Considered Harmful

• The receiver must buffer fragments until all fragments havebeen received. However, it is not useful to keep fragments ina buffer indefinitely. Hence, the TTL field of all bufferedpackets will be decremented once per second and fragmentsare dropped when the TTL field becomes zero.

• The loss of a fragment causes in most cases the sender toresend the original IP packet which in most cases getsfragmented as well. Hence, the probability of transmitting alarge IP packet successfully goes quickly down if the lossrate of the network goes up.

• Since the Identification field identifies fragments thatbelong together and the number space is limited, one cannotfragment an arbitrary large number of packets.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 140

Page 141: Networks and Protocols '2006

MTU Path Discovery (RFC 1191)

• The sender sends IPv4 packets with the DFflag set.• A router which has to fragment a packet with the DFflag

turned on drops the packet and sends an ICMP messageback to the sender which also includes the local maximumlink MTU.

• Upon receiving the ICMP message, the sender adapts hisestimate of the path MTU and retries.

• Since the path MTU can change dynamically (since the pathcan change), a once learned path MTU should be verifiedand adjusted periodically.

• Not all routers send necessarily the local link MTU. In thiscases, the sender tries typical MTU values, which is usuallyfaster than doing a binary search.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 141

Page 142: Networks and Protocols '2006

IPv4 over IEEE 802.3 (RFC 894)

• IPv4 packets are sent in the payload of IEEE 802.3 framesaccording to the specification in RFC 894:◦ IPv4 packets are identified by the value 0x800 in the IEEE

802.3 type field.◦ According to the maximum length of IEEE 802.3 frames,

the maximum link MTU is 1500 byte.◦ The mapping of IPv4 addresses to IEEE 802.3 addresses

is table driven. Entries in so called mapping tables(sometimes also called address translation tables) caneither be statically configured or dynamically learned.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 142

Page 143: Networks and Protocols '2006

IPv4 Address Translation (RFC 826)

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Hardware Type | Protocol Type |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| HLEN | PLEN | Operation |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Sender Hardware Address (SHA) =

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

= Sender Hardware Address (SHA) | Sender IP Address (SIP) =

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

= Sender IP Address (SIP) | Target Hardware Address (THA) =

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

= Target Hardware Address (THA) |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Target IP Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

• The Address Resolution Protocol (ARP) resolved IPv4addresses to link-layer addresses of neighboring nodes.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 143

Page 144: Networks and Protocols '2006

ARP and RARP

• The Hardware Type field identifies the address type usedon the link-layer (the value 1 is used for IEEE 802.3 MACaddresses).

• The Protocol Type field identifies the network layeraddress type (the value 0x800 is used for IPv4).

• ARP/RARP packets use the 802.3 type value 0x806.• The Operation field contains the message type: ARP

Request (1), ARP Response (2), RARP Request (3), RARPResponse (4).

• The sender fills, depending on the request type, either theTarget Hardware Address (RARP) field or the TargetIP Address (ARP) field.

• The responding node swaps the Sender/Target fiels and fillsthe empty fields with the requested information.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 144

Page 145: Networks and Protocols '2006

DHCP Version 4 (DHCPv4)

• The Dynamic Host Configuration Protocol (DHCP) allowsnodes to retrieve configuration parameters from a centralconfiguration server.

• A binding is a collection of configuration parameters,including at least an IP address, associated with or bound toa DHCP client.

• Bindings are managed by DHCP servers.• Bindings are typically valid only for a limited lifetime.• See RFC 2131 for the details and the message formats.• See RFC 3118 for security aspects due to lack of

authentication.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 145

Page 146: Networks and Protocols '2006

DHCPv4 Message Types

• The DHCPDISCOVERmessage is a broadcast messagewhich is sent by DHCP clients to locate DHCP servers.

• The DHCPOFFERmessage is sent from a DHCP server tooffer a client a set of configuration parameters.

• The DHCPREQUESTis sent from the client to a DHCP serveras a response to a previous DHCPOFFERmessage, to verify apreviously allocated binding or to extend the lease of abinding.

• The DHCPACKmessage is sent by a DHCP server with someadditional parameters to the client as a positiveacknowledgement to a DHCPREQUEST.

• The DHCPNAKmessage is sent be a DHCP server to indicatethat the client’s notion of a configuration binding is incorrect.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 146

Page 147: Networks and Protocols '2006

DHCPv4 Message Types (cont.)

• The DHCPDECLINEmessage is sent by a DHCP client toindicate that parameters are already in use.

• The DHCPRELEASEmessage is sent by a DHCP client toinform the DHCP server that configuration parameters are nolonger used.

• The DHCPINFORMmessage is sent from the DHCP client toinform the DHCP server that only local configurationparameters are needed.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 147

Page 148: Networks and Protocols '2006

IPv6 Interface Identifier

• Interface identifiers in IPv6 unicast addresses are used touniquely indentify interfaces on a link.

• For all unicast addresses, except those that start with binary000, interface identifiers are required to be 64 bits long andto be constructed in modified EUI-64 format.

• Combination of the interface identifier with a network prefixleads to an IPv6 address.

• Link local unicast addresses have the prefix FE80::/10.• Ongoing work on the construction of globally unique local

addresses using cryptographic hash functions.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 148

Page 149: Networks and Protocols '2006

Modified EUI-64 Format

|0 1|1 3|3 4|

|0 5|6 1|2 7|

+----------------+----------------+---------------- +

|cccccc0gcccccccc|ccccccccmmmmmmmm|mmmmmmmmmmmmmmmm|

+----------------+----------------+---------------- +

|0 1|1 3|3 4|4 6|

|0 5|6 1|2 7|8 3|

+----------------+----------------+---------------- +----------------+

|cccccc1gcccccccc|cccccccc11111111|11111110mmmmmmmm |mmmmmmmmmmmmmmmm|

+----------------+----------------+---------------- +----------------+

• Modified EUI-64 format can be obtained from IEEE 802 MACaddresses.

• However, these constructed IPv6 addresses can be used totrack mobile nodes used in different networks.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 149

Page 150: Networks and Protocols '2006

IPv6 Packet Format (RFC 2460)

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

|Version| Traffic Class | Flow Label |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Payload Length | Next Header | Hop Limit |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| |

+ +

| |

+ Source Address +

| |

+ +

| |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| |

+ +

| |

+ Destination Address +

| |

+ +slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 150

Page 151: Networks and Protocols '2006

IPv6 Extension Header

• All IPv6 header extensions and options are carried in aheader daisy chain.◦ Routing Extension Header (RH)◦ Fragment Extension Header (FH)◦ Authentication Extension Header (AH)◦ Encapsulating Security Payload Extension Header (ESP)◦ Hop-by-Hop Options Extension Header (HO)◦ Destination Options Extension Header (DO)

• LinkMTUs must at least be 1280 bytes and only the sender isallowed to fragment packets.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 151

Page 152: Networks and Protocols '2006

IPv6 Forwarding

• IPv6 packets are forwarded using the longest prefix matchalgorithm which is used in the IPv4 network.

• IPv6 addresses have much longer prefixes which allows todo better address aggregation in order to reduce the numberof forwarding table entries.

• Due to the length of the prefixes, it is even more crucial touse an algorithm whose complexity does not dependent onthe number of entries in the forwarding table or the averageprefix length.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 152

Page 153: Networks and Protocols '2006

IPv6 Error Handling (ICMPv6) (RFC 2463)

• The Internet Control Message Protocol Version 6 (ICMPv6)is used like ICMPv4.

• ICMPv6 is used to report error situations.• ICMPv6 can be used to run diagnostic tests.• ICMPv6 supports the auto-configuration of IPv6 nodes.• ICMPv6 supports the resolution of IPv6 addresses to

link-layer addresses.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 153

Page 154: Networks and Protocols '2006

IPv6 over IEEE 802.3 (RFC 2464)

• IPv6 packets can be encapsulated into IEEE 802.3 framesand sent over IEEE 802.3 packets as defined in RFC 2464:◦ Frames containing IPv6 packets are identified by the

value 0x86dd in the IEEE 802.3 type field.◦ The link MTU is 1500 bytes which corresponds to the

IEEE 802.3 maximum frame size of 1500 byte.◦ The mapping of IPv6 addresses to IEEE 802.3 addresses

is table driven. Entries in so called mapping tables(sometimes also called address translation tables) caneither be statically configured or dynamically learnedusing neighbor discovery.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 154

Page 155: Networks and Protocols '2006

IPv6 Neighbor Discovery (RFC 2461)

• Discovery of the routers attached to a link.• Discovery of the prefixes used on a link.• Discovery of parameters such as the link MTU or the hop

limit for outgoing packets.• Automatic configuration of IPv6 addresses.• Resolution of IPv6 addresses to link-layer addresses.• Determination of next-hop addresses for IPv6 destination

addresses.• Detection of unreachable nodes which are attached to the

same link.• Detection of conflicts during address generation.• Discovery of better alternatives to forward packets.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 155

Page 156: Networks and Protocols '2006

References[1] C. Kent and J. Mogul. Fragmentation Considered Harmful. In Proc. SIGCOMM ’87 Workshop

on Frontiers in Computer Communications Technology, August 1987.

[2] D. C. Plummer. An Ethernet Address Resolution Protocol. RFC 826, MIT, November 1982.

[3] C. Hornig. A Standard for the Transmission of IP Datagrams over Ethernet Networks. RFC 894,Symbolics Cambridge Research Center, April 1984.

[4] J. Mogul and S. Deering. Path MTU Discovery. RFC 1191, DECWRL, Stanford University,November 1990.

[5] R. Droms. Dynamic Host Configuration Protocol. RFC 2131, Bucknell University, March 1997.

[6] R. Droms and W. Arbaugh. Authentication for DHCP Messages. RFC 3118, Cisco Systems,University of Maryland, June 2001.

[7] S. Deering and R. Hinden. Internet Protocol, Version 6 (IPv6) Specification. RFC 2460, Cisco,Nokia, December 1998.

[8] T. Narten, E. Nordmark, and W. Simpson. Neighbor Discovery for IP Version 6 (IPv6). RFC2461, IBM, Sun Microsystems, Daydreamer, December 1998.

[9] A. Conta and S. Deering. Internet Control Message Protocol (ICMPv6) for the Internet ProtocolVersion 6 (IPv6) Specification. RFC 2463, Lucent, Cisco Systems, December 1998.

[10] M. Crawford. Transmission of IPv6 Packets over Ethernet Networks. RFC 2464, Fermilab,December 1998.

[11] IANA. Special-Use IPv4 Addresses. RFC 3330, Internet Assigned Numbers Authority,slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 156

Page 157: Networks and Protocols '2006

5. Internet Routing

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 157

Page 158: Networks and Protocols '2006

Internet Routing Protocols

• The Routing Information Protocol (RIP) is a simple distancevector IGP routing protocol based on the distributedBellman-Ford shortest path algorithm

• The Open Shortest Path First (OSPF) IGP routing protocolfloods link state information so that every node can computeshortest paths using Dijkstra’s shortest path algorithm

• The Intermediate System to Intermediate System (IS-IS)routing protocol is another link state routing protocol adoptedfrom the ISO/OSI standards

• The Border Gateway Protocol (BGP) EGP routing protocolpropagates reachability information between ASs, which isused to make policy-based routing decisions

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 158

Page 159: Networks and Protocols '2006

Bellman-Ford

• Let G = (V,E) be a graph with the vertices V and the edgesE with n = |V | and m = |E|.

• Let D be an n × n distance matrix in which D(i, j) denotesthe distance from node i ∈ V to the node j ∈ V .

• Let H be an n × n matrix in which H(i, j) ∈ E denotes theedge on which node i ∈ V forwards a message to nodej ∈ V .

• Let M be a vector with the link metrics, S a vector with thestart node of the links and D a vector with the end nodes ofthe links.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 159

Page 160: Networks and Protocols '2006

Bellman-Ford (cont.)

1. Set D(i, j) = ∞ for i 6= j and D(i, j) = 0 for i = j.

2. For all edges l ∈ E and for all nodes k ∈ V : Set i = S[l] andj = D[l] and d = M [l] + D(j, k).

3. If d < D(i, k), set D(i, k) = d and H(i, k) = l.

4. Repeat from step 2 if at least one D(i, k) has changed.Otherwise, stop.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 160

Page 161: Networks and Protocols '2006

Bellman-Ford Example (Round 0)

A B C

D E

A Dest. Link Cost

A local 0

B Dest. Link Cost

B local 0

C Dest. Link Cost

C local 0

D Dest. Link Cost

D local 0

E Dest. Link Cost

E local 0

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 161

Page 162: Networks and Protocols '2006

Bellman-Ford Example (Round 1)

A Dest. Link Cost

A local 0

B A-B 1

D A-D 1

B Dest. Link Cost

A A-B 1

B local 0

C B-C 1

E B-E 1

C Dest. Link Cost

B B-C 1

C local 0

E C-E 1

D Dest. Link Cost

A A-D 1

D local 0

E D-E 1

E Dest. Link Cost

B B-E 1

C C-E 1

D D-E 1

E local 0

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 162

Page 163: Networks and Protocols '2006

Bellman-Ford Example (Round 2)

A Dest. Link Cost

A local 0

B A-B 1

C A-B 2

D A-D 1

E A-B 2

B Dest. Link Cost

A A-B 1

B local 0

C B-C 1

D A-B 2

E B-E 1

C Dest. Link Cost

A B-C 2

B B-C 1

C local 0

D C-E 2

E C-E 1

D Dest. Link Cost

A A-D 1

B A-D 2

C D-E 2

D local 0

E D-E 1

E Dest. Link Cost

A B-E 2

B B-E 1

C C-E 1

D D-E 1

E local 0slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 163

Page 164: Networks and Protocols '2006

Count to Infinity

• Consider the following topology:

A --- B --- C

• After some distance vector exchanges, Chas learned that hecan reach A by sending packets via B.

• When the link between A and B breaks, Bwill learn from Cthat he can still reach A at a higher cost (count of hops) bysending a packet to C.

• This information will now be propagated to C, Cwill updatethe hop count and subsequently announce a more expensivenot existing route to B.

• This counting continues until the costs reach inifinity.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 164

Page 165: Networks and Protocols '2006

Split Horizon

• Idea: Nodes never announce the reachability of a network toneighbors from which they have learned that a network isreachable.

• Does not solve the count-to-infinity problem in all cases:A --- B

\ /

C

|

D

• If the link between Cand Dbreaks, Bwill not announce to Cthat it can reach D via Cand Awill not announce to C that itcan reach D via C (split horizon).

• But after the next round of distance vector exchanges, Awillannounce to C that it can reach D via B and Bwill announceto C that it can reach D via A.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 165

Page 166: Networks and Protocols '2006

Split Horizon with Poisoned Reverse

• Idea: Nodes announce the unreachability of a network toneighbors from which they have learned that a network isreachable.

• Does not solve the count-to-infinity problem in all cases:A --- B

\ /

C

|

D

• Cnow actively announces infinity for the destination D to Aand B.

• However, since the exchange of the distance vectors is notsynchronized to a global clock, the following exchange canhappen:

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 166

Page 167: Networks and Protocols '2006

Split Horizon with Poisoned Reverse

1. C first announces infinity for the destination D to A and B.

2. A and B now update their local state with the metric infinity forthe destination Ddirectly via C. The other stale information toreach D via the other directly connected node is not updated.

3. A and B now send their distance vectors. A and B now learnthat they can not reach D via the directly connected nodes.However, C learns that it can reach D via either A or B.

4. Cnow sends its distance vector which contains falseinformation to A and B and the count-to-infinity processstarts.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 167

Page 168: Networks and Protocols '2006

Routing Information Protocol (RIP)

• The Routing Information Protocol version 2 (RIP-2) definedin RFC 2453 is based on the Bellman-Ford algorithm.

• RIP defines infinity to be 16 hops. Hence, RIP can only beused in networks where the longest paths (the networkdiameter) is smaller than 16 hops.

• RIP-2 runs over the User Datagram Protocol (UDP) and usesthe well-known port number 520.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 168

Page 169: Networks and Protocols '2006

RIP Message Format

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Command | Version | must be zero |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| |

˜ RIP Entries ˜

| |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

• The Commandfield indicates, whether the message is arequest or a response.

• The Version field contains the protocol version number.• The RIP Entries field contains a list of so called fixed sizeRIP Entries .

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 169

Page 170: Networks and Protocols '2006

RIP Message Format (cont.)

0 1 2 3 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Address Family Identifier | Route Tag |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| IP Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Subnet Mask |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Next Hop |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Metric |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

• The Address Family Identifier field identifies anaddress family.

• The Route Tag field marks entries which contain externalroutes (established by an EGP).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 170

Page 171: Networks and Protocols '2006

RIP Message Format (cont.)

0 1 2 3 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| 0xFFFF | Authentication Type |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| |

+ +

| |

+ Authentication +

| |

+ +

|

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

• Special RIP entry to support authentication.• Originially only trivial cleartext password authentication.• RFC 2082 defines authentication based on MD5 using a

special RIP message trailer.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 171

Page 172: Networks and Protocols '2006

Dijkstra’s Shortest Path Algorithm

1. All nodes are initially tentatively labeled with infinite costsindicating that the costs are not yet known.

2. The costs of the root node are set to 0 and the root node ismarked as the current node.

3. The current node’s cost label is marked permanent.

4. For each node A adjacent to the current node C, the costsfor reaching A are calculated as the costs of C plus the costsfor the link from C to A. If the sum is less than A’s cost label,the label is updated with the new cost and the name of thecurrent node.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 172

Page 173: Networks and Protocols '2006

Dijkstra’s Shortest Path Algorithm (cont.)

5. If there are still nodes with tentative cost labels, a node withthe smallest costs is selected as the new current node. Gotostep 3 if a new current node was selected.

6. The shortest paths to a destination node is given by followingthe labels from the destination node towards the root.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 173

Page 174: Networks and Protocols '2006

Dijkstra Example

A

BC

D

E

FG

2

4

1

2

2

33

22

4

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 174

Page 175: Networks and Protocols '2006

Dijkstra Example (cont.)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 175

Page 176: Networks and Protocols '2006

Dijkstra Example (cont.)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 176

Page 177: Networks and Protocols '2006

Dijkstra Example (cont.)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 177

Page 178: Networks and Protocols '2006

Dijkstra Example (cont.)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 178

Page 179: Networks and Protocols '2006

Dijkstra Example (cont.)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 179

Page 180: Networks and Protocols '2006

Dijkstra Example (cont.)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 180

Page 181: Networks and Protocols '2006

Dijkstra Example (cont.)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 181

Page 182: Networks and Protocols '2006

Open Shortest Path First (OSPF)

• The Open Shortest Path First (OSPF) protocol defined inRFC 2328 is a link state routing protocol.

• Every node independently computes the shortest paths to allthe other nodes by using Dijkstra’s shortest path algorithm.

• The link state information is distributed by flooding.• OSPF introduces the concept of areas in order to control the

flooding and computational processes.• An OSPF area is a group of a set of networks within an

autonomous system.• The internal topology of an OSPF area is invisible for other

OSPF areas. The routing within an area (intra-area routing)is constrainted to that area.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 182

Page 183: Networks and Protocols '2006

OSPF Areas

• The OSPF areas are inter-connected via the OSPFbackbone area (OSPF area 0). A path from a source nodewithin one area to a destination node in another area hasthree segments (inter-area routing):1. An intra-area path from the source to a so called area

border router.2. A path in the backbone area from the area border of the

source area to the area border router of the destinationarea.

3. An intra-area path from the area border router of thedestination area to the destination node.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 183

Page 184: Networks and Protocols '2006

OSPF Router Classification

• OSPF routers are classified according to their location in theOSPF topology:1. Internal Router: A router where all interfaces belong to

the same OSPF area.2. Area Border Router: A router which connects multiple

OSPF areas. An area border router has to be able to runthe basic OSPF algorithm for all areas it is connected to.

3. Backbone Router: A router that has an interface to thebackbone area. Every area border router is automaticallya backbone router.

4. AS Boundary Router: A router that exchanges routinginformation with routers belonging to other autonomoussystems.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 184

Page 185: Networks and Protocols '2006

OSPF Stub Areas

• Stub Areas are OSPF areas with a single area border router.• The routing in stub areas can be simplified by using default

forwarding table entries which significantly reduces theoverhead.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 185

Page 186: Networks and Protocols '2006

OSPF Message Header

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Version # | Type | Packet Length |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Router ID |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Area ID |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Checksum | AuType |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Authentication |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Authentication |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 186

Page 187: Networks and Protocols '2006

OSPF Hello Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

: :

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Network Mask |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| HelloInterval | Options | Rtr Pri |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| RouterDeadInterval |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Designated Router |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Backup Designated Router |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Neighbor |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| ... |

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 187

Page 188: Networks and Protocols '2006

OSPF Database Description Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

: :

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Interface MTU | Options |0|0|0|0|0|I|M|MS

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| DD sequence number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| |

+- -+

| |

+- An LSA Header -+

| |

+- -+

| |

+- -+

| |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| ... |

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 188

Page 189: Networks and Protocols '2006

OSPF Link State Request Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

: :

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| LS type |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Link State ID |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Advertising Router |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| ... |

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 189

Page 190: Networks and Protocols '2006

OSPF Link State Update Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

: :

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| # LSAs |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| |

+- +-+

| LSAs |

+- +-+

| ... |

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 190

Page 191: Networks and Protocols '2006

OSPF Link State Ack. Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

: :

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| |

+- -+

| |

+- An LSA Header -+

| |

+- -+

| |

+- -+

| |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| ... |

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 191

Page 192: Networks and Protocols '2006

OSPF Link State Advertisement Header

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

: :

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| LS age | Options | LS type |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Link State ID |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Advertising Router |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| LS sequence number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| LS checksum | length |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 192

Page 193: Networks and Protocols '2006

Border Gateway Protocol (RFC 1771)

• The Border Gateway Protocol version 4 (BGP-4) exchangesreachability information between autonomous systems.

• BGP-4 peers construct AS connectivity graphs to◦ detect and prune routing loops and◦ enforce policy decisions.

• BGP peers generally advertise only routes that should beseen from the outside (advertising policy).

• The final decision which set of announced paths is actuallyused remains a local policy decision.

• BGP-4 runs over a reliable transport (TCP) and uses thewell-known port 179.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 193

Page 194: Networks and Protocols '2006

AS Categories (RFC 1772)

• Stub AS:◦ An AS that has only a single connection to one other AS.◦ A stub AS only carries local traffic.

• Multihomed AS:◦ An AS that has connections to more than one other AS,

but refuses to carry transit traffic.• Transit AS:

◦ An AS that has connections to more than one other AS,and is designed (under certain policy restrictions) to carryboth transit and local traffic.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 194

Page 195: Networks and Protocols '2006

Routing Policies

• Policies are provided to BGP in the form of configurationinformation and determined by the AS administration.

• Examples:1. A multihomed AS can refuse to act as a transit AS for

other AS’s. (It does so by only advertising routes todestinations internal to the AS.)

2. A multihomed AS can become a transit AS for a subset ofadjacent AS’s, i.e., some, but not all, AS’s can use themultihomed AS as a transit AS. (It does so by advertisingits routing information to this set of AS’s.)

3. An AS can favor or disfavor the use of certain AS’s forcarrying transit traffic from itself.

• Routing Policy Specification Language (RFC 2622)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 195

Page 196: Networks and Protocols '2006

BGP Routing Table Statistics

• http://bgp.potaroo.net/• See also: G. Huston, "The BGP Routing Table", Internet

Protocol Journal, March 2001

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 196

Page 197: Networks and Protocols '2006

BGP-4 Phases and Messages

• Once the transport connection has been established, BGP-4basically goes through three phases:1. The BGP4 peers exchange OPENmessages to open and

confirm connection parameters2. The BGP4 peers exchange initially the entire BGP routing

table. Incremental updates are sent as the routing tableschange. Uses BGP UPDATEmessages.

3. The BGP4 peers exchange so called KEEPALIVEmessages periodically to ensure that the connection andthe BGP-4 peers are alive.

• Errors lead to a NOTIFICATION message and subsequentclose of the transport connection.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 197

Page 198: Networks and Protocols '2006

BGP-4 Message Header

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| |

+ +

| |

+ +

| Marker |

+ +

| |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Length | Type |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

• The Marker is used for authentication and synchronization.• The Type field indicates the message type and the Length

field its length.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 198

Page 199: Networks and Protocols '2006

BGP-4 Open Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+

| Version |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Autonomous System Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Hold Time |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| BGP Identifier |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Opt Parm Len |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| |

| Optional Parameters |

| |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 199

Page 200: Networks and Protocols '2006

BGP-4 Open Message

• The Version field contains the protocol version number.• The Autonomous System Number field contains the 16-bit

AS number of the sender.• The Hold Time field specifies the maximum time that the

receiver should wait for a response from the sender.• The BGP Identifier field contains a 32-bit value which

uniquely identifies the sender.• The Opt Parm Len field contains the total length of theOptional Parameters field or zero if no optionalparameters are present.

• The Optional Parameters field contains a list ofparameters. Each parameter is encoded using atag-length-value (TLV) triple.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 200

Page 201: Networks and Protocols '2006

BGP-4 Update Message

+-------------------------------------------------- ---+

| Unfeasible Routes Length (2 octets) |

+-------------------------------------------------- ---+

| Withdrawn Routes (variable) |

+-------------------------------------------------- ---+

| Total Path Attribute Length (2 octets) |

+-------------------------------------------------- ---+

| Path Attributes (variable) |

+-------------------------------------------------- ---+

| Network Layer Reachability Information (variable) |

+-------------------------------------------------- ---+

• The UPDATEmessage consists of two parts:1. The list of unfeasible routes that are being withdrawn.2. The feasible route to advertise.

• The Unfeasible Routes Length field indicates the totallength of the Withdrawn Routes field in bytes.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 201

Page 202: Networks and Protocols '2006

BGP-4 Update Message

• The Withdrawn Routes field contains a list of IPv4address prefixes that are being withdrawn from service.

• The Total Path Attribute Length field indicates thetotal length of the Path Attributes field in bytes.

• The Path Attributes field contains a list of path attributesconveying information such as◦ the origin of the path information,◦ the sequence of AS path segments,◦ the IPv4 address of the next hop border router, or◦ the local preference assigned by a BGP4 speaker.

• The Network Layer Reachability Information fieldcontains a list of IPv4 prefixes that are reachable via the pathdescribed in the path attributes fields.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 202

Page 203: Networks and Protocols '2006

BGP-4 Notification Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Error code | Error subcode | Data |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +

| |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

• NOTIFICATION messages are used to report errors.• The transport connection is closed immediately after sending

a NOTIFICATION .• Six error codes plus 20 sub-codes.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 203

Page 204: Networks and Protocols '2006

BGP-4 Keep Alive Message

• BGP-4 peers periodically exchange KEEPALIVEmessages.• A KEEPALIVEmessage consists of the standard BGP-4

header with no additional data.• KEEPALIVEmessages are needed to verify that shared state

information is still present.• If a BGP-4 peer does not receive a message within the HoldTime , then the peer will assume that there is acommunication problem and tear down the connection.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 204

Page 205: Networks and Protocols '2006

6. Internet Transport Layer

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 205

Page 206: Networks and Protocols '2006

Internet Transport Layer

Transport Layer

IP Layer

SMTP HTTP FTP

IP Address + Port Number

IP Address

• Network layer addresses identify interfaces on nodes(node-to-node significance).

• Transport layer addresses identify communicating applicationprocesses (end-to-end significance).

• 16 bit port numbers enable the multiplexing anddemultiplexing of packets at the transport layer.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 206

Page 207: Networks and Protocols '2006

Internet Transport Layer Protocols

• The User Datagram Protocol (UDP) provides a simpleunreliable best-effort datagram service.

• The Transmission Control Protocol (TCP) provides abidirectional, connection-oriented and reliable data stream.

• The Stream Control Transmission Protocol (SCTP) providesa reliable transport service supporting sequenced delivery ofmessages within multiple streams, maintaining applicationprotocol message boundaries (application protocol framing).

• The Datagram Congestion Control Protocol (DCCP) providesa congestion controlled, unreliable flow of datagrams suitablefor use by applications such as streaming media.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 207

Page 208: Networks and Protocols '2006

IPv4 Pseudo Header

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Source Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Destination Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| unused (0) | Protocol | Length |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

• Pseudo headers are used during checksum computation.• Exclude header fields that are modified by routers.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 208

Page 209: Networks and Protocols '2006

IPv6 Pseudo Header

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| |

+ +

| |

+ Source Address +

| |

+ +

| |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| |

+ +

| |

+ Destination Address +

| |

+ +

| |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Upper-Layer Packet Length |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 209

Page 210: Networks and Protocols '2006

User Datagram Protocol (UDP)

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Source Port | Destination Port |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Length | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

• UDP (RFC 768) provides an unreliable datagram transportservice.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 210

Page 211: Networks and Protocols '2006

User Datagram Protocol (UDP)

• The Source Port field contains the port number used bythe sending application layer process.

• The Destination Port field contains the port numberused by the receiving application layer process.

• The Length field contains the length of the UDP datagramincluding the UDP header counted in bytes.

• The Checksum field contains the Internet checksumcomputed over the pseudo header, the UDP header and thepayload contained in the UDP packet.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 211

Page 212: Networks and Protocols '2006

Transmission Control Protocol (TCP)

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Source Port | Destination Port |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Sequence Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Acknowledgment Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Offset| Reserved | Flags | Window |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Checksum | Urgent Pointer |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

| Options | Padding |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+

• TCP (RFC 793) provides a bidirectional connection-orientedand reliable data stream over an unreliable connection-lessnetwork protocol.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 212

Page 213: Networks and Protocols '2006

Transmission Control Protocol (TCP)

• The Source Port field contains the port number used bythe sending application layer process.

• The Destination Port field contains the port numberused by the receiving application layer process.

• The Sequence Number field contains the sequence numberof the first data byte in the segment. During connectionestablishment, this field is used to establish the initialsequence number.

• The Acknowledgment Number field contains the nextsequence number which the sender of the acknowledgementexpects.

• The Offset field contains the length of the TCP headerincluding any options, counted in 32-bit words.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 213

Page 214: Networks and Protocols '2006

Transmission Control Protocol (TCP)

• The Flags field contains a set of binary flags:◦ URG: Indicates that the Urgent Pointer field is

significant.◦ ACK: Indicates that the Acknowledgment Number field

is significant.◦ PSH: Data should be pushed to the application as quickly

as possible.◦ RST: Reset of the connection.◦ SYN: Synchronization of sequence numbers.◦ FIN : No more data from the sender.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 214

Page 215: Networks and Protocols '2006

Transmission Control Protocol (TCP)

• The Window field indicates the number of data bytes whichthe sender of the segment is willing to receive.

• The Checksum field contains the Internet checksumcomputed over the pseudo header, the TCP header and thedata contained in the TCP segment.

• The Urgent Pointer field points, relative to the actualsegment number, to important data if the URGflag is set.

• The Options field can contain additional options.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 215

Page 216: Networks and Protocols '2006

TCP Connection Establishment

Active Open

SYN x

SYN xACK x+1, SYN y

Passive Open

ACK x+1, SYN y

ACK y+1

ACK y+1

• Handshake protocol establishes TCP connection parametersand announces options.

• Guarantees correct connection establishment, even if TCPpackets are lost or duplicated.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 216

Page 217: Networks and Protocols '2006

TCP Connection Tear-down

Active Open

FIN x

FIN xACK x+1

Passive Open

ACK x+1

ACK y+1

ACK y+1

ACK x+1, FIN y

ACK x+1, FIN y

• TCP provides initially a bidirectional data stream.• A TCP connection is terminated when both unidirectional

connections have been closed.• It is possible to close only one half of a connection.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 217

Page 218: Networks and Protocols '2006

TCP State Machine

. . . see lecture notes . . .

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 218

Page 219: Networks and Protocols '2006

TCP Flow Control

��������

4K0

����������������

��������

Sender

write(2K)

write(2K)

Receiver

2K | SEQ = 0

2K | SEQ = 2048

ACK = 4096 Win = 0

ACK = 2048 Win = 2048

read(2K)

ACK = 4096 Win = 2048

0 4K

4K0

4K0

• Both TCP engines advertise their buffer sizes duringconnection establishment.

• The available space left in the receiving buffer is advertisedas part of the acknowledgements.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 219

Page 220: Networks and Protocols '2006

Optimizations

• Nagle’s Algorithm◦ When data comes into the sender one byte at a time, just

send the first byte and buffer all the rest until the byte inflight has been acknowledgement.

◦ This algorithm provides noticeable improvementsespecially for interactive traffic where a quickly typing useris connected over a rather slow network.

• Clark’s Algorithm◦ The receiver should not send a window update until it can

handle the maximum segment size it advertised when theconnection was established or until its buffer is half empty.

◦ Prevents the receiver from sending a very small windowupdates (such as a single byte).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 220

Page 221: Networks and Protocols '2006

TCP Congestion Control

• TCP’s congestion control introduces the concept of acongestion window (cwnd) which defines how much data canbe in transit.

• The congestion window is maintained by a TCP sender inaddition to the flow control receiver window (rwnd) which isadvertised by the receiver.

• The sender uses these two windows to limit the data that issent to the network and not yet received (flight size) to theminimum of the receiver and the congestion window:

flightsize ≤ min(cwin, rwin)

• The key problem to be solved is the dynamic estimation ofthe congestion window.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 221

Page 222: Networks and Protocols '2006

TCP Congestion Control (cont.)

• The initial window (IW) is usually initialized using thefollowing formula:

IW = min(4 · SMSS,max(2 · SMSS, 4380bytes))

SMSS is the sender maximum segment size, the size of thelargest sement that the sender can transmit (excludingTCP/IP headers and options).

• During slow start, the congestion window cwnd increases byat most SMSS bytes for every received acknowledgementthat acknowledges data. Slow start ends when cwnd exceedsssthresh or when congestion is observed.

• Note that this algorithm leads to an exponential increase ifthere are multiple segments acknowledged in the cwnd.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 222

Page 223: Networks and Protocols '2006

TCP Congestion Control (cont.)

• During congestion avoidance, cwnd is incremented by onefull-sized segment per round-trip time (RTT). Congestionavoidance continues until congestion is detected. Oneformula commonly used to update cwnd during congestionavoidance is given by the following equation:

cwnd = cwnd + (SMSS ∗ SMSS/cwnd)

This adjustment is executed on every incoming non-duplicateACK.

• When congestion is noticed (the retransmission timerexpires), then cwnd is reset to 1 full-sized segment and theslow start threshold ssthresh is updated as follows:

ssthresh = max(flightsize/2, 2 · SMSS)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 223

Page 224: Networks and Protocols '2006

TCP Congestion Control (cont.)

2 4 106 8 12 14 16 18 20 22 240

4

8

16

12

20

24

28

32

36

40

44

cong

estio

n w

indo

w (

cwin

)

ssthresh

timeout

26 28

transmission burst number

• Congestion control with an initial window size of 2K.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 224

Page 225: Networks and Protocols '2006

Retransmission Timer

• The retransmission timer controls when a segment is resendif no acknowledgement has been received.

• The retransmission timer RTT needs to adapt to round-triptime changes.

• General idea:◦ Measure the current round-trip time◦ Measure the variation of the round-trip time◦ Use the estimated round-trip time plus the measured

variation to calculate the retransmit timeout◦ Do not update the estimators if a segment needs to be

retransmitted (Karn’s algorithm).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 225

Page 226: Networks and Protocols '2006

Retransmission Timer

• If an acknowledgement is received for a segment before theassociated retransmission timer expires:

RTT = α · RTT + (1 − α)M

M is the measured round-trip time; α is typicall 78 .

• The standard deviation is estimated using:

D = α · D + (1 − α)|RTT − M |

α is a smoothing factor.• The retransmission timeout RTO is determined as follows:

RTO = RTT + 4 · D

The factor 4 has been choosen empirically.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 226

Page 227: Networks and Protocols '2006

Fast Retransmit / Fast Recovery

• TCP receivers should send an immediate duplicateacknowledgement when an out-of-order segment arrives.

• The arrival of four identical acknowledgements without thearrival of any other intervening packets is an indication that asegment has been lost.

• The sender performs a fast retransmission of what appearsto be the missing segment, without waiting for theretransmission timer to expire.

• Upon a fast retransmission, the sender does not exercise thenormal congestion reaction with a full slow start sinceacknowledgements are still flowing.

• See RFC 2581 section 3.1 for details.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 227

Page 228: Networks and Protocols '2006

Karn’s Algorithm

• The dynamic estimation of the RTT has a problem if atimeout occurs and the segment is retransmitted.

• A subsequent acknowledgement might acknowledge thereceipt of the first packet which contained that segment orany of the retransmissions.

• Karn suggested that the RTT estimation is not updated forany segments which were retransmitted and that the RTO isdoubled on each failure until the segment gets through.

• The doubling of the RTO leads to an exponential back-off foreach consecutive attempt.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 228

Page 229: Networks and Protocols '2006

Early Congestion Notification

• Idea: Routers signal congestion by setting some special bitsin the IP header.

• The ECN bits are located in the Type-of-Service field of anIPv4 packet or the Traffic-Class field of an IPv6 packet.

• TCP sets the ECN-Echo flag in the header TCP to indicatethat a TCP endpoint has received an ECN marked packet.

• TCP sets the Congestion-Window-Reduced (CWR) flag inthe TCP header to acknowledge the receipt of and reactionto the ECN-Echo flag.

=⇒ ECN uses the ECT and CE flags in the IP header forsignaling between routers and connection endpoints, anduses the ECN-Echo and CWR flags in the TCP header forTCP-endpoint to TCP-endpoint signaling.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 229

Page 230: Networks and Protocols '2006

TCP Performance

• Goal: Simple analytic model for steady state TCP behavior.• We only consider congestion avoidance (no slow start).• W (t) denotes the congestion window size at time t.• In steady state, W (t) increases to a maximum value W

where it experiences congestion. As a reaction, the sendersets the congestion window to 1

2W .

• The time interval needed to go from 12W to W is T and we

can send a window size of packets every RTT .• Hence, the number N of packets is:

N =1

2

T

RTT

(

W

2+ W

)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 230

Page 231: Networks and Protocols '2006

TCP Performance (cont.)

• The time T between two packet losses equalsT = RTT · W/2 since the window increases linearly.

• By equating the total number of packets transferred duringthis period, we get

W

(

W

2+ W

)

=1

p⇐⇒ W =

8

3p

where p is the packet loss probability (thus 1p

packets aretransmitted between each packet loss).

• The average sending rate X(p), that is the number of packetstransmitted during each period, then becomes:

X(p) =1/p

RTT · W/2=

1

RTT

3

2p

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 231

Page 232: Networks and Protocols '2006

TCP Performance (cont.)

• Example:◦ RTT = 200ms, p = 0.05

◦ X(p) ≈ 27.4pps◦ With 1500 byte segments, the data rate becomes≈ 32Kbps

• Given this formula, it becomes clear that high data rates (say10Gbps or 1 Tbps) require an extremely and unrealistic smallpacket error rate.

• TCP extensions to address this problem can be found inRFC 3649 [6].

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 232

Page 233: Networks and Protocols '2006

References[1] J. Postel. User Datagram Protocol. RFC 768, ISI, August 1980.

[2] J. Postel. Transmission Control Protocol. RFC 793, ISI, September 1981.

[3] M. Allman, V. Paxson, and W. Stevens. TCP Congestion Control. RFC 2581, NASAGlenn/Sterling Software, ACIRI/ICSI, April 1999.

[4] K. Ramakrishnan, S. Floyd, and D. Black. The Addition of Explicit Congestion Notification (ECN)to IP. RFC 3168, TeraOptic Networks, ACIRI, EMC, September 2001.

[5] M. Hassan and R. Jain. High Performance TCP/IP Networking. Prentice Hall, 2004.

[6] S. Floyd. HighSpeed TCP for Large Congestion Windows. RFC 3649, ICSI, December 2003.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 233

Page 234: Networks and Protocols '2006

7. Firewalls and Network Address Translators

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 234

Page 235: Networks and Protocols '2006

Middleboxes

• A middlebox is defined in [1] as any intermediary deviceperforming functions other than the normal, standardfunctions of an IP router on the datagram path between asource host and destination host.

• A middlebox is not necessarily a physical box — it is typicallyjust a function implemented in some other box.

• Middleboxes challenge the End-to-End principle and thehourglass model of the Internet architecture.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 235

Page 236: Networks and Protocols '2006

Concerns about Middleboxes

• Protocols designed without consideration of middleboxesmay fail, predictably or unpredictably, in the presence ofmiddleboxes.

• Middleboxes introduce new failure modes; rerouting of IPpackets around crashed routers is no longer the only case toconsider.

• Configuration is no longer limited to the two ends of asession; middleboxes may also require configuration andmanagement.

• Diagnosis of failures and misconfigurations is more complex.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 236

Page 237: Networks and Protocols '2006

Types of Middleboxes

• Network Address Translators (NAT): A function thatdynamically assigns a globally unique address to a host thatdoesn’t have one, without that host’s knowledge.

• NAT with Protocol Translator (NAT-PT): A that performs NATbetween an IPv6 host and an IPv4 network, additionallytranslating the entire IP header between IPv6 and IPv4formats.

• IP Tunnel Endpoints: Tunnel endpoints, including virtualprivate network endpoints, use basic IP services to set uptunnels with their peer tunnel endpoints which might beanywhere in the Internet.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 237

Page 238: Networks and Protocols '2006

Types of Middleboxes (cont.)

• Packet classifiers, markers and schedulers: Packetclassifiers classify packets flowing through them according topolicy and either select them for special treatment or markthem, in particular for differentiated services.

• Transport Relays: A middlebox which translates between twotransport layer instances.

• TCP performance enhancing proxies: “TCP spoofer” aremiddleboxes that modify the timing or action of the TCPprotocol in flight for the purposes of enhancing performance.

• Load balancers that divert/munge packets: Techniques thatdivert packets from their intended IP destination, or makethat destination ambiguous.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 238

Page 239: Networks and Protocols '2006

Types of Middleboxes (cont.)

• IP Firewalls: A function that screens and rejects packetsbased purely on fields in the IP and Transport headers.

• Application Firewalls: Application-level firewalls act as aprotocol end point and relay

• Application-level gateways (ALGs): ALGs translate IPaddresses in application layer protocols and typicallycomplement IP firewalls.

• SOCKS: A stateful mechanism for authenticated firewalltraversal, in which the client host must communicate first withthe SOCKS server in the firewall before it is able to traversethe firewall.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 239

Page 240: Networks and Protocols '2006

Types of Middleboxes (cont.)

• Transcoders: Functions performing some type of on-the-flyconversion of application level data.

• Proxies: An intermediary program which acts as both aserver and a client for the purpose of making requests onbehalf of other clients.

• Caches: Caches are functions typically intended to optimiseresponse times.

• Anonymisers: Functions that hide the IP address of the datasender or receiver. Although the implementation may bedistinct, this is in practice very similar to a NAT plus ALG.

• . . .

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 240

Page 241: Networks and Protocols '2006

Firewalls

• A firewall is a system (or a set of systems) that enforceaccess control policies between two (or more) networks.

• Conservative firewalls allow known desired traffic and rejecteverything else.

• Optimistic firewalls reject known unwanted traffic and allowthe rest.

• Firewalls typically consist of packet filters, transportgateways and application level gateways.

• Firewalls not only protect the “inside” from the “outside”, butalso the “outside” from the “inside”.

⇒ There are many ways to circumvent firewalls if internal andexternal hosts cooperate.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 241

Page 242: Networks and Protocols '2006

Firewall Architectures

External Network(Internet)

Internal Network(Intranet)

Packet Filter

• The simplest architecture is a packet filter which is typicallyimplemented within a router that connects the internalnetwork with the external network.

• Sometimes called a “screening router”.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 242

Page 243: Networks and Protocols '2006

Firewall Architectures

Bastion Host

External Network(Internet)

Internal Network(Intranet)

• A bastion host is a multihomed host connected to the internaland external network which does not forward IP datagramsbut instead provides suitable gateways.

• Effectively prevents any direct communication between hostson the internal network with hosts on the external network.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 243

Page 244: Networks and Protocols '2006

Firewall Architectures

(Intranet)Internal Network

(Internet)External Network

Packet FilterPacket Filter

(HTTP, SMTP, DNS, ...)Server

Demilitarized Zone (DMZ)

Bastion Host

• The most common architecture consists of two packet filterswhich create a demilitarized zone (DMZ).

• Externally visible servers and gateways are located in theDMZ.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 244

Page 245: Networks and Protocols '2006

Packetfilter Example: Linux ipchains

inputchains

forwarding

local process

checksum & sanitychecks

outputchains

forwardchains

• Input chains are lists of filter rules applied to all incomingIP packets.

• Output chains are lists of filter rules applied to alloutgoing IP packet.

• Forward chains are lists of fiter rules applied to allforwarded IP packets.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 245

Page 246: Networks and Protocols '2006

Network Address Translators

• Basic Network Address Translation (NAT):Translates private IP addresses into public IP addresses.

• Network Address Port Translation (NAPT):Translates transport endpoint identifiers. NAPT allows toshare a single public address among many privateaddresses (masquerading).

• Bi-directional NAT (Two-Way NAT):Translates outbound and inbound and uses DNS-ALGs tofacilitate bi-directional name to address mappings.

• Twice NAT :A variation of a NAT which modifies both the source anddestination addresses of a datagram. Used to joinoverlapping address domains.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 246

Page 247: Networks and Protocols '2006

Full Cone NAT

• A full cone NAT is one where all requests from the sameinternal IP address and port are mapped to the sameexternal IP address and port.

• Any external host can send a packet to the internal host, bysending a packet to the mapped external address.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 247

Page 248: Networks and Protocols '2006

Restricted Cone NAT

• A restricted cone NAT is one where all requests from thesame internal IP address and port are mapped to the sameexternal IP address and port.

• Unlike a full cone NAT, an external host (with IP address X)can send a packet to the internal host only if the internal hosthad previously sent a packet to IP address X.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 248

Page 249: Networks and Protocols '2006

Port Restricted Cone NAT

• A port restricted cone NAT is like a restricted cone NAT, butthe restriction includes port numbers.

• Specifically, an external host can send a packet, with sourceIP address X and source port P, to the internal host only ifthe internal host had previously sent a packet to IP addressX and port P.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 249

Page 250: Networks and Protocols '2006

Symmetric NAT

• A symmetric NAT is one where all requests from the sameinternal IP address and port, to a specific destination IPaddress and port, are mapped to the same external IPaddress and port.

• If the same host sends a packet with the same sourceaddress and port, but to a different destination, a differentmapping is used.

• Only the external host that receives a packet can send aUDP packet back to the internal host.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 250

Page 251: Networks and Protocols '2006

References[1] B. Carpenter and S. Brim. Middleboxes: Taxonomy and Issues. RFC 3234, IBM Zurich

Research Laboratory, February 2002.

[2] P. Srisuresh and M. Holdrege. IP Network Address Translator (NAT) Terminology andConsiderations. RFC 2663, Lucent Technologies, August 1999.

[3] B. Carpenter. Internet Transparency. RFC 2775, IBM, February 2000.

[4] N. Freed. Behavior of and Requirements for Internet Firewalls. RFC 2979, Sun, October 2000.

[5] J. Rosenberg, J. Weinberger, C. Huitema, and R. Mahy. STUN - Simple Traversal of UserDatagram Protocol (UDP) Through Network Address Translators (NATs). RFC 3489,dynamicsoft, Microsoft, Cisco, March 2003.

[6] E. D. Zwicky, S. Cooper, and D. B. Chapman. Building Internet Firewalls. O’Reilly, 2 edition,2000.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 251

Page 252: Networks and Protocols '2006

8. Abstract Syntax Notation One

(ASN.1)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 252

Page 253: Networks and Protocols '2006

Motivation and Origin

• The Abstract Syntax Notation One (ASN.1) is a language forthe definition of data structures and message formats whichwas developed in the 1980s.

• Original ASN.1 requirements:◦ Exchange of information between machines with different

hardware architectures.◦ Independence of existing programming languages

(neutrality).◦ Sender and receiver should be able to choose one out of

multiple data encoding formats that suits their needs.• ASN.1 has been standardized by the ITU. Note that current

versions of ASN.1 differ significantly from earlier versions ofASN.1.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 253

Page 254: Networks and Protocols '2006

Abstract vs. Local vs. Transfer Syntax

Abstract Syntax (ASN.1)

Transfer Syntax (ASN.1 Encoding Rules)

Local Syntax

De/Encoder

System A System B

De/Encoder

Local Syntax

Data Exchange

• Separation of the data representation during transmissionfrom the data representation within applications.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 254

Page 255: Networks and Protocols '2006

Abstract vs. Local vs. Transfer Syntax

• The abstract syntax defines data structures in an applicationimplementation neutral format.

• The abstract syntax is mapped to a local syntax which isused in a concrete implementation.

• ASN.1 compilers can be used to generate the local syntaxfrom the abstract syntax.

• The transfer syntax defines how data structures areserialized for transmission over a network.

• A concrete transfer syntax is commonly defined as a set ofencoding rules which define how values of the various ASN.1types are encoded.

• The implementation of the encoding and decoding functionscan be automated by using ASN.1 compilers.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 255

Page 256: Networks and Protocols '2006

Basic Concepts

• ASN.1 definitions basically consist of type and valuedefinitions that are organized into ASN.1 modules.

• Names of ASN.1 data types always begin with an uppercasecharacter.

• Names of ASN.1 values (constants) always begin with alowercase character.

• ASN.1 keywords and macro names only contain uppercasecharacters.

• Comments begin with two hyphens (-- ) and they end eitherat the end of the line or at the next occurance of two hyphens(-- ).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 256

Page 257: Networks and Protocols '2006

ISO/OSI Registration Tree

system(1) interfaces(2) ip(4) icmp(5) tcp(6) udp(7) transmission(10) snmp(11)

standard(0) registration−authority(1) member−body(2) identified−organization(3)

dod(6)

internet(1)

directory(1) mgmt(2) experimental(3) private(4) security(5) snmpV2(6)

mib−2(1) snmpDomains(1) snmpProxy(2) snmpModules(3)

dot5(9)x25(5) dot3(7) fddi(15) lapb(16) ...

... snmpMIB(1) snmpFrameworkMIB(10) ...

itu−t(0) / ccitt(0) joint−iso−itu−t(2) / joint−iso−ccitt(2)iso(1)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 257

Page 258: Networks and Protocols '2006

Registration Tree

• The registration tree is used to uniquely identify artefactssuch as specific protocol definitions or protocol parameters.

• The registration tree provides a hierarchical name space thatcan be used for this purpose.

• The hierarchical structure makes it is possible to delegateauthority.

• For example, the US Department of Defense (dod ) hasdelegated authority over the internet subtree to theInternet Assigned Number Authority (IANA).

• Note that nodes are uniquely identified by the assignednumbers and not necessarily by their associated descriptors.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 258

Page 259: Networks and Protocols '2006

Primitive ASN.1 Data Types

• The data type BOOLEANrepresents the two logical valuesTRUEand FALSE.

• The data type INTEGERrepresents integral numbers. Notethat there is no restriction on the precision. The INTEGERtype can also be used to represent named numbers.

• The data type BIT STRING represents a sequence ofdefined bits. The length of a BIT STRING does not have tobe a multiple of 8.

• The data type OCTET STRINGrepresents a sequence ofoctets (bytes). The OCTET STRINGis a base type forcharacter strings using different character sets or some otherformatted strings such as GeneralizedTime or UTCTime.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 259

Page 260: Networks and Protocols '2006

Primitive ASN.1 Data Types

• The data type ENUMERATEDrepresents an enumeration ofvalues. The set of possible values must be defined whenderiving a type from the ENUMERATEDtype.

• The data type OBJECT IDENTIFIER identifies a node in theISO registration tree. An OBJECT IDENTIFIER valuedetermines the path from the root of the registration tree to atarget node.

• The data type ObjectDescriptor contains a characterstring identifying a node in the ISO registration tree. Notethat the value of an ObjectDescriptor is not guaranteedto uniquely identify a node in the ISO registration tree.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 260

Page 261: Networks and Protocols '2006

Primitive ASN.1 Data Types

• The data type ANYrepresents any valid ASN.1 data type. It isbasically the union of all ASN.1 data types.

• The data type EXTERNALrepresents data structures whichwhich have not been defined with ASN.1. This type is usefulto incorporate non-ASN.1 elements in ASN.1 messages.

• The data type NULL is a place holder, typically used toindicate that a value is missing in a constructed type.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 261

Page 262: Networks and Protocols '2006

Constructed ASN.1 Data Types

• The data type SEQUENCEcorresponds to structs in C orrecords in Modula. The order of the elements of a SEQUENCEis well defined.

• The data type SET is similar to a SEQUENCE. However, theelements of a SETare not ordered.

• The data type SEQUENCE OFrepresents an ordered set (list)of values (which have the same type).

• The data type SET OFrepresents an unordered set (list) ofvalues (which have the same type).

• The data type CHOICEis a selection type and corresponds tounions in C or variant records in Modula.

• The data type REAL is a constructed type representingfloating point numbers. The mantissa and the exponent areINTEGERvalues.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 262

Page 263: Networks and Protocols '2006

Restrictions

Unsigned32 ::= INTEGER (0..4294967295)Integer32 ::= INTEGER (-2147483648..2147483647)Unsigned64 ::= INTEGER (0..18446744073709551615)MacAddress ::= OCTET STRING (SIZE (6))InetAddress ::= OCTET STRING (SIZE (4|16))

• ASN.1 data types can be restricted to reduce the number ofpossible values.

• Typical restrictions are size restrictions and value rangerestrictions. The precise syntax for the restrictions dependson the data type.

• It is usually a good idea to introduce restricted INTEGERtypes that match the precision supported by typicalprocessor hardware.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 263

Page 264: Networks and Protocols '2006

Tags

• Data types have associated tags which can be used toidentify the type of a value during transmission.

• A tag consists of a tag number and a tag class.• There are four different tag classes:

◦ UNIVERSAL: Globally unique identification (tagassignments restricted to ASN.1 standards).

◦ APPLICATION: Unique identification within an application.◦ PRIVATE: Private and not universally used identification.◦ CONTEXT-SPECIFIC: Unique identification within a

certain context (for example within a CHOICE).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 264

Page 265: Networks and Protocols '2006

Universal Tag Numbers

Data type Tag (decimal)

BOOLEAN 1INTEGER 2BIT STRING 3OCTET STRING 4NULL 5OBJECT IDENTIFIER 6ObjectDescriptor 7EXTERNAL 8REAL 9ENUMERATED 10. . . . . .

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 265

Page 266: Networks and Protocols '2006

Universal Tag Numbers

SEQUENCE, SEQUENCE OF16SET, SET OF 17NumericString 18PrintableString 19TeletexString 20VideotextString 21IA5String 22UTCTime 23GeneralizedType 24GraphicsString 25VisibleString 26GeneralString 27CharacterString 28. . . . . .

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 266

Page 267: Networks and Protocols '2006

ASN.1 Example

SNMP-VERSION-1 DEFINITIONS ::= BEGIN

-- object names and types

ObjectName ::= OBJECT IDENTIFIER

ObjectSyntax ::= CHOICE {

simple SimpleSyntax,

application-wide ApplicationSyntax

}

SimpleSyntax ::= CHOICE {

integer-value INTEGER (-2147483648..2147483647),

string-value OCTET STRING (SIZE (0..65535)),

oid-value OBJECT IDENTIFIER,

empty NULL

}

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 267

Page 268: Networks and Protocols '2006

ASN.1 Example

ApplicationSyntax ::= CHOICE {

address-value NetworkAddress,

counter-value Counter32,

gauge-value Gauge32,

timeticks-value TimeTicks,

arbitrary-value Opaque

}

NetworkAddress ::= CHOICE {

internet IpAddress

}

IpAddress ::= [APPLICATION 0] IMPLICIT OCTET STRING (SIZE ( 4))

Counter32 ::= [APPLICATION 1] IMPLICIT INTEGER (0..429496 7295)

Gauge32 ::= [APPLICATION 2] IMPLICIT INTEGER (0..42949672 95)

TimeTicks ::= [APPLICATION 3] IMPLICIT INTEGER (0..429496 7295)

Opaque ::= [APPLICATION 4] IMPLICIT OCTET STRING

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 268

Page 269: Networks and Protocols '2006

ASN.1 Example

Message ::= SEQUENCE {

version INTEGER { version-1(0) },

community OCTET STRING,

data ANY -- PDUs if trivial authentication

}

PDUs ::= CHOICE {

get-request GetRequest-PDU,

get-next-request GetNextRequest-PDU,

get-response GetResponse-PDU,

set-request SetRequest-PDU,

trap Trap-PDU

}

GetRequest-PDU ::= [0] IMPLICIT PDU

GetNextRequest-PDU ::= [1] IMPLICIT PDU

GetResponse-PDU ::= [2] IMPLICIT PDU

SetRequest-PDU ::= [3] IMPLICIT PDU

Trap-PDU ::= [4] IMPLICIT TrapPDU

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 269

Page 270: Networks and Protocols '2006

ASN.1 Example

max-bindings INTEGER ::= 2147483647

RequestID ::= INTEGER (-214783648..214783647)

ErrorIndex ::= INTEGER (0..max-bindings)

ErrorStatus ::= INTEGER { noError(0),

tooBig(1),

noSuchName(2),

badValue(3),

readOnly(4),

genErr(5) }

VarBind ::= SEQUENCE {

name ObjectName,

value ObjectSyntax

}

VarBindList ::= SEQUENCE (SIZE (0..max-bindings)) OF VarB ind

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 270

Page 271: Networks and Protocols '2006

ASN.1 Example

PDU ::= SEQUENCE {

request-id RequestID,

error-status ErrorStatus,

error-index ErrorIndex,

variable-bindings VarBindList

}

TrapPDU ::= SEQUENCE {

enterprise OBJECT IDENTIFIER,

agent-addr NetworkAddress,

generic-trap INTEGER { coldStart(0), warmStart(1),

linkDown(2), linkUp(3),

authenticationFailure(4),

egpNeighborLoss(5),

enterpriseSpecific(6) },

specific-trap INTEGER (0..214783647),

time-stamp TimeTicks,

variable-bindings VarBindList

}

ENDslides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 271

Page 272: Networks and Protocols '2006

Basic Encoding Rules (BER)

• The Basic Encoding Rules (BER) use a tag/length/value(TLV) encoding.

• Every data element is identified by a tag value, the length ofthe data element in bytes and the data element itself.

• The TLV encoding enables a receiver to identify the type ofevery data element which can then be verified against thetype the receiver expects.

• The price for this is a somewhat increased length of theencoded messages.

• There are other ASN.1 encodings like the Packed EncodingRules (PER) which do not generally encode type information.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 272

Page 273: Networks and Protocols '2006

BER Encoding of Tags

47 56 3 2 18

47 56 3 2 18 47 56 3 2 18 47 56 3 2 18 47 56 3 2 18

tag number (< 31)

tag class { universal (00), application(01), context(10), private(11) }tag type { primitive(0), constructed(1) }

1 1 1 1 1 1 1... 0

tag type { primitive(0), constructed(1) }tag class { universal (00), application(01), context(10), private(11) }

tag number (> 31)

• If the tag number is less than 31, the tag number can beencoded in a single byte. Otherwise, the highest bit indicateswhether more tag bytes follow.

• The primitive / constructed allows a decoder todetermine whether the value itself is a BER encoding.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 273

Page 274: Networks and Protocols '2006

BER Encoding of Length

47 56 3 2 18

47 56 3 2 18 47 56 3 2 18 47 56 3 2 18

length (< 128)

0

...

length (> 127)

1

number of bytes encoding length

• A length less than 128 bytes can be encoded in a singlelength byte. Larger length values must be encoded inmultiple bytes.

• The maximum length is 2(127·8) − 1 = 21016 − 1 bytes.• Besides the definite form length encoding, there is an

indefinite form where the end of a value is identified by acertain marker.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 274

Page 275: Networks and Protocols '2006

BER Encoding of BOOLEAN and INTEGER

• BOOLEANvalue is encoded by a single byte. The value TRUEis represented by the byte 0xff and the value FALSE isrepresented by the byte 0x00.

• An INTEGERvalue is encoded as a binary number. Negativenumbers are encoded in two’s complement notation

• Note that it might be necessary to encode a leading 0x00byte for unsigned values. For example, given the followingASN.1 type definition

Unsigned8 ::= INTEGER (0..255)

the decimal value 255 will be encoded using two bytes as0x00ff.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 275

Page 276: Networks and Protocols '2006

BER Encoding of BIT STRING

47 56 3 2 18 47 56 3 2 18 47 56 3 2 18

...

bitsunused bits in last byte

b0 b1 b2 b3 b4 b5 b6 b7

• A BIT STRING value is encoded in a sequence of bytes thatcontain the named bits.

• The byte sequence is prefixed with a byte which indicates thenumber of unused bits in the last byte of the byte sequence.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 276

Page 277: Networks and Protocols '2006

BER Encoding of OCTET STRING and NULL

• An OCTET STRINGvalue is encoded as a sequence of bytes.• Specialized OCTET STRINGvalues are identified by their

specific tag value, but otherwise encoded just as OCTETSTRINGvalues.

• A NULLvalue is encoded using zero bytes.• A NULL is thus encoded by its tag and the length zero.• NULLvalues with special tags may be used to indicate

certain flags or parameters.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 277

Page 278: Networks and Protocols '2006

BER Encoding of OBJECT IDENTIFIER

47 56 3 2 18

47 56 3 2 18 47 56 3 2 18 47 56 3 2 18

sub−identifier (< 128)

sub−identifier (> 127)

0

1 1... 0

• An OBJECT IDENTIFIER value is encoded as a sequenceof sub-identifiers.

• The first two sub-identifier X and Y of an OBJECTIDENTIFIER value are encoded together in a singlesub-identifier using the formula (X · 40) + Y . (This worksbecause X may only hold one of the three values 0, 1 or 2.)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 278

Page 279: Networks and Protocols '2006

BER Encoding of Constructed Types

• SEQUENCE, SEQUENCE OF, SET, and SET OFvalues areencoded by encoding◦ the tag of the constructed type,◦ the length of the constructed type, and◦ the elements contained in these constructed types.

• CHOICEvalues are encoded by encoding the value currentlypresent in the CHOICE.

• This requires that the choice value present can be identifierby its tag value.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 279

Page 280: Networks and Protocols '2006

BER Example

Bytes Tag Length Value

30:1b SEQUENCE { 27

02:01:00 INTEGER 1 0

04:06:70:75:62:6C:69:63 OCTET STRING 6 "public"

a1:0e GetNextRequest-PDU { 14

02:04:36:a2:8f:07 INTEGER 4 916623111

02:01:00 INTEGER 1 0

02:01:00 INTEGER 1 0

30:00 SEQUENCE OF {} 0

}

}

• The example shows the BER encoding of an SNMPmessage which is consistent with the ASN.1 definition shownabove.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 280

Page 281: Networks and Protocols '2006

References[1] ITU. Information technology - Abstract Syntax Notation One (ASN.1): Specification of basic

notation. Recommendation ITU-T X.680, International Telecommunication Union, December1997.

[2] ITU. Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules(BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER).Recommendation ITU-T X.690, International Telecommunication Union, December 1997.

[3] D. Steedman. Abstract Syntax Notation One (ASN.1): The Tutorial and Reference. TechnologyAppraisals, 1990.

[4] G. Neufeld and S. Vuong. An overview of ASN.1. Computer Networks and ISDN Systems,23:393–415, 1992.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 281

Page 282: Networks and Protocols '2006

9. External Data Representation (XDR)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 282

Page 283: Networks and Protocols '2006

External Data Representation (XDR)

• Data structures are defined using the XDR data definitionlanguage, specified in RFC 1832

• The actual data encoding on the wire uses the XDRencoding format as specified in RFC 1832

• XDR supports the following base data types:◦ integer , unsigned integer , enum, bool◦ hyper integer , unsigned hyper integer◦ float , double , quadrupel◦ fixed-length opaque , variable length opaque◦ variable-length string◦ fixed-length arrays, variable-length arrays◦ struct , discriminated union

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 283

Page 284: Networks and Protocols '2006

XDR Language

• The XDR language uses a C-style syntax.• Below is the syntax summary taken from RFC 1832:

declaration:

type-specifier identifier

| type-specifier identifier "[" value "]"

| type-specifier identifier "<" [ value ] ">"

| "opaque" identifier "[" value "]"

| "opaque" identifier "<" [ value ] ">"

| "string" identifier "<" [ value ] ">"

| type-specifier " * " identifier

| "void"

value:

constant

| identifier

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 284

Page 285: Networks and Protocols '2006

XDR Language

type-specifier:

[ "unsigned" ] "int"

| [ "unsigned" ] "hyper"

| "float"

| "double"

| "quadruple"

| "bool"

| enum-type-spec

| struct-type-spec

| union-type-spec

| identifier

enum-type-spec:

"enum" enum-body

enum-body:

"{"

( identifier "=" value ) ( "," identifier "=" value ) *"}"

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 285

Page 286: Networks and Protocols '2006

XDR Language

struct-type-spec:

"struct" struct-body

struct-body:

"{"

( declaration ";" )

( declaration ";" ) *"}"

union-type-spec:

"union" union-body

union-body:

"switch" "(" declaration ")" "{"

( "case" value ":" declaration ";" )

( "case" value ":" declaration ";" ) *[ "default" ":" declaration ";" ]

"}"

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 286

Page 287: Networks and Protocols '2006

XDR Language

constant-def:

"const" identifier "=" constant ";"

type-def:

"typedef" declaration ";"

| "enum" identifier enum-body ";"

| "struct" identifier struct-body ";"

| "union" identifier union-body ";"

definition:

type-def

| constant-def

specification:

definition *

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 287

Page 288: Networks and Protocols '2006

XDR Encoding

• All data items are represented by a multiple of 32 bits• Padding is used in cases where data items do not fit 32 bit

boundaries naturally• No type information in the encoding• Implicit length wherever possible• Requires big-endian byte order

=⇒ Very efficient to encode/decode!

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 288

Page 289: Networks and Protocols '2006

XDR Integers, Bools and Enums

• Syntax[unsigned] int identifier; / * [un]signed integer, 32 bit * /

[unsigned] hyper identifier; / * [un]signed integer, 64 bit * /

enum { name-identifier = constant, ... } identifier;

bool identifier;

• Encoding(MSB) (LSB)

+-------+-------+-------+-------+

|byte 0 |byte 1 |byte 2 |byte 3 | SIGNED / UNSIGNED INTEGER

+-------+-------+-------+-------+

<------------32 bits------------>

(MSB) (LSB)

+-------+-------+-------+-------+-------+-------+-- -----+-------+

|byte 0 |byte 1 |byte 2 |byte 3 |byte 4 |byte 5 |byte 6 |byte 7 |

+-------+-------+-------+-------+-------+-------+-- -----+-------+

<----------------------------64 bits---------------- ------------>

HYPER INTEGER / UNSIGNED HYPER INTEGER

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 289

Page 290: Networks and Protocols '2006

XDR Floating-Point

• Syntaxfloat identifier;

• Encoding+-------+-------+-------+-------+

|byte 0 |byte 1 |byte 2 |byte 3 | SINGLE-PRECISION

S| E | F | FLOATING-POINT NUMBER

+-------+-------+-------+-------+

1|<- 8 ->|<-------23 bits------>|

<------------32 bits------------>

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 290

Page 291: Networks and Protocols '2006

XDR Double Floating-Point

• Syntaxdouble identifier;

• Encoding+------+------+------+------+------+------+------+- -----+

|byte 0|byte 1|byte 2|byte 3|byte 4|byte 5|byte 6|byte 7|

S| E | F |

+------+------+------+------+------+------+------+- -----+

1|<--11-->|<-----------------52 bits---------------- --->|

<-----------------------64 bits--------------------- ---->

DOUBLE-PRECISION FLOATING-POINT

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 291

Page 292: Networks and Protocols '2006

XDR Quadruple Floating-Point

• Syntaxquadruple identifier;

• Encoding+------+------+------+------+------+------+-...--+- -----+

|byte 0|byte 1|byte 2|byte 3|byte 4|byte 5| ... |byte15|

S| E | F |

+------+------+------+------+------+------+-...--+- -----+

1|<----15---->|<-------------112 bits--------------- --->|

<-----------------------128 bits-------------------- ---->

QUADRUPLE-PRECISION FLOATING-POINT

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 292

Page 293: Networks and Protocols '2006

XDR Fixed-Length Opaque

• Syntaxopaque identifier[n]; / * opaque with fixed size n * /

• Encoding0 1 ...

+--------+--------+...+--------+--------+...+------ --+

| byte 0 | byte 1 |...|byte n-1| 0 |...| 0 |

+--------+--------+...+--------+--------+...+------ --+

|<-----------n bytes---------->|<------r bytes------> |

|<-----------n+r (where (n+r) mod 4 = 0)------------>|

FIXED-LENGTH OPAQUE

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 293

Page 294: Networks and Protocols '2006

XDR Variable-Length Opaque

• Syntaxopaque identifier<m>; / * opaque with max. size m * /

opaque identifier<>; / * opaque with max. size (2 ** 32) * /

• Encoding0 1 2 3 4 5 ...

+-----+-----+-----+-----+-----+-----+...+-----+---- -+...+-----+

| length n |byte0|byte1|...| n-1 | 0 |...| 0 |

+-----+-----+-----+-----+-----+-----+...+-----+---- -+...+-----+

|<-------4 bytes------->|<------n bytes------>|<---r b ytes--->|

|<----n+r (where (n+r) mod 4 = 0)---->|

VARIABLE-LENGTH OPAQUE

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 294

Page 295: Networks and Protocols '2006

XDR String

• Syntaxstring identifier<m>; / * string with max. size m * /

string identifier<>; / * string with max. size (2 ** 32) * /

• Encoding0 1 2 3 4 5 ...

+-----+-----+-----+-----+-----+-----+...+-----+---- -+...+-----+

| length n |byte0|byte1|...| n-1 | 0 |...| 0 |

+-----+-----+-----+-----+-----+-----+...+-----+---- -+...+-----+

|<-------4 bytes------->|<------n bytes------>|<---r b ytes--->|

|<----n+r (where (n+r) mod 4 = 0)---->|

STRING

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 295

Page 296: Networks and Protocols '2006

XDR Fixed-Length Array

• Syntaxtype-name identifier[n]; / * array with n element * /

• Encoding+---+---+---+---+---+---+---+---+...+---+---+---+-- -+

| element 0 | element 1 |...| element n-1 |

+---+---+---+---+---+---+---+---+...+---+---+---+-- -+

|<--------------------n elements-------------------> |

FIXED-LENGTH ARRAY

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 296

Page 297: Networks and Protocols '2006

XDR Variable-Length Array

• Syntaxtype-name identifier<m>; / * array with max. m elements * /

type-name identifier<>; / * array with max. (2 ** 32) elements * /

• Encoding0 1 2 3

+--+--+--+--+--+--+--+--+--+--+--+--+...+--+--+--+- -+

| n | element 0 | element 1 |...|element n-1|

+--+--+--+--+--+--+--+--+--+--+--+--+...+--+--+--+- -+

|<-4 bytes->|<--------------n elements------------->|

VARIABLE-LENGTH ARRAY

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 297

Page 298: Networks and Protocols '2006

XDR Structures

• Syntaxstruct {

component-declaration-A;

component-declaration-B;

...

} identifier;

• Encoding+-------------+-------------+...

| component A | component B |...

+-------------+-------------+...

STRUCTURE

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 298

Page 299: Networks and Protocols '2006

XDR Discriminated Unions

• Syntaxunion switch (discriminant-declaration) {

case discriminant-value-A:

arm-declaration-A;

case discriminant-value-B:

arm-declaration-B;

...

default: default-declaration;

} identifier;

• Encoding0 1 2 3

+---+---+---+---+---+---+---+---+

| discriminant | implied arm |

+---+---+---+---+---+---+---+---+

|<---4 bytes--->|

DISCRIMINATED UNION

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 299

Page 300: Networks and Protocols '2006

XDR Implementation

• Sun provided an API which offers conversion functions forother C data types in addition to the XDR data types

• An XDR handle represents the XDR encoding/decodingbuffer and determines the operation to carry out

bool_t xdr_void(void);

bool_t xdr_short(XDR * xdrs, short * sp);

bool_t xdr_u_short(XDR * xdrs, u_short * sp);

bool_t xdr_int(XDR * xdrs, int * sp);

bool_t xdr_u_int(XDR * xdrs, u_int * sp);

/ * ... * /

bool_t xdr_bytes(XDR * xdrs, char ** cpp, u_int * sizep, u_int maxsize);

bool_t xdr_opaque(XDR * xdrs, caddr_t cp, u_int cnt);

bool_t xdr_string(XDR * xdrs, char ** cpp, u_int maxsize);

bool_t xdr_union(XDR * __xdrs, enum_t * dscmp, char * unp,

const struct xdr_discrim * choices, xdrproc_t dfault);

/ * ... * /

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 300

Page 301: Networks and Protocols '2006

References[1] R. Srinivasan. XDR: External Data Representation Standard. RFC 1832, Sun Microsystems,

August 1995.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 301

Page 302: Networks and Protocols '2006

10. Augmented Backus Naur Form (ABNF)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 302

Page 303: Networks and Protocols '2006

ABNF Basics

• The Augmented Backus Naur Form (ABNF) defined in RFC4234 can be used to formally specify textual protocolmessages.

• An ABNF definition consists of a set of rules (sometimes alsocalled productions).

• Every rule has a name followed by an assignment operatorfollowed by an expression consisting of terminal symbols andoperators.

• The end of a rule is marked by the end of the line or by acomment. Comments start with the comment symbol ;(semicolon) and continue to the end of the line.

• ABNF does not define a module concept or an import/exportmechanism.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 303

Page 304: Networks and Protocols '2006

Rule Names and Terminal Symbols

• The name of a rule must start with an alphabetic characterfollowed by a combination of alphabetics, digits and hyphens.The case of a rule name is not significant.

• Terminal symbols are non-negative numbers. The basis ofthese numbers can be binary (b), decimal (d) or hexadecimal(x). Multiple values can be concatenated by using the dot .as a value concatenation operator. It is also possible todefine ranges of consecutive values by using the hyphen -as a value range operator.

• Terminal symbols can also be defined by using literal textstrings containing US ASCII characters enclosed in doublequotes. Note that these literal text strings arecase-insensitive.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 304

Page 305: Networks and Protocols '2006

Simple ABNF Examples

CR = %d13 ; ASCII carriage return code in decimal

CRLF = %d13.10 ; ASCII carriage return and linefeed code sequ ence

DIGIT = %x30-39 ; ASCCI digits (0 - 9)

ABA = "aba" ; ASCII string "aba" or "ABA" or "Aba" or ...

abba = %x61.62.62.61 ; ASCII string "abba"

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 305

Page 306: Networks and Protocols '2006

ABFN Operators

• Concatenation◦ Concatenation operator symbol is the empty word◦ Example: abba = %x61 %x62 %x62 %x61

• Alternatives◦ Alternatives operator symbol is the forward slash /◦ Example: aorb = %x61 / %x62◦ Incremental alternatives assignment operator =/ can be

used for long lists of alternatives• Grouping

◦ Expressions can be grouped using parenthesis◦ A grouped expression is treated as a single element◦ Example: abba = %x61 (%x62 %x62) %x61

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 306

Page 307: Networks and Protocols '2006

ABFN Operators

• Repetitions◦ The repetitions operator has the format n* mwhere n andmare optional decimal values

◦ The value of n indicates the minimum number ofrepetitions (defaults to 0 if not present)

◦ The value mindicates the maximum number of repetitions(defaults to infinity if not present)

◦ The format * indicates 0 or more repetitions◦ Example: abba = %x61 2 %x62 %x61

• Optional◦ Square brackets enclose an optional element◦ Example: [ab] ; equivalent to * 1(ab)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 307

Page 308: Networks and Protocols '2006

ABNF Core Definitions

ALPHA = %x41-5A / %x61-7A ; A-Z / a-z

BIT = "0" / "1"

CHAR = %x01-7F ; any 7-bit US-ASCII character, excluding

CR = %x0D ; carriage return

CRLF = CR LF ; Internet standard newline

CTL = %x00-1F / %x7F ; controls

DIGIT = %x30-39 ; 0-9

DQUOTE = %x22 ; " (Double Quote)

HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"

HTAB = %x09 ; horizontal tab

LF = %x0A ; linefeed

LWSP = * (WSP / CRLF WSP) ; linear white space (past newline)

OCTET = %x00-FF ; 8 bits of data

SP = %x20 ; space

VCHAR = %x21-7E ; visible (printing) characters

WSP = SP / HTAB ; White space

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 308

Page 309: Networks and Protocols '2006

ABNF in ABNF

rulelist = 1 * ( rule / ( * c-wsp c-nl) )

rule = rulename defined-as elements c-nl

; continues if next line starts with white space

rulename = ALPHA * (ALPHA / DIGIT / "-")

defined-as = * c-wsp ("=" / "=/") * c-wsp

; basic rules definition and incremental alternatives

elements = alternation * c-wsp

c-wsp = WSP / (c-nl WSP)

c-nl = comment / CRLF

; comment or newline

comment = ";" * (WSP / VCHAR) CRLF

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 309

Page 310: Networks and Protocols '2006

ABNF in ABNF

alternation = concatenation

* ( * c-wsp "/" * c-wsp concatenation)

concatenation = repetition * (1 * c-wsp repetition)

repetition = [repeat] element

repeat = 1 * DIGIT / ( * DIGIT " * " * DIGIT)

element = rulename / group / option /

char-val / num-val / prose-val

group = "(" * c-wsp alternation * c-wsp ")"

option = "[" * c-wsp alternation * c-wsp "]"

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 310

Page 311: Networks and Protocols '2006

ABNF in ABNF

char-val = DQUOTE * (%x20-21 / %x23-7E) DQUOTE

; quoted string of SP and VCHAR without DQUOTE

num-val = "%" (bin-val / dec-val / hex-val)

bin-val = "b" 1 * BIT [ 1 * ("." 1 * BIT) / ("-" 1 * BIT) ]

; series of concatenated bit values

; or single ONEOF range

dec-val = "d" 1 * DIGIT [ 1 * ("." 1 * DIGIT) / ("-" 1 * DIGIT) ]

hex-val = "x" 1 * HEXDIG [ 1* ("." 1 * HEXDIG) / ("-" 1 * HEXDIG) ]

prose-val = "<" * (%x20-3D / %x3F-7E) ">"

; bracketed string of SP and VCHAR without angles

; prose description, to be used as last resort

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 311

Page 312: Networks and Protocols '2006

References[1] D. Crocker and P. Overell. Augmented BNF for Syntax Specifications: ABNF. RFC 4234,

Brandenburg InternetWorking, THUS plc., October 2005.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 312

Page 313: Networks and Protocols '2006

11. Domain Name System

(DNS)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 313

Page 314: Networks and Protocols '2006

Domain Name System (DNS)

ru nl de edu org net arpacom

iu−bremen

faculty

toplevel

3rd level

4th levelwww

virtual root

2nd level

country toplevel domains generic toplevel domains

• The Domain Name System (DNS) specified in RFC 1034and RFC 1035 provides a global infrastructure to map humanfriendly domain names into IP addresses and vice versa.

• Critical resource since the Internet largely depends on nameresolution services provided by the DNS.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 314

Page 315: Networks and Protocols '2006

Resolver and Name Resolution

Resolver

API

PrimaryName ServerDNS

Encompassing

CacheCache

DNS

Cache

RR DB

RR DB

Client Machine

Application

Name Server

DNS Server Machines

• The resolver is typically tightly integrated into the operatingsystem (or more precisely standard libraries).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 315

Page 316: Networks and Protocols '2006

DNS Characteristics

• Hierarchical name space with a virtual root.• Administration of the name space can be delegated along

the path starting from the virtual root.• A DNS server knows a part (a zone) of the global name

space and its position within the global name space.• Name resolution queries can in principle be sent to arbitrary

DNS servers. However, it is good practice to use a local DNSserver as the primary DNS server.

• Recursive queries cause the queried DNS server to contactother DNS servers as needed in order to obtain a responseto the query.

• The original DNS protocol does not provide sufficientsecurity. In particular, there is no reason to trust DNSresponses.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 316

Page 317: Networks and Protocols '2006

DNS Labels and Names

• The names (labels) on a certain level of the tree must beunique and may not exceed 63 byte in length. The characterset for the labels is 7-bit ASCII. Comparisons are done in acase-insensitive manner.

• Labels must begin with a letter and end with a letter ordecimal digit. The characters between the first and lastcharacter must be letters, digits or hyphens.

• Labels can be concatenated with dots to form paths withinthe name space. Absolute paths, ending at the virtual rootnode, end with a trailing dot. All other paths which do not endwith a trailing dot are relative paths.

• The overall length of a domain name is limited to 255 bytes.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 317

Page 318: Networks and Protocols '2006

DNS Internationalization

• Recent efforts did result in proposals for InternationalizedDomain Names in Applications (IDNA) (RFC 3490, RFC3491, RFC 3492).

• The basic idea is to support internationalized character setswithin applications.

• For backward compatibility reasons, internationalizedcharacter sets are encoded into 7-bit ASCII representations(ASCII Compatible Encoding, ACE).

• ACE labels are recognized by a so called ACE prefix. TheACE prefix for IDNA is xn- .

• A label which contains an encoded internationalized namemight for example be the value xn-de-jg4avhby1noc0d .

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 318

Page 319: Networks and Protocols '2006

Resource Records

• The DNS name space is realized by Resource Records(RRs) which hold typed information for a given name.

• Resource records have the following components:◦ The owner is the domain name which identifies a

resource record.◦ The type indicates the kind of information that is stored in

a resource record.◦ The class indicates the protocol specific name space,

normally IN for the Internet.◦ The time to life (TTL) defines how many seconds

information from a resource record can be stored in alocal cache.

◦ The data format (RDATA) of a resource records dependson the type of the resource record.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 319

Page 320: Networks and Protocols '2006

Resource Record Types

Type Description

A IPv4 address

AAAA IPv6 address

CNAME Alias for another name (canonical name)

HINFO Identification of the CPU and the operating system (host info)

MX List of mail server (mail exchanger)

NS Identification of an authoritative server for a domain

PTR Pointer to another part of the name space

SOA Start and parameters of a zone (start of zone of authority)

KEY Public key associated with a name

SIG Signature over the RRs associated with a nameslides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 320

Page 321: Networks and Protocols '2006

DNS Message Formats

• A DNS message starts with a protocol header. It indicateswhich of the following four parts is presents and whether themessage is a query or a response.

• The header is followed by a list of questions.• The list of questions is followed by a list of answers (resource

records).• The list of answers is followed by a list of pointers to

authorities (also in the form of resource records).• The list of pointers to authorities is followed by a list of

additional information (also in the form of resource records).This list may contain for example A resource records fornames in a response to an MXquery.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 321

Page 322: Networks and Protocols '2006

DNS Message Header

0 1

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| ID |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

|QR| Opcode |AA|TC|RD|RA| Z|AD|CD| RCODE |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| QDCOUNT |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| ANCOUNT |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| NSCOUNT |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| ARCOUNT |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

• Simple DNS queries usually use UDP as a transport.• For larger data transfers (e.g. zone transfers), DNS may

utilize TCP.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 322

Page 323: Networks and Protocols '2006

DNS Query Format

0 1

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| |

/ QNAME /

/ /

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| QTYPE |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| QCLASS |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 323

Page 324: Networks and Protocols '2006

DNS Response Format

0 1

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

: NAME :

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| TYPE |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| CLASS |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| TTL |

| |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

| RDLENGTH |

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|

: RDATA :

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 324

Page 325: Networks and Protocols '2006

Resource Record Formats

• An A resource record contains an IPv4 address encoded in 4bytes in network byte order.

• An AAAAresource record contains an IPv6 address encodedin 16 bytes in network byte order.

• A CNAMEresource record contains a character stringpreceded by the length of the string encoded in the first byte.

• A HINFO resource record contains two character strings,each prefixed with a length byte. The first character stringdescribes the CPU and the second string the operatingsystem.

• A MXresource record contains a 16-bit preference numberfollowed by a character string prefixed with a length byteswhich contains the DNS name of a mail exchanger.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 325

Page 326: Networks and Protocols '2006

Resource Record Formats

• A NSresource record contains a character string prefixed bya length byte which contains the name of an authoritativeDNS server.

• A PTRresource record contains a character string prefixedwith a length byte which contains the name of another DNSserver. PTRrecords are used to map IP addresses to names(so called reverse lookups). For an IPv4 address of the formd1.d2.d3.d4, a PTR resource record is created for the pseudodomain name d4.d3.d2.d1.in − addr.arpa. For an IPv6 addressof the form h1h2h3h4 : . . . : h13h14h15h16, a PTR resourcerecord is created for the pseudo domain nameh16.h15.h14.h13. . . . .h4.h3.h2.h1.ip6.arpa

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 326

Page 327: Networks and Protocols '2006

DNS Reverse Trees

nl de edu org net arpacom

iu−bremen

faculty

toplevel

3rd level

4th levelwww

virtual root

2nd levelipv6in−addr

212

201

48

1

5th level

6th level

2

0

1

0

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 327

Page 328: Networks and Protocols '2006

Resource Record Formats

• A SOAresource record contains two character strings, eachprefixed by a length byte, and four 32-bit numbers:◦ Name of the DNS server responsible for a zone.◦ Email address of the administrator responsible for the

management of the zone.◦ Serial number (SERIAL) (must be incremented whenever

the zone database changes).◦ Time which may elapse before cached zone information

must be updated (REFRESH).◦ Time interval after which zone information is consider not

current anymore (EXPIRE).◦ Minimum lifetime for resource records (MINIMUM).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 328

Page 329: Networks and Protocols '2006

DNS Security

• DNS security (DNSSEC) provides data integrity andauthentication to security aware resolvers and applicationsthrough the use of cryptographic digital signatures.

• The KEYand SIG resource records have a rather complexformat which is described in detail in RFC 2535.

• The DNSSEC specifications are currently being revised totake operational experience into account.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 329

Page 330: Networks and Protocols '2006

Dynamic DNS Updates

• RFC 2136 / RFC 3007 define a mechanism which allows todynamically update RRs on name server.

• This is especially useful in environments which use dynamicIP address assignments.

• The payload of a DNS update message contains◦ the zone section,◦ the prerequisite section (supporting conditional updates),◦ the update section, and◦ an additional data section.

• The nsupdate command line utility can be used to makemanual updates. Some DHCP servers perform automaticupdates when they hand out an IP address.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 330

Page 331: Networks and Protocols '2006

References[1] P. Mockapetris. Domain Names - Concepts and Facilities. RFC 1034, ISI, November 1987.

[2] P. Mockapetris. Domain Names - Implementation and Specification. RFC 1035, ISI, November1987.

[3] P. Faltstrom, P. Hoffman, and A. Costello. Internationalizing Domain Names in Applications(IDNA). RFC 3490, Cisco, IMC & VPNC, UC Berkeley, March 2003.

[4] P. Hoffman and M. Blanchet. Nameprep: A Stringprep Profile for Internationalized DomainNames (IDN). RFC 3491, IMC & VPNC, Viagenie, March 2003.

[5] A. Costello. Punycode: A Bootstring encoding of Unicode for Internationalized Domain Names inApplications (IDNA). RFC 3492, UC Berkeley, March 2003.

[6] D. Eastlake. Domain Name System Security Extensions. RFC 2535, IBM, March 1999.

[7] P. Vixie, S. Thomson, Y. Rekhter, and J. Bound. Dynamic Updates in the Domain Name System(DNS UPDATE). RFC 2136, ISC, Bellcore, Cisco, DEC, April 1997.

[8] B. Wellington. Secure Domain Name System (DNS) Dynamic Update. RFC 3007, Nominum,November 2000.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 331

Page 332: Networks and Protocols '2006

12. Electronic Mail

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 332

Page 333: Networks and Protocols '2006

Components Involved in Electronic Mail

mailqueueagent

userMTAlocal

mailqueue

agentuser

MTArelay

MTAlocal

mailqueue

usermailboxagent

user

localMDA

agentuser

MTArelay

SMTP

sender host system sender host system

SMTP

SMTP

receiver host system

IMAP

receiver host system

organization B

organization A

LMTP

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 333

Page 334: Networks and Protocols '2006

Terminology

• Mail User Agent (MUA)• Mail Transfer Agent (MTA)• Mail Delivery Agent (MDA)• Store-and-Forward Principle• Envelop vs. Header vs. Body

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 334

Page 335: Networks and Protocols '2006

Simple Mail Transfer Protocol (SMTP)

• Defined in RFC 2821 (originally RFC 821)• Textual client/server protocol running over TCP• Small set of commands to be executed by an SMTP server• Supports multiple mail transactions over a single transport

layer connection• Server responds with structured response codes• Fully specified in ABNF

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 335

Page 336: Networks and Protocols '2006

SMTP Commands

HELO Indentify clients to a SMTP server (HELLO)EHLO Extended identification (EXTENDED HELLO)MAIL Inititate a mail transaction (MAIL)RCPT Identity an individual recipient (RECIPIENT)DATA Transfer of mail message (DATA)RSET Aborting current mail transaction (RESET)VRFY Verify an email address (VERIFY)EXPN Expand a mailing list address (EXPAND)HELP Provide help about SMTP commands (HELP)NOOP No operation, has no effect (NOOP)QUIT Ask server to close connection (QUIT)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 336

Page 337: Networks and Protocols '2006

SMTP in ABNF (excerpt)

helo = "HELO" SP Domain CRLF

ehlo = "EHLO" SP Domain CRLF

mail = "MAIL FROM:" ("<>" / Reverse-Path) [SP Mail-Paramete rs] CRLF

rcpt = "RCPT TO:" ("<Postmaster@" domain ">" / "<Postmaster >" /

Forward-Path) [SP Rcpt-Parameters CRLF

data = "DATA" CRLF

rset = "RSET" CRLF

vrfy = "VRFY" SP String CRLF

expn = "EXPN" SP String CRLF

help = "HELP" [ SP String ] CRLF

noop = "NOOP" [ SP String ] CRLF

quit = "QUIT" CRLF

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 337

Page 338: Networks and Protocols '2006

Theory of 3 Digit Reply Codes

• The first digit denotes whether the response is good, bad orincomplete.◦ 1yz Positive Preliminary reply◦ 2yz Positive Completion reply◦ 3yz Positive Intermediate reply◦ 4yz Transient Negative Completion reply◦ 5yz Permanent Negative Completion reply

• The second digit encodes responses in specific categories.• The third digit gives a finer gradation of meaning in each

category specified by the second digit.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 338

Page 339: Networks and Protocols '2006

Internet Message Format

• The format of Internet messages is defined in RFC 2822.• Most important ABNF productions and messages fields:

fields = * (trace * resent-field) * regular-field

resend-field = resent-date / resent-from / resent-sender

resend-field =/ resent-to / resent-cc / resent-bcc

resend-field =/ resent-msg-id

regular-field = orig-date / from / sender

regular-field =/ reply-to / to / cc / bcc

regular-field =/ message-id / in-reply-to / references

regular-field =/ subject / comments / keywords

• Note that fields such as to or cc may be different from theactual addresses used by SMTP.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 339

Page 340: Networks and Protocols '2006

Originator Fields

• The From: field specifies the author(s) of the message.

from = "From:" mailbox-list CRLF

• The Sender: field specifies the mailbox of the sender incases where the actual sender is not the author (e.g., asecretary).

sender = "Sender:" mailbox CRLF

• The Reply-To: field indicates the mailbox(es) to which theauthor of the message suggests that replies be sent.

reply-to = "Reply-To:" address-list CRLF

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 340

Page 341: Networks and Protocols '2006

Destination Address Fields

• The To: field contains the address(es) of the primaryrecipient(s) of the message.

to = "To:" address-list CRLF

• The Cc: field (Carbon Copy) contains the addresses ofothers who are to receive the message, though the contentof the message may not be directed at them.

cc = "Cc:" address-list CRLF

• The Bcc: field (Blind Carbon Copy) contains addresses ofrecipients of the message whose addresses are not to berevealed to other recipients of the message.

bcc = "Bcc:" (address-list / [CFWS]) CRLF

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 341

Page 342: Networks and Protocols '2006

Identification and Origination Date Fields

• The Message-ID: field provides a unique messageidentifier that refers to a particular version of a particularmessage.

message-id = "Message-ID:" msg-id CRLF

• The In-Reply-To: field will contain the contents of theMessage-ID: field of the message to which this one is areply.

in-reply-to = "In-Reply-To:" 1 * msg-id CRLF

• The References: field will contain the contents of theparent’s References: field (if any) followed by the contentsof the parent’s Message-ID: field (if any).

references = "References:" 1 * msg-id CRLF

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 342

Page 343: Networks and Protocols '2006

Informational Fields

• The Subject: field contains a short string identifying thetopic of the message.

subject = "Subject:" unstructured CRLF

• The Comments: field contains any additional comments onthe text of the body of the message.

comments = "Comments:" unstructured CRLF

• The Keywords: field contains a comma-separated list ofimportant words and phrases that might be useful for therecipient.

keywords = "Keywords:" phrase * ("," phrase) CRLF

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 343

Page 344: Networks and Protocols '2006

Trace Fields

• The Received: field contains a (possibly empty) list ofname/value pairs followed by a semicolon and a date-timespecification. The first item of the name/value pair is definedby item-name, and the second item is either an addr-spec,an atom, a domain, or a msg-id.

received = "Received:" name-val-list ";" date-time CRLF

• The Return-Path: field contains an email address towhich messages indicating non-delivery or other mail systemfailures are to be sent.

return = "Return-Path:" path CRLF

• A message may have multiple received fields and thereturn field is optional

trace = [return] 1 * received

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 344

Page 345: Networks and Protocols '2006

Resend Fields

• Resent fields are used to identify a message as having beenreintroduced into the transport system by a user.

• Resent fields make the message appear to the final recipientas if it were sent directly by the original sender, with all of theoriginal fields remaining the same.

• Each set of resent fields correspond to a particular resendingevent.

resent-date = "Resent-Date:" date-time CRLF

resent-from = "Resent-From:" mailbox-list CRLF

resent-sender = "Resent-Sender:" mailbox CRLF

resent-to = "Resent-To:" address-list CRLF

resent-cc = "Resent-Cc:" address-list CRLF

resent-bcc = "Resent-Bcc:" (address-list / [CFWS]) CRLF

resent-msg-id = "Resent-Message-ID:" msg-id CRLFslides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 345

Page 346: Networks and Protocols '2006

Internet Message Example #1

Date: Tue, 1 Apr 1997 09:06:31 -0800 (PST)

From: [email protected]

To: [email protected]

Subject: I have a present for you

Look, I’m sorry about the whole anvil thing, and I really

didn’t mean to try and drop it on you from the top of the

cliff. I want to try to make it up to you. I’ve got some

great birdseed over here at my place--top of the line

stuff--and if you come by, I’ll have it all wrapped up

for you. I’m really sorry for all the problems I’ve caused

for you over the years, but I know we can work this out.

--

Wile E. Coyote "Super Genius" [email protected]

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 346

Page 347: Networks and Protocols '2006

Multipurpose Internet Mail Extensions

• The Multipurpose Internet Mail Extensions (MIME) definesconventions to◦ support multiple different character sets;◦ support different media types;◦ support messages containing multiple parts;◦ encode content compatible with RFC 2821 and RFC

2822.• The set of media types and identified characters sets is

extensible.• MIME is widely implemented and not only used for Internet

mail messages.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 347

Page 348: Networks and Protocols '2006

MIME Header Fields

• The MIME-Version: field declares the version of theInternet message body format standard in use.

version = "MIME-Version:" 1 * DIGIT "." 1 * DIGIT CRLF

• The Content-Type: field specifies the media type andsubtype of data in the body.

content = "Content-Type:" type "/" subtype * (";" parameter)

• The Content-Transfer-Encoding: field specifies theencoding transformation that was applied to the body and thedomain of the result.

encoding = "Content-Transfer-Encoding:" mechanism

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 348

Page 349: Networks and Protocols '2006

MIME Header Fields

• The optional Content-ID: field allows one body to makereference to another.

id = "Content-ID:" msg-id

• The optional Content-Description: field associatessome descriptive information with a given body.

description = "Content-Description" * text

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 349

Page 350: Networks and Protocols '2006

MIME Media Types

• Five discrete top-level media types (RFC 2046):◦ text◦ image◦ audio◦ video◦ application

• Two composite top-level media types (RFC 2046):◦ multipart◦ message

• Some media types have additional parameters (e.g., thecharacter set).

• The Internet Assigned Numbers Authority (IANA) maintains alist of registered media types and subtypes.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 350

Page 351: Networks and Protocols '2006

MIME Boundaries

• Multipart documents consists of several entities which areseparated by a boundary delimiter line.

• After its boundary delimiter line, each body part then consistsof a header area, a blank line, and a body area.

• The boundary is established through a parameter of theContent-Type: header field of the message.

Content-Type: multipart/mixed; boundary="gc0pJq0M:08j U534c0p"

• The boundary delimiter consists of two dashes followed bythe established boundary followed by two dashes followed bythe end of the line.

--gc0pJq0M:08jU534c0p--

• The boundary delimiter must chosen so as to guarantee thatthere is no clash with the content.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 351

Page 352: Networks and Protocols '2006

MIME Example

From: Nathaniel Borenstein <[email protected]>

To: Ned Freed <[email protected]>

Date: Sun, 21 Mar 1993 23:56:48 -0800 (PST)

Subject: Sample message

MIME-Version: 1.0

Content-type: multipart/mixed; boundary="simple bounda ry"

This is the preamble. It is to be ignored.

--simple boundary

This is implicitly typed plain US-ASCII text.

It does NOT end with a linebreak.

--simple boundary

Content-type: text/plain; charset=us-ascii

This is explicitly typed plain US-ASCII text ending with a li nebreak.

--simple boundary--

This is the epilogue. It is also to be ignored.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 352

Page 353: Networks and Protocols '2006

Base64 Encoding

• Idea: Represent three input bytes (24 bit) using fourcharacters taken from a 6-bit alphabet.

• The resulting character sequence is broken into lines suchthat no line is longer than 76 characters.

• If the input text has a length which is not a multiple of three,then the special character = is appended to indicate thenumber of fill bytes.

• Base64 encoded data is difficult to read by humans withouttools (which however are trivial to write).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 353

Page 354: Networks and Protocols '2006

Base64 Character Set

Value Encoding Value Encoding Value Encoding Value Encodin g

0 A 17 R 34 i 51 z

1 B 18 S 35 j 52 0

2 C 19 T 36 k 53 1

3 D 20 U 37 l 54 2

4 E 21 V 38 m 55 3

5 F 22 W 39 n 56 4

6 G 23 X 40 o 57 5

7 H 24 Y 41 p 58 6

8 I 25 Z 42 q 59 7

9 J 26 a 43 r 60 8

10 K 27 b 44 s 61 9

11 L 28 c 45 t 62 +

12 M 29 d 46 u 63 /

13 N 30 e 47 v

14 O 31 f 48 w (pad) =

15 P 32 g 49 x

16 Q 33 h 50 y

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 354

Page 355: Networks and Protocols '2006

Base64 Example

CkRhdGU6IFR1ZSwgMSBBcHIgMTk5NyAwOTowNjozMSAtMDgwMCAoUFNUKQpGcm9t

OiBjb3lvdGVAZGVzZXJ0LmV4YW1wbGUub3JnClRvOiByb2FkcnV ubmVyQGFjbWUu

ZXhhbXBsZS5jb20KU3ViamVjdDogSSBoYXZlIGEgcHJlc2VudCB mb3IgeW91CgpM

b29rLCBJJ20gc29ycnkgYWJvdXQgdGhlIHdob2xlIGFudmlsIHR oaW5nLCBhbmQg

SSByZWFsbHkKZGlkbid0IG1lYW4gdG8gdHJ5IGFuZCBkcm9wIGl 0IG9uIHlvdSBm

cm9tIHRoZSB0b3Agb2YgdGhlCmNsaWZmLiAgSSB3YW50IHRvIHRyeSB0byBtYWtl

IGl0IHVwIHRvIHlvdS4gIEkndmUgZ290IHNvbWUKZ3JlYXQgYml yZHNlZWQgb3Zl

ciBoZXJlIGF0IG15IHBsYWNlLS10b3Agb2YgdGhlIGxpbmUKc3R 1ZmYtLWFuZCBp

ZiB5b3UgY29tZSBieSwgSSdsbCBoYXZlIGl0IGFsbCB3cmFwcGV kIHVwCmZvciB5

b3UuICBJJ20gcmVhbGx5IHNvcnJ5IGZvciBhbGwgdGhlIHByb2J sZW1zIEkndmUg

Y2F1c2VkCmZvciB5b3Ugb3ZlciB0aGUgeWVhcnMsIGJ1dCBJIGt ub3cgd2UgY2Fu

IHdvcmsgdGhpcyBvdXQuCi0tCldpbGUgRS4gQ295b3RlICAgIlN 1cGVyIEdlbml1

cyIgICBjb3lvdGVAZGVzZXJ0LmV4YW1wbGUub3JnCg==

• What does this text mean? (Note that this example uses anon-standard line length to fit on a slide.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 355

Page 356: Networks and Protocols '2006

Quoted-Printable Encoding

• Idea: Escape all characters which are not printablecharacters in the US-ASCII character set.

• The escape character is = followed by a two digithexadecimal representation of the octet’s value (inuppercase).

• Relatively complex rules ensure that◦ line breaks in the original input are preserved (so called

hard line breaks);◦ line breaks are added to ensure that encoded lines be no

more than 76 characters long (so called soft line breaks).• The encoding is intended for data that largely consists of

printable characters in the US-ASCII character set.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 356

Page 357: Networks and Protocols '2006

Internet Message Access Protocol (IMAP)

• The Internet Message Access Protocol (IMAP) defined inRFC 3501 allows a client to access and manipulateelectronic mail messages stored on a server.

• Messages are stored in mailboxes (message folders) whichare identified by a mailbox name.

• IMAP runs over TCP with the well-known port number 143.• IMAP users are typically authenticated using passwords

(transmitted in cleartext over TCP).• It is strongly suggested to use the Transport Layer Security

(TLS) option to encrypt authentication exchanges andmessage transfers.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 357

Page 358: Networks and Protocols '2006

IMAP Message Identification

• Messages in a mailbox are identified by numbers:◦ The unique identifier identifies a message in a mailbox

independent of its position. Unique identifiers shouldremain persistent across IMAP sessions.

◦ The message sequence number is the relative position ofa message in a mailbox. The first position in a mailbox is1.

• Persistency of the unique identifier can only be achieved to acertain extend and implementation therefore must cope withnon-persistent unique identifiers.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 358

Page 359: Networks and Protocols '2006

IMAP States

authenticated

non−authenticated

selected

logout and connection release

connection established and server greeting

• The state determines the set of applicable commands.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 359

Page 360: Networks and Protocols '2006

IMAP Commands

• Commands applicable in all states:CAPABILITY Reports the server’s capabilities

NOOP Empty command (may be used to trigger status updates)

LOGOUT Terminate the IMAP session

• Commands applicable in the non-authenticated state:AUTHENTICATE Indicates an authentication mechanism to the server

LOGIN Trivial authentication with a cleartext password

STARTTLS Start TLS negotation to protect the channel

• Note that the completion of the STARTTLScommand canchange the capabilities announced by the server.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 360

Page 361: Networks and Protocols '2006

IMAP Commands

• Commands applicable in the authenticated state:SELECT Select an existing mailbox (read-write)

EXAMINE Select an existing mailbox (read-only)

CREATE Create a new mailbox

DELETE Delete an existing mailbox

RENAME Rename an existing mailbox

SUBSCRIBE Add a mailbox to the server’s list of active mailboxes

UNSUBSCRIBE Remove a mailbox from the server’s list of active mailboxes

LIST List all existing mailboxes

LSUB List all active mailboxes

STATUS Retrieve the status of a mailbox

APPEND Append a message to a mailbox

• The SELECTand EXAMINEcommands cause a transitioninto the selected state.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 361

Page 362: Networks and Protocols '2006

IMAP Commands

• Commands applicable in the selected state:CHECK Create a copy of the current mailbox (checkpoint)

CLOSE Close the current mailbox and leave state

EXPUNGE Expunge all messages marked as deleted

SEARCH Search for messages matching given criteria

FETCH Fetch data of a message in the current mailbox

STORE Stote data as a message in the current mailbox

COPY Copy a message to the en of the specified mailbox

UID Execute a command using unique identifiers

• The CLOSEcommand causes a transition back into theauthenticated state.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 362

Page 363: Networks and Protocols '2006

IMAP Tagging

• IMAP supports asynchronous, concurrent operations. Aclient can send multiple commands which the server willexecute asynchronously.

• A client tags commands such that responses returned by theserver can be related to previously sent commands.

• Server responses◦ that do not indicate command completion are prefixed

with the token * ;◦ that request additional information to complete a

command are prefixed with the token +;◦ that communicate the successful for unsuccessful

completion of a comment are prefixed with the tag.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 363

Page 364: Networks and Protocols '2006

IMAP Commands in ABNF

tag = 1 * <any ATOM_CHAR except "+">

command = tag SPACE (command_any / command_auth /

command_nonauth / command_select) CRLF

;; Modal based on state

command_any = "CAPABILITY" / "LOGOUT" / "NOOP" / x_command

;; Valid in all states

command_auth = append / create / delete / examine / list / lsub /

rename / select / status / subscribe / unsubscribe

;; Valid only in Authenticated or Selected state

command_nonauth = login / authenticate

;; Valid only when in Non-Authenticated state

command_select = "CHECK" / "CLOSE" / "EXPUNGE" /

copy / fetch / store / uid / search

;; Valid only when in Selected state

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 364

Page 365: Networks and Protocols '2006

IMAP Responses in ABNF

response = * (continue_req / response_data) response_done

continue_req = "+" SPACE (resp_text / base64)

response_data = " * " SPACE (resp_cond_state / resp_cond_bye /

mailbox_data / message_data / capability_data) CRLF

response_done = response_tagged / response_fatal

response_fatal = " * " SPACE resp_cond_bye CRLF

;; Server closes connection immediately

response_tagged = tag SPACE resp_cond_state CRLF

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 365

Page 366: Networks and Protocols '2006

SIEVE Filtering Language

• The SIEVE language defined in RFC 3028 can be used tofilter messages at time of final delivery.

• The language can be implemented either on the mail client ofthe mail server.

• SIEVE is extensible, simple, and independent of the accessprotocol, mail architecture, and operating system.

• The SIEVE language can be safely executed on servers(such as IMAP servers) as it has no variables, loops, orability to shell out to external programs.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 366

Page 367: Networks and Protocols '2006

SIEVE Scripts

• SIEVE scripts are sequences of commands.◦ An action command is an identifier followed by zero or

more arguments, terminated by a semicolon. Actioncommands do not take tests or blocks as arguments.

◦ A control command is similar, but it takes a test as anargument, and ends with a block instead of a semicolon.

◦ A test command is used as part of a control command. Itis used to specify whether or not the block of code givento the control command is executed.

• The empty SIEVE script keeps the message (implicit keep).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 367

Page 368: Networks and Protocols '2006

SIEVE in ABNF

argument = string-list / number / tag

arguments = * argument [test / test-list]

block = "{" commands "}"

command = identifier arguments ( ";" / block )

commands = * command

start = commands

string = quoted-string / multi-line

string-list = "[" string * ("," string) "]" / string

;; if there is only a single string, the brackets are optional

test = identifier arguments

test-list = "(" test * ("," test) ")"

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 368

Page 369: Networks and Protocols '2006

SIEVE Example

# Declare any optional features or extension used by the scri pt

require ["fileinto", "reject"];

# Reject any large messages (note that the four leading dots g et

# "stuffed" to three)

if size :over 1M {

reject text:

Please do not send me large attachments.

Put your file on a server and send me the URL.

Thank you.

.... Fred

.

;

stop;

}

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 369

Page 370: Networks and Protocols '2006

SIEVE Example (cont.)

# Move messages from IETF filter discussion list to filter fo lder

if header :is "Sender" "[email protected]" {

fileinto "filter"; # move to "filter" folder

stop;

}

#

# Keep all messages to or from people in my company

#

elsif address :domain :is ["From", "To"] "example.com" {

keep; # keep in "In" folder

stop;

}

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 370

Page 371: Networks and Protocols '2006

SIEVE Example (cont.)

# Try and catch unsolicited email. If a message is not to me,

# or it contains a subject known to be spam, file it away.

#

if anyof (not address :all :contains

["To", "Cc", "Bcc"] "[email protected]",

header :matches "subject"

[" * make* money* fast * ", " * university * dipl * mas* "]) {

# If message header does not contain my address,

# it’s from a list.

fileinto "spam"; # move to "spam" folder

} else {

# Move all other (non-company) mail to "personal" folder.

fileinto "personal";

}

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 371

Page 372: Networks and Protocols '2006

References[1] J. Klensin. Simple Mail Transfer Protocol. RFC 2821, AT&T Laboratories, April 2001.

[2] P. Resnick. Internet Message Format. RFC 2822, QUALCOMM Incorporated, April 2001.

[3] N. Freed and N. Borenstein. Multipurpose Internet Mail Extensions (MIME) Part One: Format ofInternet Message Bodies. RFC 2045, Innosoft, First Virtual, November 1996.

[4] N. Freed and N. Borenstein. Multipurpose Internet Mail Extensions (MIME) Part Two: MediaTypes. RFC 2046, Innosoft, First Virtual, November 1996.

[5] M. Crispin. Internet Message Access Protocol -Version 4rev1. RFC 3501, University ofWashington, March 2003.

[6] T. Showalter. Sieve: A Mail Filtering Language. RFC 3028, Mirapoint, Inc., January 2001.

[7] W. Segmuller. Sieve Extension: Relational Tests. RFC 3431, IBM T.J. Watson Research Center,December 2002.

[8] C. Daboo. SIEVE Email Filtering: Spamtest and VirusTest Extensions. RFC 3685, CyrusoftInternational, February 2004.

[9] J. Degener. Sieve Extension: Copying Without Side Effects. RFC 3894, Sendmail, October2004.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 372

Page 373: Networks and Protocols '2006

13. File Transfer Protocol

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 373

Page 374: Networks and Protocols '2006

File Transfer Protocol (FTP)

FTP Server FTP Client

data transferprocess

processcontrol

filesystem

data transferprocess

filesystem

processcontrol

interfaceuser

commands

replies

data

• The FTP protocol defined in RFC 959 uses a separate TCPconnection for each data transfer.

• This approach sidesteps any problems about marking theend of files.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 374

Page 375: Networks and Protocols '2006

File Transfer Protocol (FTP)

• The control connection uses a text-based line-orientedprotocol which is similar to SMTP.

• The client sends commands which are processed by theserver. The server sends responses using three digitresponse codes.

• If the data transfer connection is initiated by the server, thenthe client’s port number must be conveyed first to the server.

• If the data transfer connection is initiated by the client, thenthe well-known port number 20 is used. The well-known portnumber for the control connection is 21.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 375

Page 376: Networks and Protocols '2006

File Transfer Protocol (FTP)

• FTP allows to resume a data transmission that did notcomplete using a special restart mechanism.

• FTP can be used to initiate a data transfer between tworemote systems. However, this feature of FTP can result insome interesting security problems (see RFC 2577 for moredetails).

• RFC 2228 defines security extensions for FTP(authentication, integrity and confidentiality).

• RFC 4217 defines how to run FTP over TLS.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 376

Page 377: Networks and Protocols '2006

FTP Commands

USER <SP> <username> <CRLF>

PASS <SP> <password> <CRLF>

ACCT <SP> <account-information> <CRLF>

CWD <SP> <pathname> <CRLF>

CDUP <CRLF>

SMNT <SP> <pathname> <CRLF>

QUIT <CRLF>

REIN <CRLF>

PORT <SP> <host-port> <CRLF>

PASV <CRLF>

TYPE <SP> <type-code> <CRLF>

STRU <SP> <structure-code> <CRLF>

MODE <SP> <mode-code> <CRLF>

RETR <SP> <pathname> <CRLF>

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 377

Page 378: Networks and Protocols '2006

FTP Commands

STOR <SP> <pathname> <CRLF>

STOU <CRLF>

APPE <SP> <pathname> <CRLF>

ALLO <SP> <decimal-integer>

[<SP> R <SP> <decimal-integer>] <CRLF>

REST <SP> <marker> <CRLF>

RNFR <SP> <pathname> <CRLF>

RNTO <SP> <pathname> <CRLF>

ABOR <CRLF>

DELE <SP> <pathname> <CRLF>

RMD <SP> <pathname> <CRLF>

MKD <SP> <pathname> <CRLF>

PWD <CRLF>

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 378

Page 379: Networks and Protocols '2006

FTP Commands

LIST [<SP> <pathname>] <CRLF>

NLST [<SP> <pathname>] <CRLF>

SITE <SP> <string> <CRLF>

SYST <CRLF>

STAT [<SP> <pathname>] <CRLF>

HELP [<SP> <string>] <CRLF>

NOOP <CRLF>

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 379

Page 380: Networks and Protocols '2006

FTP Command Parameters

<username> ::= <string>

<password> ::= <string>

<account-information> ::= <string>

<string> ::= <char> | <char><string>

<char> ::= any of the 128 ASCII characters

except <CR> and <LF>

<marker> ::= <pr-string>

<pr-string> ::= <pr-char> | <pr-char><pr-string>

<pr-char> ::= printable characters, any ASCII

code 33 through 126

<byte-size> ::= <number>

<host-port> ::= <host-number>,<port-number>

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 380

Page 381: Networks and Protocols '2006

FTP Command Parameters

<host-number> ::= <number>,<number>,<number>,<number>

<port-number> ::= <number>,<number>

<number> ::= any decimal integer 1 through 255

<form-code> ::= N | T | C

<type-code> ::= A [<sp> <form-code>]

| E [<sp> <form-code>]

| I

| L <sp> <byte-size>

<structure-code> ::= F | R | P

<mode-code> ::= S | B | C

<pathname> ::= <string>

<decimal-integer> ::= any decimal integer

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 381

Page 382: Networks and Protocols '2006

References[1] J. Postel and J. Reynolds. File Transfer Protocol (FTP). RFC 959, ISI, October 1985.

[2] M. Horowitz and S. Lunt. FTP Security Extensions. RFC 2228, Cygnus Solutions, Bellcore,October 1997.

[3] M. Allman, S. Ostermann, and C. Metz. FTP Extensions for IPv6 and NATs. RFC 2428, NASALewis/Sterling Software, Ohio University, The Inner Net, September 1998.

[4] P. Ford-Hutchinson. Securing FTP with TLS. RFC 4217, IBM UK Ltd, October 2005.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 382

Page 383: Networks and Protocols '2006

14. Hypertext Transfer Protocol

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 383

Page 384: Networks and Protocols '2006

Hypertext Transfer Protocol (HTTP)

• The Hypertext Transfer Protocol (HTTP) version 1.1 isdefined in RFC 2616 is one of the core building blocks of theWorld Wide Web.

• HTTP is primarily used to exchange documents betweenclients (browsers) and servers.

• The HTTP protocol runs on top of TCP and it uses the wellknown port number 80.

• HTTP utilizes MIME conventions in order to distinguishdifferent media types.

• RFC 2817 describes how to use TLS with HTTP 1.1.• The Common Gateway Interface described in RFC 3875

allows to implement simple dynamic web pages.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 384

Page 385: Networks and Protocols '2006

URL, URI, URN, IRI, . . .

• Uniform Resource Identifier (URI)A URI is a sequence of characters from the US-ASCII foridentifying an abstract or physical resource.

• Uniform Resource Locator (URL)The term URL refers to the subset of URIs that provide ameans of locating the resource by describing its primaryaccess mechanism (e.g., its network "location").

• Uniform Resource Name (URN)The term URN refer to the subset of URIs that identifyresources by means of a globally unique and persistentname.

• Internationalized Resource Identifier (IRI)An IRI is a sequence of characters from the UniversalCharacter Set for identifying an abstract or physical resource.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 385

Page 386: Networks and Protocols '2006

URI Syntax in ABNF

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

hier-part = "//" authority path-abempty

/ path-absolute

/ path-rootless

/ path-empty

URI-reference = URI / relative-ref

absolute-URI = scheme ":" hier-part [ "?" query ]

relative-ref = relative-part [ "?" query ] [ "#" fragment ]

relative-part = "//" authority path-abempty

/ path-absolute

/ path-noscheme

/ path-empty

scheme = ALPHA * ( ALPHA / DIGIT / "+" / "-" / "." )

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 386

Page 387: Networks and Protocols '2006

URI Syntax in ABNF

authority = [ userinfo "@" ] host [ ":" port ]

userinfo = * ( unreserved / pct-encoded / sub-delims / ":" )

host = IP-literal / IPv4address / reg-name

port = * DIGIT

IP-literal = "[" ( IPv6address / IPvFuture ) "]"

IPvFuture = "v" 1 * HEXDIG "." 1 * ( unreserved / sub-delims / ":" )

IPv6address = 6( h16 ":" ) ls32

/ "::" 5( h16 ":" ) ls32

/ [ h16 ] "::" 4( h16 ":" ) ls32

/ [ * 1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32

/ [ * 2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32

/ [ * 3( h16 ":" ) h16 ] "::" h16 ":" ls32

/ [ * 4( h16 ":" ) h16 ] "::" ls32

/ [ * 5( h16 ":" ) h16 ] "::" h16

/ [ * 6( h16 ":" ) h16 ] "::"

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 387

Page 388: Networks and Protocols '2006

URI Syntax in ABNF

h16 = 1 * 4HEXDIG

ls32 = ( h16 ":" h16 ) / IPv4address

IPv4address = dec-octet "." dec-octet "." dec-octet "." dec -octet

dec-octet = DIGIT ; 0-9

/ %x31-39 DIGIT ; 10-99

/ "1" 2DIGIT ; 100-199

/ "2" %x30-34 DIGIT ; 200-249

/ "25" %x30-35 ; 250-255

reg-name = * ( unreserved / pct-encoded / sub-delims )

path = path-abempty ; begins with "/" or is empty

/ path-absolute ; begins with "/" but not "//"

/ path-noscheme ; begins with a non-colon segment

/ path-rootless ; begins with a segment

/ path-empty ; zero characters

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 388

Page 389: Networks and Protocols '2006

URI Syntax in ABNF

path-abempty = * ( "/" segment )

path-absolute = "/" [ segment-nz * ( "/" segment ) ]

path-noscheme = segment-nz-nc * ( "/" segment )

path-rootless = segment-nz * ( "/" segment )

path-empty = 0<pchar>

segment = * pchar

segment-nz = 1 * pchar

segment-nz-nc = 1 * ( unreserved / pct-encoded / sub-delims / "@" )

pchar = unreserved / pct-encoded / sub-delims / ":" / "@"

query = * ( pchar / "/" / "?" )

fragment = * ( pchar / "/" / "?" )

pct-encoded = "%" HEXDIG HEXDIG

unreserved = ALPHA / DIGIT / "-" / "." / "_" / "˜"

reserved = gen-delims / sub-delims

gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"

sub-delims = "!" / "$" / "&" / "’" / "(" / ")"

/ " * " / "+" / "," / ";" / "="slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 389

Page 390: Networks and Protocols '2006

HTTP 1.1 Methods

• OPTIONS◦ Request information about the communication options

available• GET

◦ Retrieve whatever information is identified by a URI• HEAD

◦ Retrieve only the meta-information which is identified by aURI

• POST◦ Annotate an existing resource or pass data to a

data-handling process

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 390

Page 391: Networks and Protocols '2006

HTTP 1.1 Methods (cont.)

• PUT◦ Store information under the supplied URI

• DELETE◦ Delete the resource identified by the URI

• TRACE◦ Application-layer loopback of request messages for

testing purposes• CONNECT

◦ Initiate a tunnel such as a TLS or SSL tunnel

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 391

Page 392: Networks and Protocols '2006

HTTP 1.1 ABNF

Message = Request / Response

Request = Request-Line * (message-header CRLF) CRLF [ message-body ]

Response = Status-Line * (message-header CRLF) CRLF [ message-body ]

Request-Line = Method SP Request-URI SP HTTP-Version CRLF

Status-Line = HTTP-Version SP Status-Code SP Reason-Phras e CRLF

Method = "OPTIONS" / "GET" / "HEAD" / "POST"

Method =/ "PUT" / "DELETE" / "TRACE" / "CONNECT"

Method =/ Extension-Method

Extension-Method = token

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 392

Page 393: Networks and Protocols '2006

HTTP 1.1 ABNF (cont.)

Request-URI = " * " | absoluteURI | abs_path | authority

HTTP-Version = "HTTP" "/" 1 * DIGIT "." 1 * DIGIT

Status-Code = 3DIGIT

Reason-Phrase = * <TEXT, excluding CR, LF>

message-header = field-name ":" [ field-value ]

field-name = token

field-value = * ( field-content / LWS )

field-content = <the OCTETs making up the field-value

and consisting of either * TEXT or combinations

of token, separators, and quoted-string>

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 393

Page 394: Networks and Protocols '2006

Persistent Connections and Pipelining

• A client can establish a persistent connection to a server anduse it to send multiple Request messages.

• HTTP relies on the MIME Content-Length header field todetect the end of a message body (document).

• Earlier version of HTTP allowed only a singleRequest/Response exchange over a single connection,which is of course rather expensive.

• HTTP 1.1 also allows clients to make multiple requestswithout waiting for each response (pipelining), which cansignificantly reduce latency.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 394

Page 395: Networks and Protocols '2006

Caching and Proxies

• Probably the most interesting and also most complex part ofHTTP is its support for proxies and caching.

• Proxies are entities that exist between the client and theserver and which basically relays requests and responses.

• Some proxies and clients maintain caches where copies ofdocuments are stored in local storage space to speedupfuture accesses to these cached documents.

• The HTTP protocol allows a client to interrogate the server todetermine whether the document has changed or not.

• Not all problems related to HTTP proxies and caches havebeen solved. A good list of issues can be found in RFC 3143.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 395

Page 396: Networks and Protocols '2006

Negotiation

• Negotation can be used to select different document formats,different transfer encodings, different languages or differentcharacter sets.

• Server-driven negotiation begins with a request from a client(a browser). The client indicates a list of its preferences. Theserver then decides how to best respond to the request.

• Client-driven negotiation requires two requests. The clientfirst asks the server what is available and then decides whichconcrete request to send to the server.

• In most cases, server-driven negotiation is used since this ismuch more efficient.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 396

Page 397: Networks and Protocols '2006

Negotiation Example

• The following is an example of typical negotiation headerlines:Accept: text/xml, application/xml, text/html;q=0.9, tex t/plain;q=0.8

Accept-Language: de, en;q=0.5

Accept-Encoding: gzip, deflate, compress;q=0.9

Accept-Charset: ISO-8859-1, utf8;q=0.66, * ;q=0.33

• The first line indicates that the client accepts text/xml,application/xml, and text/plain and that it prefers text/htmlover text/plain.

• The last line indicates that the client prefers ISO-8859-1encoding (with preference 1), UTF8 encoding with preference0.66 and any other encoding with preference 0.33.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 397

Page 398: Networks and Protocols '2006

Conditional Requests

• Clients can make conditional requests by including headersthat qualify the conditions under which the request should behonored.

• Conditional requests can be used to avoid unnecessaryrequests (e.g., to validate cached data).

• Example:If-Modified-Since: Wed, 26 Nov 2003 23:21:08 +0100

• The server checks whether the document was changed afterthe date indicated by the header line and only process therequest if this is the case.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 398

Page 399: Networks and Protocols '2006

Other Features and Extensions

• Delta Encoding (RFC 3229)◦ A mechanism to request only the document changes

relative to a specific version.• Web Distributed Authoring (RFC 2518, RFC 3253)

◦ An extension to the HTTP/1.1 protocol that allows clientsto perform remote web content authoring operations.

• HTTP as a Substrate (RFC 3205)◦ HTTP is sometimes used as a substrate for other

application protocols (e.g., IPP or SOAP).◦ There are some pitfalls with this approach as documented

in RFC 3205.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 399

Page 400: Networks and Protocols '2006

References[1] R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L. Masinter, P. Leach, and T. Berners-Lee. Hypertext

Transfer Protocol – HTTP/1.1. RFC 2616, UC Irvine, Compaq/W3C, Compaq, W3C/MIT, Xerox,Microsoft, W3C/MIT, June 1999.

[2] R. Khare and S. Lawrence. Upgrading to TLS Within HTTP/1.1. RFC 2817, 4K Associates / UCIrvine, Agranat Systems, May 2001.

[3] E. Rescorla. HTTP Over TLS. RFC 2818, RTFM, May 2000.

[4] D. Robinson and K. Coar. The Common Gateway Interface (CGI) Version 1.1. RFC 3875,Apache Software Foundation, October 2004.

[5] J. Mogul, B. Krishnamurthy, F. Douglis, A. Feldmann, Y. Goland, A. van Hoff, and D. Hellerstein.Delta encoding in HTTP. RFC 3229, Compaq WRL, AT&T, Univ. of Saarbruecken, Marimba,ERS/USDA, January 2002.

[6] Y. Goland, E. Whitehead, A. Faizi, S. Carter, and D. Jensen. HTTP Extensions for DistributedAuthoring – WEBDAV. RFC 2518, Microsoft, UC Irvine, Netscape, Novell, February 1999.

[7] G. Clemm, J. Amsden, T. Ellison, C. Kaler, and J. Whitehead. Versioning Extensions to WebDAV(Web Distributed Authoring and Versioning). RFC 3253, Rational Software, IBM, Microsoft, U.C.Santa Cruz, March 2002.

[8] K. Moore. On the use of HTTP as a Substrate. RFC 3205, University of Tennessee, February2002.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 400

Page 401: Networks and Protocols '2006

15. Remote Procedure Calls

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 401

Page 402: Networks and Protocols '2006

RPC Model

Access

Result

Client ServerClientStub

ServerStub

SendAccess

SendResult

• Introduced by Birrel and Nelson (1984) to◦ provide communication transparency and◦ overcome heterogeneity

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 402

Page 403: Networks and Protocols '2006

Stub Procedures

stubclient ipc ipc stub server

interface interface

invoke pack

unpack

send

recv

recv

send

unpack

packreturn return

invoke

work

• Client stubs provide a local interface which can be called likeany other local procedure

• Server stubs provide the server interface which calls theserver’s implementation of the procedure provided by aprogrammer and returns any results back to the client

• Stubs hide all communication details

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 403

Page 404: Networks and Protocols '2006

Marshalling

• Marshalling is the technical term for transferring datastructures used in remote procedure calls from one addressspace to another

• Serialization of data structures for transport in messages• Conversion of data structures from the data representation of

the calling process to that of the called process• Pointers can be handled to some extend by introducing

call-back handles which can be used to make an RPC callback from the server to the client in order to retrieve the datapointed to

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 404

Page 405: Networks and Protocols '2006

RPC Definition Languages

client stubsource source

server stub procedureimplementation

clientimplementation

procedure definition

RPC compiler

header

compiler compiler compilercompiler

serverclient

RPC definition language

implementation languageimplementation language

• Formal language to define the type signature of remoteprocedures

• RPC compiler generates client / server stubs from the formalremote procedure definition

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 405

Page 406: Networks and Protocols '2006

RPC Binding

• A client needs to locate and bind to a server in order to useRPCs

• This usually requires to lookup the transport endpoint for asuitable server in some sort of name server:1. The name server uses a well know transport address2. A server registers with the name server when it starts up3. A client first queries the name server to retrieve the

transport address of the server4. Once the transport address is known, the client can send

RPC messages to the correct transport endpoint

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 406

Page 407: Networks and Protocols '2006

RPC Semantics

• May-be:

◦ Client does not retry failed requests

• At-least-once:◦ Client retries failed requests, server re-executes the

procedure• At-most-once:

◦ Client may retry failed requests, server detectsretransmitted requests and responds with cached replyfrom the execution of the procedure

• Exactly-once:◦ Client must retry failed requests, server detects

retransmitted requests and responds with cached replyfrom the execution of the procedure

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 407

Page 408: Networks and Protocols '2006

Local vs. Remote Procedure Calls

• Client, server and the communication channel can failindependently and hence an RPC may fail

• Extra code must be present on the client side to handle RPCfailures gracefully

• Global variables and pointers can not be used directly withRPCs

• Passing of functions as arguments is close to impossible• The time needed to call remote procedures is orders of

magnitude higher than the time needed for calling localprocedures

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 408

Page 409: Networks and Protocols '2006

Open Network Computing RPC

• Developed by Sun Microsystems (Sun RPC), originallypublished in 1987/1988

• Since 1995 controlled by the IETF (RFC 1790)• ONC RPC encompasses:

◦ ONC RPC Language (RFC 1831, RFC 1832)◦ ONC XDR Encoding (RFC 1832)◦ ONC RPC Protocol (RFC 1831)◦ ONC RPC Binding (RFC 1833)

• Foundation of the Network File System (NFS) and widelyimplemented on Unix systems

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 409

Page 410: Networks and Protocols '2006

ONC RPC Language

program-def:

"program" identifier "{"

version-def

version-def *"}" "=" constant ";"

version-def:

"version" identifier "{"

procedure-def

procedure-def *"}" "=" constant ";"

procedure-def:

type-specifier identifier "(" type-specifier

("," type-specifier ) * ")" "=" constant ";"

• The ONC RPC language is an extension of the XDR datadefinition language

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 410

Page 411: Networks and Protocols '2006

ONC RPC Protocol

• The ONC RPC protocol is defined in RFC 1831• Procedures are identified by a triple (P,V,F) with the following

semantics:◦ The program number P is used to identify a sets of related

procedures (called a program in ONC terminology)◦ A specific collection of related procedures within program

P and identified by the version number V◦ A specific procedure in the collection of procedures in

program P with version V is identified by the procedurenumber F

• The textual name of the procedure is irrelevant from theprotocol perspective

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 411

Page 412: Networks and Protocols '2006

ONC RPC Protocol

• RPC message formats are defined in the XDR language• RPC protocol supports an opaque and thus extensible

authentication data format• Early versions of the protocol supported a DES based

authentication scheme which used a key size which was veryeasy to break

• In many deployments, no authentication or clear-textauthentication is still being used...

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 412

Page 413: Networks and Protocols '2006

ONC RPC Protocol

struct rpc_msg {

unsigned int xid;

union switch (msg_type mtype) {

case CALL:

call_body cbody;

case REPLY:

reply_body rbody;

} body;

};

struct call_body {

unsigned int rpcvers; / * must be equal to two (2) * /

unsigned int prog;

unsigned int vers;

unsigned int proc;

opaque_auth cred;

opaque_auth verf;

/ * procedure specific parameters start here * /

};

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 413

Page 414: Networks and Protocols '2006

ONC RPC Protocol

union reply_body switch (reply_stat stat) {

case MSG_ACCEPTED:

accepted_reply areply;

case MSG_DENIED:

rejected_reply rreply;

} reply;

union rejected_reply switch (reject_stat stat) {

case RPC_MISMATCH:

struct {

unsigned int low;

unsigned int high;

} mismatch_info;

case AUTH_ERROR:

auth_stat stat;

};

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 414

Page 415: Networks and Protocols '2006

ONC RPC Protocol

struct accepted_reply {

opaque_auth verf;

union switch (accept_stat stat) {

case SUCCESS:

opaque results[0];

/ * procedure-specific results start here * /

case PROG_MISMATCH:

struct {

unsigned int low;

unsigned int high;

} mismatch_info;

default:

/ * Void. Cases include PROG_UNAVAIL, PROC_UNAVAIL,

* GARBAGE_ARGS, and SYSTEM_ERR.* /

void;

} reply_data;

};

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 415

Page 416: Networks and Protocols '2006

ONC RPC Binding

portmapper

serverclient

1. register2. lookup

3. procedure call

• RPC servers use dynamic port numbers.• The portmapper is used by the ONC RPC to map program

and version numbers (P,V) to transport endpoints on themachine where the portmapper is running

• The portmapper is itself an RPC service• Firewall generally dislike dynamic port numbers...

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 416

Page 417: Networks and Protocols '2006

ISO/OSI RPC (ROSE)

• The Remote Operations Service Element (ROSE) is theservice interface for RPCs in the ISO/OSI networkingstandards

• ROSE uses the ASN.1 language to define the datastructures that are exchanged

• Some special ASN.1 macros are used to define the typesignature of the remote operations

• The encoding on the wire is one of the ASN.1 encodings(e.g., BER, DER)

• Integration into frequently used implementation languagesand environments complicated

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 417

Page 418: Networks and Protocols '2006

XML based RPCs (XML-RPC)

• XML based RPC uses XML to encode RPC messages• Type information included in the encoding• Very simple (perhaps too simple?) message protocol (no

transaction identifier, relies on HTTP security and accesscontrol)

• Uses HTTP as the underlying (surrogate) protocol• No data definition / RPC language and thus no automatic

stub generation• For more information, see http://www.xmlrpc.com/

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 418

Page 419: Networks and Protocols '2006

XML-RPC Request

POST /RPC2 HTTP/1.0

User-Agent: Frontier/5.1.2 (WinNT)

Host: betty.userland.com

Content-Type: text/xml

Content-length: 196

<?xml version="1.0"?>

<methodCall>

<methodName>examples.getStateName</methodName>

<params>

<param>

<value>

<i4>41</i4>

</value>

</param>

</params>

</methodCall>

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 419

Page 420: Networks and Protocols '2006

XML-RPC Response

HTTP/1.1 200 OK

Connection: close

Content-Length: 172

Content-Type: text/xml

Date: Fri, 17 Jul 1998 19:55:08 GMT

Server: UserLand Frontier/5.1.2-WinNT

<?xml version="1.0"?>

<methodResponse>

<params>

<param>

<value>

<string>South Dakota</string>

</value>

</param>

</params>

</methodResponse>

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 420

Page 421: Networks and Protocols '2006

DCE RPC

• RPC developed as part of the Distributed ComputingEnvironment (DCE)

• Network Interface Definition Language (NIDL)• Network Data Representation (NDR)• Integrates with the Kerberos authentication service• Basis of the RPC mechanism used in Microsoft’s DCOM

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 421

Page 422: Networks and Protocols '2006

References[1] A. Birrell and P. Nelson. Implementing Remote Procedure Calls. ACM Transactions on

Computer Systems, 2(1):39–59, 1984.

[2] R. Srinivasan. RPC: Remote Procedure Call Protocol Specification Version 2. RFC 1831, SunMicrosystems, August 1995.

[3] R. Srinivasan. XDR: External Data Representation Standard. RFC 1832, Sun Microsystems,August 1995.

[4] R. Srinivasan. Binding Protocols for ONC RPC Version 2. RFC 1833, Sun Microsystems, August1995.

[5] ISO. Information processing systems – Open System Interconnection – Remote Operations –Part 1: Model, Notation and Service Definition. International Standard ISO 9072-1, ISO, 1989.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 422

Page 423: Networks and Protocols '2006

16. Internet Management

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 423

Page 424: Networks and Protocols '2006

Management Standards

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 424

Page 425: Networks and Protocols '2006

Why Network Management?

• Networks of non-trivial size need management:

◦ Fault detection and isolation

◦ Configuration generation and installation

◦ Accounting data gathering

◦ Performance monitoring and tuning

◦ Security management (keys, access control)

⇒ FCAPS functional areas (very broad but widely acceptedfunctional categorization)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 425

Page 426: Networks and Protocols '2006

Why is Network Management Hard?

• Scalability is a key concern (millions of devices/users)• Short technology life times (what happened to ATM?)• Heterogenity requires standards-based solutions• Lack of skilled persons

=⇒ But network management is not really fundamentallydifferent from other complex control systems (e.g., systemsthat control robots in a vehicle fabric).

=⇒ However, network management terminology is often verydifferent and sometimes somewhat confusing (especially forpeople with computer science background).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 426

Page 427: Networks and Protocols '2006

Abstraction of Managed Objects (MOs)

BehaviourEvents

OperationsAttributes

in the machine.switched on but no coffeeWarning: Coffee machine

Management Application Managed Object Resource

• A managed object is the abstracted view of a resource thatpresents its properties as seen by (and for the purpose of)management (ISO 7498-4).

• The boundary of a managed object defines the level ofdetails which are accessible for management systems.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 427

Page 428: Networks and Protocols '2006

Management Information Base (MIB)

MOMO

MO

MO

MOMO

MOMO

MOMO

MOMO

Layer 7

Layer 6

Layer 5

Layer 4

Layer 3

Layer 2

Layer 1

Protocols Resources

Management Information Base

• The set of managed objects within a system, together withtheir attributes, constitutes that system’s managementinformation base (ISO 7498-4).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 428

Page 429: Networks and Protocols '2006

Management Protocols

Management Protocol

Manager (Client)

Management Protocol

Agent (Server)

Algorithm for solvinga management problem

a resourceMIB−Model of

• Management protocols realize the access to MOs containedin a MIB.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 429

Page 430: Networks and Protocols '2006

Data-centric Approach

• The device is represented as a collection of data objectsrepresenting all the properties and capabilities of a device.

• The management protocol manipulates the data objectsrepresenting a device and its state.

• Manipulation of data objects might cause side effects.

⇒ Example: Internet management (SNMP)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 430

Page 431: Networks and Protocols '2006

Command-centric Approach

• The device is considered to be a stateful black box.• A sequence of commands can be send to the device to

a) change the state of the device or tob) retrieve data about the current state of the device (or

portions thereof).• Determining the right sequence of commands to bring a

device into a certain state might not be trivial.

⇒ Example: Command line interfaces of routers or switches

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 431

Page 432: Networks and Protocols '2006

Object-centric Approach

• The device is represented as a collection of data objects withassociated methods.

• This can be seen as a combination of the data- and thecommand-centric approaches.

• Usually leads to object-oriented modeling and thusobject-oriented approaches.

• A critical design decision is the granularity of the objects andthe level of interdependencies between objects

⇒ Example: OSI management (CMIP), DMTF informationmodels

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 432

Page 433: Networks and Protocols '2006

Document-centric Approach

• The configuration and state of a device is represented as astructured document.

• Management operations are realized by manipulating thestructured document.

• Allows to use general document processors for managementpurposes.

• Closely related to data-centric approaches.

⇒ Example: Most XML-based management approaches followthis model.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 433

Page 434: Networks and Protocols '2006

Essential Management Protocol Primitives

• From a very abstract viewpoint, the following set ofmanagement protocol primitives is essential for data-centricor object-centric management protocols:◦ GET, SET◦ CREATE, DELETE◦ SEARCH(or at the very least ITERATE)◦ LOCK, UNLOCK, COMMIT, ROLLBACK◦ NOTIFY◦ EXECUTEan operation or INVOKEa method

• Command-centric protocols usually have a very rich set ofprimitives (which are often hierarchically structured).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 434

Page 435: Networks and Protocols '2006

Information Models (RFC 3444)

• Information Models (IMs) are used to model managedobjects at a conceptual level, independent of any specificprotocols used to transport the data.

• The degree of specificity (or detail) of the abstractionsdefined in the IM depends on the modeling needs of itsdesigners.

• In order to make the overall design as clear as possible, IMsshould hide all protocol and implementation details.

• IMs focus on relationships between managed objects.• IMs are often represented in Unified Modeling Language

(UML) diagrams, but there are also informal IMs written inplain English language.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 435

Page 436: Networks and Protocols '2006

Data Models (RFC 3444)

• Data Models (DMs) are defined at a lower level of abstractionand include many details (compared to IMs).

• They are intended for implementors and includeimplementation- and protocol-specific constructs.

• DMs are often represented in formal data definitionlanguages that are specific to the management protocolbeing used.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 436

Page 437: Networks and Protocols '2006

Information Models vs. Data Models

conceptual/abstract modelfor designers and operators

concrete/detailed modelfor implementors

DM DMDM

IM

• Since conceptual models can be implemented in differentways, multiple DMs can be derived from a single IM.

• Although IMs and DMs serve different purposes, it is notalways possible to decide which detail belongs to an IM andwhich detail belongs to a DM.

• Similarily, it is sometimes difficult to determine whether anabstraction belongs to an IM or a DM.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 437

Page 438: Networks and Protocols '2006

IMs and DMs in the Real World

Information Model

MIB PIBModule

Interface Data Model

Information Model

SMIv2 SPPI OMG IDL

DefinitionsSchema

BER

Instance Data

XSD

XMLBER

Module Module

InstancesProvisioningMIB

VariablesXML

Documents

• The Architecture for Differentiated Services (RFC 2475) is anexample for an informal definition of the DiffServ informationmodel.

• The DiffServ MIB module (RFC 3289) and the DiffServ PIPmodule (RFC 3317) are examples of data modelsconforming to the DiffServ information model.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 438

Page 439: Networks and Protocols '2006

Network Management Standards

[E] Experimental

[S] Standard

[D] Draft Standard

Legend:

[P] Proposed Standard

SMI (IETF)

SNMPv3[S] [P] [D/E] [P] [D]

[S][S] [P] [D]

CMIP CMIS GDMOOSI RM.4

M.30

M.3010 M.3100 M.3400

SPPI (IETF)

CORBA (OMG)

[P]

[P]COPS−PR (IETF)

2.22.01.0 2.3 2.4 2.62.5

SNMPv3SNMPv2cSNMPv2pSNMPv1

SMIv2SMIv2SMIv2SMIv1

SPPIv1

COPS−PRv1

TMN (ITU)

CMIP (ISO)

SNMP (IETF)

DMI (DMTF)

2.0s2.01.0

1.0 2.0 2.2 2.32.4 2.5

[P][D]LDAP

[P]LDAPv3

LDAP (IETF)

LDAPv2

CIM (DMTF)

1988 1990 1992 1994 1996 1998 200019861980 1982 1984 2002 2004

3.0

SNMPv3[S]

2.72.6

NETCONF (IETF)

2006

2.8

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 439

Page 440: Networks and Protocols '2006

Management Technology Fragmentation

Proprietary

Open Standards

Research

Autonomic?Networks

GDMO / CMIP

SPPI / COPS

SMI / SNMP

TMN / IDL / IIOP

DEN / CIM / LDAP

XML / HTTP

UnicenterTivoli

TL1

CLI

JunoScript

CIM / WBEM

Networks

NETCONF

Active?

?ProgrammableNetworks

Mobile ?Agents

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 440

Page 441: Networks and Protocols '2006

Implications

• Standards Organizations:◦ Duplication of efforts binds scare human resources.

• Network Device Vendors:◦ Customers force device vendors to support multiple

management technologies, which makes devicesunnecessarily complex and expensive.

• Management Application Vendors:◦ Integrated solutions are complex and thus expensive due

to the many different interfaces.• Network Operators:

◦ Creating heterogeneous networks with commonmanagement interfaces is hard/expensive.

◦ Increased costs and time for deploying new services.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 441

Page 442: Networks and Protocols '2006

Theory of Standardization

Time

Activity

Research Investment

Time for Standardization

• The success of a standard must be measured in terms ofwide-spread deployment.

• Standards must allow vendors to differentiate their products.• Successful standards can create new open markets.• The timeliness of standards is a key factor for success.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 442

Page 443: Networks and Protocols '2006

IETF Standards Process (RFC 2026)

Working GroupDocument

(Internet Draft)

Proposed Standard

(RFC) (RFC)

Draft Standard Internet Standard

(RFC)

Historic Historic

• Internet Drafts are working documents and can be changedor removed anytime.

• All Internet standards are published in a series calledRequest For Comments (RFC), but not all RFCs definestandards (informational or experimental RFCs).

• The step from Proposed to Draft standard requires twoindependent and interoperable implementations fromdifferent code bases for all protocol features.

• The step from Draft to Standard requires significantimplementation and operational experience.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 443

Page 444: Networks and Protocols '2006

IETF Management Standards

• The requirements for Internet management technologieshave changed during the last decade.

• Some fundamental design decisions taken in the late 1980smust be revisited to better reflect today’s realities.

• Working group members are dominated by network devicevendors (solutions tend to be too device specific or way toodetailed for real networks).

• Work on SNMP security took many many years to finallyresult in a stable SNMPv3 specification while other urgentlyneeded SNMP improvements were kept on hold.

• Need to move to more mainstream technologies sincenetwork management remains a niche market.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 444

Page 445: Networks and Protocols '2006

IETF Standardization Principles

• KISS: Complex standards requiring people with special skillswill not survive.

• Timeliness: Standards need to address real-world problemsin a timely manner.

• Interoperability is more important than strict correctness.(Implementations should be liberal in what they accept andstringent in what they generate.)

• Protocols sometimes show effects when used on a largerscale that can not be observed on small scales.

• Concentration processes have given a few “big players”strong influence on the success of standards.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 445

Page 446: Networks and Protocols '2006

MIB Standardization Experience

• Standardizing MIBs in order to establish an open marketbetween device vendors and management software vendorsdoes not always work very well:1. Standardization takes too long.2. Consensus often on the lowest common denominator.3. Operationally important information often contained in

proprietary MIB extensions.4. Implementation and resource costs hinder fast and

wide-spread deployment.

⇒ The sheer number of standardization efforts and proposalssometimes seem to distract those who do the actual workfrom doing the actual work.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 446

Page 447: Networks and Protocols '2006

References[1] H. G. Hegering, S. Abeck, and B. Neumair. Integrated Management of Networked Systems.

Morgan Kaufmann, 1999.

[2] ISO. Information processing systems – Open System Interconnection – Basic Reference Model– Part 4: Management Framework. International Standard ISO/IEC 7498-4, ISO, 1989.

[3] S. Bradner. The Internet Standards Process – Revision 3. RFC 2026, Harvard University,October 1996.

[4] B. Carpenter. Architectural Principles of the Internet. RFC 1958, IAB, June 1996.

[5] A. Pras and J. Schönwälder. On the Difference between Information Models and Data Models.RFC 3444, University of Twente, University of Osnabrueck, January 2003.

[6] A. Pras. Network Management Architectures. PhD thesis, Centre for Telematics and InformationTechnology, Twente University, Enschede, 1995.

[7] J. Schönwälder, A. Pras, and J. P. Martin-Flatin. On the Future of Internet ManagementTechnologies. IEEE Communications Magazine, 41(10):90–97, October 2003.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 447

Page 448: Networks and Protocols '2006

Structure of Management Information Version 2(SMIv2)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 448

Page 449: Networks and Protocols '2006

SMI Version 2 (SMIv2)

→ Fundamental SMIv2 Concepts

→ SMI Naming (Object Type and Instance Identifier)

→ SMI Modules and Object Identities

→ Object Types and Notification Types

→ Textual Conventions

→ Conformance Statements

→ MIB Module Design, Implementation and Testing

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 449

Page 450: Networks and Protocols '2006

Fundamental SMIv2 Concepts

• The second version of the Structure of ManagementInformation (SMIv2) [RFC 2578, RFC 2579, RFC 2580] is adata definition language which is used to define the syntaxand semantics of management data models.

• SMIv2 is based on an adapted subset of ASN.1 (1988).• All management information is held in a collection of typed

variables.• All SMIv2 data types resolve to one of the primitive ASN.1

types INTEGER, OCTET STRING, andOBJECT IDENTIFIER .

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 450

Page 451: Networks and Protocols '2006

Fundamental SMIv2 Concepts

• There are no compound data types (like classes, structuresor unions).

• Variables either appear as scalars (exactly one instance) oras columns in a conceptual table (zero or more instances).

• Variables can be read and written using SNMP.• The protocol allows to manipulate arbitrary lists of variables

in one transaction.• The protocol does not allow to manipulate conceptual tables

or conceptual table rows.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 451

Page 452: Networks and Protocols '2006

SMIv2 Base Types

SMIv2 Type Description

INTEGER enumerations (signed integer)

OCTET STRING sequence of arbitrary bytes

OBJECT IDENTIFIER unique identifier

Integer32 signed integer (-2147483648..2147483647)

Unsigned32 unsigned integer (0..4294967295)

Gauge32 gauge (0..4294967295)

Counter32 counter (0..4294967295)

Counter64 counter (0..18446744073709551615)

TimeTicks elapsed time in hundredths of a second

IpAddress four byte IP version 4 address

Opaque wrapper for arbitrary ASN.1 types

BITS named bit sets

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 452

Page 453: Networks and Protocols '2006

SMI Naming of Variables

MIB

Manager Agent

address

name uptime

Manager

(HP/OV) Router

(1)

address (1) info (2)

name (1) uptime (2)

• Every variable type is registered in the ISO OID registrationtree.

• The leaves of the OID tree represent so called object types.• Intermediate nodes may be used to group related object type

definitions together.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 453

Page 454: Networks and Protocols '2006

Object Type Names versus Instance Names

• The registration of an object type assigns a globally uniquename (OID).

• Concrete instances of the object type are identified by aninstance name.

• The instance name is appended to the OID (name) of theobject type.

• Scalars can only have one instance. The instance name isalways constructed by appending “0”.

• The instance name of columnar variables is derived from thekey(s) of the underlying conceptual table.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 454

Page 455: Networks and Protocols '2006

Scalar Object Types and Instance Names

(1)

address (1) info (2)

name (1) uptime (2)

Object Identifier Instance Identifier Type Value

1.1 0 IpAddress 10.1.2.1

1.2.1 0 OCTET STRING "ACME Router"

1.2.2 0 TimeTicks 54321

• Descriptors are only used by humans — SNMP onlyoperates on OID values.

• Descriptors must be unique within a module. Module namesmust be globally unique.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 455

Page 456: Networks and Protocols '2006

Columnar Object Types and Instance Names

(1)

address (1)

uptime (2)

fwdTable (3)

fwdEntry (1)

fwdDest (2) fwdNext (3)fwdIndex (1)

1

3

5

6

2

4

info (2)

2

3

2

2

3

3

2

3

5

7

8

9

1

2

3

5

7

8

9

name (1)

• The column fwdIndex uniquely identifies a row in theconceptual fwdTable .

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 456

Page 457: Networks and Protocols '2006

Columnar Instance Names

• Conceptual tables are constructed using two auxiliary nodes:◦ The first node represents the table (syntactically an

ASN.1 SEQUENCE OF).◦ The descriptor of the first node always ends with “Table”.◦ The second node represents a table row (syntactically an

ASN.1 SEQUENCE).◦ The descriptor of the second node always ends with

“Entry”.• The primary key of the table is called the index and is used to

derive the instance identifier for a table row.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 457

Page 458: Networks and Protocols '2006

Columnar Instance Names

• The concatenation of the object type name and the instanceidentifier yields the unique object identifier to address acolumnar variable.

• Examples (see fwdTable from previous slides):

◦ 1.3.1.1.1 ⇒ 1◦ 1.3.1.3.1 ⇒ 2◦ 1.3.1.2.4 ⇒ 7◦ 1.3.1.2.7 ⇒ does not exist

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 458

Page 459: Networks and Protocols '2006

Complex Columnar Instance Names

(1)

address (1)

uptime (2)

fwdTable (3)

fwdEntry (1)

fwdMask (2)

info (2)

name (1)

fwdNext (3)

0.0.0.0 255.255.255.0 134.169.34.1

255.0.0.0

255.255.255.0

255.255.255.0

255.255.255.0

127.0.0.1

134.169.34.15

134.169.34.18

134.169.34.18

127.0.0.1

134.169.34.0

134.169.35.1

134.169.35.2

fwdDest (1)

• The index into a more realistic IPv4 forwarding table is thecombination of a destination address and an address mask.

• 1.3.1.3.134.169.34.0.255.255.255.0 ⇒ 134.169.34.15

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 459

Page 460: Networks and Protocols '2006

Instance Name for Conceptual Tables

• Rules for forming the instance names:1. integer-valued: a single sub-identifier taking the integer

value2. string-valued, fixed-length: each octet of the string is

encoded in a separate sub-identifier3. string-valued, variable-length: the first sub-identifier is the

length followed by each octet of the string encoded in aseparate sub-identifier

4. object identifier-valued: the first sub-identifier is the lengthfollowed by each sub-identifier

• The IMPLIED keyword can be used to avoid the lengthsub-identifier in some cases (not recommended).

• Instance identifier can not be arbitrarily complex since OIDsare limited to 128 sub-identifiers.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 460

Page 461: Networks and Protocols '2006

MIB Modules and Object Identities

• Related SMI definitions are grouped into MIB modules.• Every MIB module must have a unique name.• A MIB module corresponds to an ASN.1 module.• Definitions can be imported from other MIB modules using

an ASN.1 IMPORT.• All SMIv2 macros and derived data types used in a MIB

module must be imported.

ACME-ROUTER-MIB DEFINITIONS ::= BEGIN

IMPORT MODULE-IDENTITY, OBJECT-TYPE, Integer32, enterpr ises

FROM SNMPv2-SMI;

-- ...

ENDslides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 461

Page 462: Networks and Protocols '2006

SMIv2 Module Identity Macro (RFC 2578)

<Descriptor> MODULE-IDENTITYLAST-UPDATED <ExtUTCTime>ORGANIZATION <Text>CONTACT-INFO <Text>DESCRIPTION <Text>[REVISION <ExtUTCTime>DESCRIPTION <Text>] *::= <ObjectIdentifier>

• The MODULE-IDENTITY macro provides contact informationand the revision history.

• The REVISION and DESCRIPTION clauses can repeatmultiple times.

• The OID of the MODULE-IDENTITY macro is often used asthe top-level node for all definitions in a module.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 462

Page 463: Networks and Protocols '2006

Module Identity Macro Example (RFC 2863)

ifMIB MODULE-IDENTITY

LAST-UPDATED "200006140000Z"

ORGANIZATION "IETF Interfaces MIB Working Group"

CONTACT-INFO "Keith McCloghrie Cisco Systems, Inc.

408-526-5260 170 West Tasman Drive

[email protected] San Jose, CA 95134-1706, US"

DESCRIPTION "The MIB module to describe generic objects for network

interface sub-layers. This MIB is an updated version

of MIB-II’s ifTable, and incorporates the extensions

defined in RFC 1229."

REVISION "200006140000Z"

DESCRIPTION "Clarifications agreed upon by the Interfaces MIB WG,

and published as RFC 2863"

REVISION "199602282155Z"

DESCRIPTION "Revisions made by the Interfaces MIB WG, and pu blished

in RFC 2233."

REVISION "199311082155Z"

DESCRIPTION "Initial revision, published as part of RFC 157 3."

::= { mib-2 31 }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 463

Page 464: Networks and Protocols '2006

SMIv2 Object Identity Macro (RFC 2578)

<Descriptor> OBJECT-IDENTITYSTATUS <Status>DESCRIPTION <Text>[REFERENCE <Text>]::= <ObjectIdentifier>

• The macro is used to define and register OBJECTIDENTIFIER values.

• The STATUS clause defines whether the definition is“current”, “deprecated” or “obsolete”.

• The optional REFERENCE clause can point to relateddefinitions.

• Used to define constants (“extensible enumerations”) or tostructure the OID tree.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 464

Page 465: Networks and Protocols '2006

Object Identity Macro Examples (RFC 2578, 3417)

zeroDotZero OBJECT-IDENTITY

STATUS current

DESCRIPTION

"A value used for null identifiers."

::= { 0 0 }

snmpUDPDomain OBJECT-IDENTITY

STATUS current

DESCRIPTION

"The SNMPv2 over UDP transport domain. The corresponding

transport address is of type SnmpUDPAddress."

::= { snmpDomains 1 }

snmpIPXDomain OBJECT-IDENTITY

STATUS current

DESCRIPTION

"The SNMPv2 over IPX transport domain. The corresponding

transport address is of type SnmpIPXAddress."

::= { snmpDomains 5 }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 465

Page 466: Networks and Protocols '2006

Object Types and Notification Types

• The heart of a MIB are the object types and conceptualtables.

• The object type macro is used to define object types andconceptual tables.

• Additional ASN.1 type definitions are needed for conceptualtables.

• Notification Types define events that can be reported tomanagers.

• Notifications have been used sparingly in the past since therewere no standardized mechanisms to enable/disable them.

• Not carefully designed notification types can lead tonotification storms.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 466

Page 467: Networks and Protocols '2006

SMIv2 Object Type Macro (RFC 2578)

<Descriptor> OBJECT-TYPESYNTAX <Syntax>[UNITS <Text>]MAX-ACCESS <Access>STATUS <Status>DESCRIPTION <Text>[REFERENCE <Text>][INDEX <Index> | AUGMENTS <Index>][DEFVAL <Value>]::= <ObjectIdentifier>

• OBJECT-TYPE macros are used to define object types aswell as conceptual tables.

• The INDEX or AUGMENTS clause is only allowed forconceptual row definitions, where one of them is mandatory.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 467

Page 468: Networks and Protocols '2006

Object Type Macro Examples (RFC 3418)

sysDescr OBJECT-TYPE

SYNTAX DisplayString (SIZE (0..255))

MAX-ACCESS read-only

STATUS current

DESCRIPTION "A textual description of the entity. This valu e should

include the full name and version identification of the

system’s hardware type, software operating-system, and

networking software."

::= { system 1 }

sysUpTime OBJECT-TYPE

SYNTAX TimeTicks

MAX-ACCESS read-only

STATUS current

DESCRIPTION "The time (in hundredths of a second) since the n etwork

management portion of the system was last re-initialized."

::= { system 3 }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 468

Page 469: Networks and Protocols '2006

Object Type Macro Examples (RFC 3418)

sysName OBJECT-TYPE

SYNTAX DisplayString (SIZE (0..255))

MAX-ACCESS read-write

STATUS current

DESCRIPTION "An administratively-assigned name for this m anaged node.

By convention, this is the node’s fully-qualified domain

name. If the name is unknown, the value is the

zero-length string."

::= { system 5 }

sysLocation OBJECT-TYPE

SYNTAX DisplayString (SIZE (0..255))

MAX-ACCESS read-write

STATUS current

DESCRIPTION "The physical location of this node (e.g., ’tel ephone

closet, 3rd floor’). If the location is unknown, the

value is the zero-length string."

::= { system 6 }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 469

Page 470: Networks and Protocols '2006

Object Type Macro Examples (RFC 3418)

sysORTable OBJECT-TYPE

SYNTAX SEQUENCE OF SysOREntry

MAX-ACCESS not-accessible

STATUS current

DESCRIPTION "The (conceptual) table listing the capabilit ies of the

local SNMP application acting as a command responder with

respect to various MIB modules. SNMP entities having

dynamically-configurable support of MIB modules will have a

dynamically-varying number of conceptual rows."

::= { system 9 }

sysOREntry OBJECT-TYPE

SYNTAX SysOREntry

MAX-ACCESS not-accessible

STATUS current

DESCRIPTION "An entry (conceptual row) in the sysORTable."

INDEX { sysORIndex }

::= { sysORTable 1 }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 470

Page 471: Networks and Protocols '2006

Object Type Macro Examples (RFC 3418)

SysOREntry ::= SEQUENCE {

sysORIndex INTEGER,

sysORID OBJECT IDENTIFIER,

sysORDescr DisplayString,

sysORUpTime TimeStamp

}

sysORIndex OBJECT-TYPE

SYNTAX INTEGER (1..2147483647)

MAX-ACCESS not-accessible

STATUS current

DESCRIPTION "The auxiliary variable used for identifying i nstances

of the columnar objects in the sysORTable."

::= { sysOREntry 1 }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 471

Page 472: Networks and Protocols '2006

Object Type Macro Examples (RFC 3418)

sysORID OBJECT-TYPE

SYNTAX OBJECT IDENTIFIER

MAX-ACCESS read-only

STATUS current

DESCRIPTION "An authoritative identification of a capabil ities

statement with respect to various MIB modules

supported by the local SNMP application acting

as a command responder."

::= { sysOREntry 2 }

sysORDescr OBJECT-TYPE

SYNTAX DisplayString

MAX-ACCESS read-only

STATUS current

DESCRIPTION "A textual description of the capabilities ide ntified

by the corresponding instance of sysORID."

::= { sysOREntry 3 }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 472

Page 473: Networks and Protocols '2006

Object Type Macro Examples (RFC 3418)

sysORUpTime OBJECT-TYPE

SYNTAX TimeStamp

MAX-ACCESS read-only

STATUS current

DESCRIPTION "The value of sysUpTime at the time this concept ual

row was last instantiated."

::= { sysOREntry 4 }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 473

Page 474: Networks and Protocols '2006

SMIv2 Notification Type Macro (RFC 2578)

<Descriptor> NOTATION-TYPE[OBJECTS <Objects>]STATUS <Status>DESCRIPTION <Text>[REFERENCE <Text>]::= <ObjectIdentifier>

• Registers a notification type with an object identifier.• The next to last sub-identifier should be “0” for backwards

compatibility with older SNMP versions.• The OBJECTS clause defines the ordered sequence of MIB

object types which are contained in a notification.• The DESCRIPTION clause must describe which instances

are to be included in a notification.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 474

Page 475: Networks and Protocols '2006

Notification Type Macro Examples (RFC 2863)

linkDown NOTIFICATION-TYPE

OBJECTS { ifIndex, ifAdminStatus, ifOperStatus }

STATUS current

DESCRIPTION "A linkDown trap signifies that the SNMP entity ,

acting in an agent role, has detected that the

ifOperStatus object for one of its communication links

is about to enter the down state from some other state

(but not from the notPresent state). This other state

is indicated by the included value of ifOperStatus."

::= { snmpTraps 3 }

linkUp NOTIFICATION-TYPE

OBJECTS { ifIndex, ifAdminStatus, ifOperStatus }

STATUS current

DESCRIPTION "A linkDown trap signifies that the SNMP entity ,

acting in an agent role, has detected that the

ifOperStatus object for one of its communication links

left the down state and transitioned into some other

state (but not into the notPresent state). This other

state is indicated by the included value of ifOperStatus."

::= { snmpTraps 4 }slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 475

Page 476: Networks and Protocols '2006

Textual Conventions (RFC 2579)

• Textual conventions are used to derive new types fromSMIv2 base types.

• New types may not be derived from otherTEXTUAL-CONVENTIONs.

• The DISPLAY-HINT clause defines a mapping from theinternal representation into a human readable format andback.

• The DISPLAY-HINT clause can only be used with anINTEGER or an OCTET STRING base type.

• A textual convention supports formal restrictions (e.g.,ranges).

• A textual convention does not allow to define compoundtypes (e.g., structures or unions).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 476

Page 477: Networks and Protocols '2006

SMIv2 Textual Conventions Macro (RFC 2579)

<TypeDescriptor> ::= TEXTUAL-CONVENTION[DISPLAY-HINT <Text>]STATUS <Status>DESCRIPTION <Text>[REFERENCE <Text>]SYNTAX <Syntax>

• The DISPLAY-HINT clause defines a mapping from theinternal representation into a human readable format andback.

• The DISPLAY-HINT clause can only be used with anINTEGER or an OCTET STRING base type.

• The SYNTAX clause defines the (restricted) SMIv2 basetype. Additional semantics are defined in the DESCRIPTIONclause.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 477

Page 478: Networks and Protocols '2006

DISPLAY-HINTS (INTEGER)

Format Description

d decimal valued-<number> decimal value with a decimal point

b binary valueo octal valuex hexadecimal value

• Examples:– “ d ” for value 143 renders 143– “d-2 ” for value 143 renders 1.43– “ b ” for value 143 renders 100001111– “ o ” for value 143 renders 217– “ x ” for value 143 renders 8F

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 478

Page 479: Networks and Protocols '2006

DISPLAY-HINTS (OCTET STRING)

[<repeat>]<number><format>[<separator>][<terminator >]

Field Description

<repeat> number of times to apply the remainder of the specification

(∗ indicates the current octet, default 1)

<number> number of octets converted according to the next field

<format> display format (a ascii, d decimal, x hexadecimal, o octal, t UTF-8)

<separator> separator character

<terminator> terminating character if <repeat> and <separator> parts

are present

• Examples:– “255a ” for value “aBc” renders “aBc”– “1x: ” for value “aBc” renders “61:42:63”– “0aH0ae0al0al0ao 1a ” for value “World” renders “Hello

World”slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 479

Page 480: Networks and Protocols '2006

Textual Convention Macro Examples (RFC 3411)

SnmpSecurityLevel ::= TEXTUAL-CONVENTION

STATUS current

DESCRIPTION

"A Level of Security at which SNMP messages can be sent or with

which operations are being processed; in particular, one of :

noAuthNoPriv - without authentication and without privacy ,

authNoPriv - with authentication but without privacy,

authPriv - with authentication and with privacy.

These three values are ordered such that noAuthNoPriv is les s

than authNoPriv and authNoPriv is less than authPriv."

SYNTAX INTEGER {

noAuthNoPriv(1),

authNoPriv(2),

authPriv(3)

}

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 480

Page 481: Networks and Protocols '2006

Textual Convention Macro Examples (RFC 2579)

MacAddress ::= TEXTUAL-CONVENTION

DISPLAY-HINT "1x:"

STATUS current

DESCRIPTION

"Represents an 802 MAC address represented in the

‘canonical’ order defined by IEEE 802.1a, i.e., as if it

were transmitted least significant bit first, even though

802.5 (in contrast to other 802.x protocols) requires MAC

addresses to be transmitted most significant bit first."

SYNTAX OCTET STRING (SIZE (6))

TruthValue ::= TEXTUAL-CONVENTION

STATUS current

DESCRIPTION

"Represents a boolean value."

SYNTAX INTEGER { true(1), false(2) }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 481

Page 482: Networks and Protocols '2006

Textual Convention Macro Examples (RFC 2579)

DateAndTime ::= TEXTUAL-CONVENTION

DISPLAY-HINT "2d-1d-1d,1d:1d:1d.1d,1a1d:1d"

STATUS current

DESCRIPTION "A date-time specification.

field octets contents range

----- ------ -------- -----

1 1-2 year * 0..65536

2 3 month 1..12

3 4 day 1..31

4 5 hour 0..23

5 6 minutes 0..59

6 7 seconds 0..60

(use 60 for leap-second)

7 8 deci-seconds 0..9

8 9 direction from UTC ’+’ / ’-’

9 10 hours from UTC * 0..13

10 11 minutes from UTC 0..59"

SYNTAX OCTET STRING (SIZE (8 | 11))

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 482

Page 483: Networks and Protocols '2006

Conformance Statements

• Conformance statements define implementationrequirements.

• Object type and notification type definitions may be groupedtogether.

• Groups can be mandatory, optional or conditionally optional.• The maximum access of an object type definition may be

revised.• The type associated with an object type may be refined.• It is possible to have different type refinements for read and

write operations.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 483

Page 484: Networks and Protocols '2006

SMIv2 Object Group Macro (RFC 2580)

<Descriptor> OBJECT-GROUPOBJECTS <Objects>STATUS <Status>DESCRIPTION <Text>[REFERENCE <Text>]::= <ObjectIdentifier>

• Defines a collection of related managed object types.• Object groups can be used to define conformance levels.• The status of the object group definition must conform to the

status of the objects types listed in the OBJECTS clause.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 484

Page 485: Networks and Protocols '2006

SMIv2 Notification Group Macro (RFC 2580)

<Descriptor> NOTIFICATION-GROUPNOTIFICATIONS <Notifications>STATUS <Status>DESCRIPTION <Text>[REFERENCE <Text>]::= <ObjectIdentifier>

• Defines a collection of related notification types.• Notification groups can be used to define conformance

levels.• The status of the notification group definition must conform to

the status of the notifications listed in the NOTIFICATIONSclause.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 485

Page 486: Networks and Protocols '2006

Object and Notification Group Examples (RFC 3418)

systemGroup OBJECT-GROUP

OBJECTS { sysDescr, sysObjectID, sysUpTime,

sysContact, sysName, sysLocation,

sysServices,

sysORLastChange, sysORID,

sysORUpTime, sysORDescr }

STATUS current

DESCRIPTION "The system group defines objects which are com mon

to all managed systems."

::= { snmpMIBGroups 6 }

snmpBasicNotificationsGroup NOTIFICATION-GROUP

NOTIFICATIONS { coldStart, authenticationFailure }

STATUS current

DESCRIPTION "The basic notifications implemented by an SNM P

entity supporting command responder applications."

::= { snmpMIBGroups 7 }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 486

Page 487: Networks and Protocols '2006

SMIv2 Module Compliance Macro (RFC 2580)

<Descriptor> MODULE-COMPLIANCESTATUS <Status>DESCRIPTION <Text>[REFERENCE <Text>][MODULE <Name>

[MANDATORY-GROUPS <Groups>][GROUP <ObjectIdentifier>DESCRIPTION <Text>] *[OBJECT <ObjectIdentifier>DESCRIPTION <Text>] * ] *

::= <ObjectIdentifier>

• This is a simplified version!• Specifies implementation requirements for a compliant

implementation.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 487

Page 488: Networks and Protocols '2006

Module Compliance Macro Examples (RFC 3418)

snmpBasicComplianceRev2 MODULE-COMPLIANCE

STATUS current

DESCRIPTION "The compliance statement for SNMP entities wh ich

implement this MIB module."

MODULE -- this module

MANDATORY-GROUPS { snmpGroup, snmpSetGroup, systemGroup ,

snmpBasicNotificationsGroup }

GROUP snmpCommunityGroup

DESCRIPTION "This group is mandatory for SNMP entities whic h

support community-based authentication."

GROUP snmpWarmStartNotificationGroup

DESCRIPTION "This group is mandatory for an SNMP entity whic h

supports command responder applications, and is

able to reinitialize itself such that its

configuration is unaltered."

::= { snmpMIBCompliances 3 }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 488

Page 489: Networks and Protocols '2006

Module Compliance Macro Examples (RFC 3414)

usmMIBCompliance MODULE-COMPLIANCE

STATUS current

DESCRIPTION "The compliance statement for SNMP engines whi ch

implement the SNMP-USER-BASED-SM-MIB."

MODULE -- this module

MANDATORY-GROUPS { usmMIBBasicGroup }

OBJECT usmUserAuthProtocol

MIN-ACCESS read-only

DESCRIPTION "Write access is not required."

OBJECT usmUserPrivProtocol

MIN-ACCESS read-only

DESCRIPTION "Write access is not required."

::= { usmMIBCompliances 1 }

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 489

Page 490: Networks and Protocols '2006

MIB Engineering Process

• Iterations are possible and useful before MIB definitions arereleased.

• MIB definitions that have been released can not be modifiedanymore.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 490

Page 491: Networks and Protocols '2006

MIB Analysis and Design

• Components◦ Collections of logical or physical devices or services.

• Attributes◦ “Stable” attributes that describe the management aspects

of a component.• Relationships

◦ Relationships between components (containment, logicalorder, . . . )

◦ Relationships between attributes of components.◦ Cardinality of components and attributes involved in

relationships.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 491

Page 492: Networks and Protocols '2006

MIB Analysis and Design

• State Attributes◦ Describe the desired (administrative) and/or current

(operational) state of a component.◦ Use state diagrams to document possible state

transitions.• Statistic Attributes

◦ Statistic attributes document what a component has donein the past.

◦ Statistics are bound to a lifetime which should bewell-defined.

◦ Statistics should be basic; managers can typically easilycompute derived statistics

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 492

Page 493: Networks and Protocols '2006

MIB Conventions

• Related object type definitions are grouped into a subtree.• Object type names start with a common prefix to identify the

logical group (e.g. sysUpTime , sysServices ).• Counter object type names use the plural spelling

(e.g., ifInOctets ).• Conceptual table names end with the suffix Table and names

of conceptual rows end with the suffix Entry (e.g., ifTable ,ifEntry ).

• All (conceptual table) definitions share a common prefix(e.g., ifType , ifDescr ).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 493

Page 494: Networks and Protocols '2006

MIB Compiler

• Front-end compilers perform syntax checks and to someextend semantic checks.

• Back-end compilers can generate◦ documentation,◦ code to automate steps of the implementation process,◦ test suites to test agent or manager implementation,◦ input for management applications which access MIB

definitions at run time.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 494

Page 495: Networks and Protocols '2006

Testing MIB Implementations

• Automated regression tests help to ensure the quality of theMIB implementation.

• Many test cases can be generated automatically from theMIB definition.

• Additional test cases should be written by an independentengineer.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 495

Page 496: Networks and Protocols '2006

Typical MIB Implementation Problems

• Caching:◦ Access to management information might be expensive.◦ Solution: Try to cache some information in the access

method to reduce the number of costly interactions.◦ Problem: How to define the lifetime of the cache?

• Atomic Sets: It is sometimes difficult to guarantee “as ifsimultaneous” semantics because:◦ Variable names and values can come in any order.◦ A single set may include multiple values for a single

instance.◦ It is difficult to maintain state during a sequence of set

operations.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 496

Page 497: Networks and Protocols '2006

References[1] K. McCloghrie, D. Perkins, and J. Schönwälder. Structure of Management Information Version 2

(SMIv2). RFC 2578, Cisco Systems, SNMPinfo, TU Braunschweig, April 1999.

[2] K. McCloghrie, D. Perkins, and J. Schönwälder. Textual Conventions for SMIv2. RFC 2579,Cisco Systems, SNMPinfo, TU Braunschweig, April 1999.

[3] K. McCloghrie, D. Perkins, and J. Schönwälder. Conformance Statements for SMIv2. RFC 2580,Cisco Systems, SNMPinfo, TU Braunschweig, April 1999.

[4] D. Perkins and E. McGinnis. Understanding SNMP MIBs. Prentice Hall, 1997.

[5] C. M. Heard. Guidelines for Authors and Reviewers of MIB Documents. RFC 4181, Consultant,September 2005.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 497

Page 498: Networks and Protocols '2006

Core IETF MIB Models

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 498

Page 499: Networks and Protocols '2006

Core IETF MIB Models

→ OID Registration Tree

→ Physical and Logical Network Interfaces

→ Physical and Logical Entities

→ Internet Protocol (IPv4)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 499

Page 500: Networks and Protocols '2006

OID Registration Tree

system(1) interfaces(2) ip(4) icmp(5) tcp(6) udp(7) transmission(10) snmp(11)

standard(0) registration−authority(1) member−body(2) identified−organization(3)

dod(6)

internet(1)

directory(1) mgmt(2) experimental(3) private(4) security(5) snmpV2(6)

mib−2(1) snmpDomains(1) snmpProxy(2) snmpModules(3)

dot5(9)x25(5) dot3(7) fddi(15) lapb(16) ...

... snmpMIB(1) snmpFrameworkMIB(10)

itu−t(0) / ccitt(0) joint−iso−itu−t(2) / joint−iso−ccitt(2)iso(1)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 500

Page 501: Networks and Protocols '2006

Physicaland

LogicalNetw

orkInterfaces

ifName(1)ifInMulticastPkts(2)ifInBroadcastPkts(3)ifOutMulticastPkts(4)ifOutBroadcastPkts(5)ifHCInOctets(6)ifHCInUcastPkts(7)ifHCInMulticastPkts(8)ifHCInBroadcastPkts(9)ifHCOutOctets(10)ifHCOutUcastPkts(11)ifHCOutMulticastPkts(12)ifHCOutBroadcastPkts(13)ifLinkUpDownTrapEnable(14)ifHighSpeed(15)ifPromiscuousMode(16)ifConnectorPresent(17)ifAlias(18)ifCounterDiscontinuityTime(19)

ifRcvAddressStatus(2)

ifRcvAddressAddress(1)

ifRcvAddressType(3)

ifEntry(1)

ifTable(2)

interfaces(2)

ifNum

ber(1)

ifInUnknownProtos(15)

ifIndex(1)ifDescr(2)ifType(3)ifMtu(4)ifSpeed(5)ifPhysAddress(6)ifAdminStatus(7)ifOperStatus(8)ifLastChange(9)ifInOctets(10)ifInUcastPkts(11)ifInNUcastPkts(12)ifInDiscards(13)ifInErrors(14)

ifOutOctets(16)ifOutUcastPkts(17)ifOutNUcastPkts(18)ifOutDiscards(19)ifOutErrors(20)ifOutQLen(21)ifSpecific(22) m

ib−2(1.3.6.1.2.1)

ifXT

able(1)

ifXE

ntry(1)

ifMIB

Objects(1)

ifMIB

(31)

ifStackE

ntry(1)

ifStackT

able(2)

ifStackLowerLayer(2)

ifStackHigherLayer(1)

ifStackStatus(3)

ifTableLastChange(5)ifStackLastChange(6)

ifRcvA

ddressEntry(1)

ifRcvA

ddressTable(4)

slides.tex–

Netw

orksand

Protocols

’2006–

JurgenS

chonwalder

–9/10/2006

–8:18

–p.501

Page 502: Networks and Protocols '2006

OID

TreeS

tructureofthe

IF-M

IB(R

FC

2863)

ifName(1)ifInMulticastPkts(2)ifInBroadcastPkts(3)ifOutMulticastPkts(4)ifOutBroadcastPkts(5)ifHCInOctets(6)ifHCInUcastPkts(7)ifHCInMulticastPkts(8)ifHCInBroadcastPkts(9)ifHCOutOctets(10)ifHCOutUcastPkts(11)ifHCOutMulticastPkts(12)ifHCOutBroadcastPkts(13)ifLinkUpDownTrapEnable(14)ifHighSpeed(15)ifPromiscuousMode(16)ifConnectorPresent(17)ifAlias(18)ifCounterDiscontinuityTime(19)

ifRcvAddressStatus(2)

ifRcvAddressAddress(1)

ifRcvAddressType(3)

ifEntry(1)

ifTable(2)

interfaces(2)

ifNum

ber(1)

ifInUnknownProtos(15)

ifIndex(1)ifDescr(2)ifType(3)ifMtu(4)ifSpeed(5)ifPhysAddress(6)ifAdminStatus(7)ifOperStatus(8)ifLastChange(9)ifInOctets(10)ifInUcastPkts(11)ifInNUcastPkts(12)ifInDiscards(13)ifInErrors(14)

ifOutOctets(16)ifOutUcastPkts(17)ifOutNUcastPkts(18)ifOutDiscards(19)ifOutErrors(20)ifOutQLen(21)ifSpecific(22) m

ib−2(1.3.6.1.2.1)

ifXT

able(1)

ifXE

ntry(1)

ifMIB

Objects(1)

ifMIB

(31)

ifStackE

ntry(1)

ifStackT

able(2)

ifStackLowerLayer(2)

ifStackHigherLayer(1)

ifStackStatus(3)

ifTableLastChange(5)ifStackLastChange(6)

ifRcvA

ddressEntry(1)

ifRcvA

ddressTable(4)

slides.tex–

Netw

orksand

Protocols

’2006–

JurgenS

chonwalder

–9/10/2006

–8:18

–p.502

Page 503: Networks and Protocols '2006

Case Diagram of the ifTable of the IF-MIB

+ +

ifInDiscards

ifInUnknownProtos

ifInErrors

ifOutErrors

ifOutDiscards

ifInUcastPkts

ifInNUcastPkts

ifOutUcastPkts

ifOutNUcastPkts

• Case diagrams are used to explain relationships betweencounters

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 503

Page 504: Networks and Protocols '2006

Case Diagrams

• The total number of packets delivered to the next higher layeris:

ifInUcastPkts + ifInNUcastPkts• The total number of received packets from the interface is:

(ifInUcastPkts + ifInNUcastPkts) + ifInDiscards +ifInUnknownProtos + ifInErrors

• The total number of send packets over the interface is:

(ifOutUcastPkts + ifOutNUcastPkts) - ifOutErrors -ifOutDiscards

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 504

Page 505: Networks and Protocols '2006

Physical and Logical Entities

<<smi mib class>>entLogicalEntry

-entLogicalIndex: Integer32 {index}+entLogicalDescr: SnmpAdminString+entLogicalType: AutonomousType+entLogicalCommunity: OctetString+entLogicalTAddress: TAddress+entLogicalTDomain: TDomain+entLogicalContextEngineID: SnmpEngineIdOrNone+entLogicalContextName: SnmpAdminString

<<smi mib class>>entLPMappingEntry

-entLogicalIndex: Integer32 {index}+entLPPhysicalIndex: PhysicalIndex {index}

<<smi mib class>>entPhysicalEntry

-entPhysicalIndex: PhysicalIndex {index}+entPhysicalDescr: SnmpAdminString+entPhysicalVendorType: AutonomousType+entPhysicalContainedIn: Integer32+entPhysicalClass: PhysicalClass+entPhysicalParentRelPos: Integer32+entPhysicalName: SnmpAdminString+entPhysicalHardwareRev: SnmpAdminString+entPhysicalFirmwareRev: SnmpAdminString+entPhysicalSoftwareRev: SnmpAdminString+entPhysicalSerialNum: SnmpAdminString+entPhysicalMfgName: SnmpAdminString+entPhysicalModelName: SnmpAdminString+entPhysicalAlias: SnmpAdminString+entPhysicalAssetID: SnmpAdminString+entPhysicalIsFRU: TruthValue

<<smi mib class>>entAliasMappingEntry

-entPhysicalIndex: PhysicalIndex {index}-entAliasLogicalIndexOrZero: Integer32 {index}+entAliasMappingIdentifier: RowPointer

extends

<<smi mib class>>entPhysicalContainsEntry

-entPhysicalIndex: PhysicalIndex {index}+entPhysicalChildIndex: PhysicalIndex {index}

accessible via

0..n

0..n

<<smi mib class>>entityGeneral

+entLastChangeTime: TimeStamp

is contained in

container1

element0..n

UML Diagram for the ENTITY-MIB (RFC 2737).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 505

Page 506: Networks and Protocols '2006

IP/IC

MP

Version4

MIB

Module

(RF

C2011)

ipNetToMediaIfIndex(1)ipNetToMediaPhysAddress(2)ipNetToMediaNetAddress(3)ipNetToMediaType(4)

ipNetT

oMediaE

ntry(1)

icmpInMsgs(1)icmpInErrors(2)icmpInDestUnreachs(3)icmpInTimeExcds(4)icmpInParmProbs(5)icmpInSrcQuenchs(6)icmpInRedirects(7)icmpInEchos(8)icmpInEchoReps(9)icmpInTimestamps(10)icmpInTimestampReps(11)icmpInAddrMasks(12)icmpInAddrMaskReps(13)icmpOutMsgs(14)icmpOutErrors(15)icmpOutDestUnreachs(16)icmpOutTimeExcds(17)icmpOutParmProbs(18)icmpOutSrcQuenchs(19)icmpOutRedirects(20)icmpOutEchos(21)icmpOutEchoReps(22)icmpOutTimestamps(23)icmpOutTimestampReps(24)icmpOutAddrMasks(25)icmpOutAddrMaskReps(26)

icmp(5)

ipAdEntAddr(1)ipAdEntIfIndex(2)ipAdEntNetMask(3)ipAdEntBcastAddr(4)ipAdEntReasmMaxSize(5)

ipAddrE

ntry(1)

ipForwarding(1)ipDefaultTTL(2)ipInReceives(3)ipInHdrErrors(4)ipInAddrErrors(5)ipForwDatagrams(6)ipInUnknownProtos(7)ipInDiscards(8)ipInDelivers(9)ipOutRequests(10)ipOutDiscards(11)ipOutNoRoutes(12)ipReasmTimeout(13)ipReasmReqds(14)ipReasmOKs(15)ipReasmFails(16)ipFragOKs(17)ipFragFails(18)ipFragCreates(19)ipAddrTahle(20)ipNetToMediaTable(22)ipRoutingDiscards(23)

ip(4)

mib

-2(1.3.6.1.2.1)

slides.tex–

Netw

orksand

Protocols

’2006–

JurgenS

chonwalder

–9/10/2006

–8:18

–p.506

Page 507: Networks and Protocols '2006

Case Diagram of the ip Group

ipInDelivers

ipInUnknownProtos

ipInDiscards

ipReasmOKs

ipReasmFails

ipReasmReqds

ipInAddrErrors

ipInHdrErrors

ipInReceives

ipForwDatagrams

ipOutNoRoutes

ipOutRequests

ipFragOKs

ipOutDiscards

ipFragCreates

ipFragFails

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 507

Page 508: Networks and Protocols '2006

IPF

orwarding

MIB

Module

(RF

C2096)

ipC

idrR

ou

teEn

try(1)

ipC

idrR

ou

teTab

le(4)

ipF

orw

ard(24)

ip(4)

mib

-2(1.3.6.1.2.1)

ipCidrRouteMask(2)ipCidrRouteTos(3)ipCidrRouteNextHop(4)ipCidrRouteIfIndex(5)ipCidrRouteType(6)ipCidrRouteProto(7)ipCidrRouteAge(8)ipCidrRouteInfo(9)ipCidrRouteNextHopAS(10)ipCidrRouteMetric1(11)ipCidrRouteMetric2(12)ipCidrRouteMetric3(13)ipCidrRouteMetric4(14)ipCidrRouteMetric5(15)ipCidrRouteStatus(16)

ipCidrRouteDest(1)

ipCidrRouteNumber(3)

=⇒

The

IPlayer

MIB

sw

illsoonbe

replacedby

MIB

sthatsupport

IPv4

andIP

v6.

slides.tex–

Netw

orksand

Protocols

’2006–

JurgenS

chonwalder

–9/10/2006

–8:18

–p.508

Page 509: Networks and Protocols '2006

References[1] K. McCloghrie and F. Kastenholz. The Interfaces Group MIB. RFC 2863, Cisco Systems, Argon

Networks, June 2000.

[2] K. McCloghrie and G. Hanson. The Inverted Stack Table Extension to the Interfaces Group MIB.RFC 2864, Cisco Systems, ADC Telecommunications, June 2000.

[3] J. D. Case and C. Patridge. Case diagrams: A first step to diagrammed management informationbases. Computer Communication Review, 19(1), January 1989.

[4] K. McCloghrie and A. Bierman. Entity MIB (Version 2). RFC 2737, Cisco Systems, December1999.

[5] K. McCloghrie. SNMPv2 Management Information Base for the Internet Protocol using SMIv2.RFC 2011, Cisco Systems, November 1996.

[6] F. Baker. IP Forwarding Table MIB. RFC 2096, Cisco Systems, January 1997.

[7] J. Schönwälder and A. Müller. Reverse Engineering Internet MIBs. In Proc. 7th IFIP/IEEEInternational Symposium on Integrated Network Management, Seattle, May 2001.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 509

Page 510: Networks and Protocols '2006

SNMP Version 3

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 510

Page 511: Networks and Protocols '2006

SNMP Version 3

→ Architectural Concepts

→ Protocol Operations

→ Message Format

→ Authentication and Privacy

→ Authorization and Access Control

→ Remote Configuration

→ Status and Limitations

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 511

Page 512: Networks and Protocols '2006

Architectural Concepts (RFC 3411)

DispatcherSubsystemProcessingMessage

Subsystem

Security

SubsystemControlAccess

SNMP Engine (identified by snmpEngineID)

ResponderCommand Notification

OriginatorNotificationReceiver Forwarder

ProxyGeneratorCommand

SNMP Applications

SNMP Entity

• Fine grained SNMP applications instead of coarse grainedagents and managers.

• Exactly on engine per SNMP entity and exactly onedispatcher per SNMP engine.

• Every abstract subsystem may have of one or more concretemodels.

• Modularization enables incremental enhancements.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 512

Page 513: Networks and Protocols '2006

SNMP Contexts

• An context is a collection of management informationaccessible by an SNMP entity.◦ SNMP entities may have access to multiple contexts.◦ Identical management information may exist in more than

one context.• Within a management domain, a managed object is uniquely

identified by:1. the identification of the engine within the SNMP entity

(e.g., “800007e580e16e1566696f7440”)2. the context name within the SNMP entity (e.g., “board1”)3. the managed object type (e.g., “IF-MIB.ifDescr”)4. the instance identifier (e.g., “1”)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 513

Page 514: Networks and Protocols '2006

Manager and Agent in the SNMP Architecture

Mappings

Transport

Dispatcher

Message

Dispatcher

PDU

other MP

v3MP

v2cMP

v1MP

Subsystem

Message Processing

Security Model

Other

Security Model

User-based

Security Model

Community

Security Subsystem

Originator

NotificationCommand

Responder

Proxy

ForwarderAccess Control

View-based

Access Control Subsystem

MIB Instrumentation

UDP IPX

Command

Generator

Notification

Receiver

Notification

Originator

Message Processing

Subsystem

v2cMP

v3MP

v1MP

Security Subsystem

Security Model

Security Model

Community

Other

Security Model Transport

Dispatcher

Message

Dispatcher

PDU

other MP

Mappings

UDP IPX

User-based

Traditional Agent

Traditional Manager

Communication Network

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 514

Page 515: Networks and Protocols '2006

SNMPv3/USM Textual Conventions

• SnmpEngineID◦ Unique identification of an SNMP engine within a

management domain.• SnmpSecurityModel

◦ Identification of a specific security model.• SnmpMessageProcessingModel

◦ Identification of a specific message processing model.◦ The message processing model is encoded in themsgVersion .

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 515

Page 516: Networks and Protocols '2006

SNMPv3/USM Textual Conventions

• SnmpSecurityLevel◦ The security level of a given message (noAuthNoPriv ,authNoPriv , authPriv ).

◦ The security level is encoded in the msgFlags .• KeyChange

◦ Defines a cryptographic algorithm to changeauthentication or encryption keys.

◦ Does not require encryption.◦ An attacker can “drill forward” once a key is broken.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 516

Page 517: Networks and Protocols '2006

Protocol Operations (RFC 3416)

GeneratorCommand

GeneratorCommand

ResponderCommand Notification

Originator

NotificationOriginator

NotificationReceiver

NotificationReceiver

ResponderCommand

ResponderCommand

ResponderCommand

GeneratorCommand

GeneratorCommand

Get

Inform

Response Response

GetNext

Trap

Response Response Response

GetBulkSet

• An additional Report protocol operation is used internally forerror notifications, engine discovery and clocksynchronization.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 517

Page 518: Networks and Protocols '2006

Lexicographic Ordering

• Given are two vectors of natural numbers x = (x1, . . . , xn)and y = (y1, . . . , ym) with n ≤ m. We say that x islexicographically less than y if and only if one of the followingconditions is true:

(a) xj = yj for 1 ≤ j ≤ k and xk < yk with k ≤ n and k ≤ m

(b) xj = yj for 1 ≤ j ≤ n and n < m

• All OIDs identifying instances can be lexicographicallyordered.

• The SNMP protocol operates only on the lexicographicallyordered list of MIB instances and not on the OID registrationtree or on conceptual tables.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 518

Page 519: Networks and Protocols '2006

Simple Forwarding Table Example

(1)

address (1)

uptime (2)

fwdTable (3)

fwdEntry (1)

fwdDest (2) fwdNext (3)fwdIndex (1)

1

3

5

6

2

4

info (2)

2

3

2

2

3

3

2

3

5

7

8

9

1

2

3

5

7

8

9

name (1)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 519

Page 520: Networks and Protocols '2006

Lexicographic Ordering Example

• Lexicographic ordered list of MIB instances:

OID name value

1.1.0 address.0 10.1.2.1

1.2.1.0 name.0 "ACME Router"

1.2.2.0 uptime.0 54321

1.3.1.1.1 fwdIndex.1 1

1.3.1.1.2 fwdIndex.2 2

1.3.1.1.3 fwdIndex.3 3

1.3.1.1.4 fwdIndex.4 4

1.3.1.1.5 fwdIndex.5 5

1.3.1.1.6 fwdIndex.6 6

1.3.1.2.1 fwdDest.1 2

1.3.1.2.2 fwdDest.2 3

OID name value

1.3.1.2.3 fwdDest.3 5

1.3.1.2.4 fwdDest.4 7

1.3.1.2.5 fwdDest.5 8

1.3.1.2.6 fwdDest.6 9

1.3.1.3.1 fwdNext.1 2

1.3.1.3.2 fwdNext.2 3

1.3.1.3.3 fwdNext.3 2

1.3.1.3.4 fwdNext.4 2

1.3.1.3.5 fwdNext.5 3

1.3.1.3.6 fwdNext.6 3

• Conceptual table instances are ordered column by columnnot row by row.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 520

Page 521: Networks and Protocols '2006

PDU Processing Errors

• An error response signals the complete failure of thecorresponding request.

• An error response contains an error status (numeric errorcode) and an error index (position in the variable list wherethe error occured).

• Error responses contain no useful management information.• There is only a single error status and error index even if

there are multiple errors.• An error in general implies that none of the actions has taken

place during a write operation (as if simultaneous writes).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 521

Page 522: Networks and Protocols '2006

PDU Error Codes (RFC 3416)

SNMPv3 Error Code Get/GetNext/GetBulk Set Trap/Inform SNMPv1 Error Code

noError(0) X X X noError(0)

tooBig(1) X X X tooBig(1)

noSuchName(2) noSuchName(2)

badValue(3) badValue(3)

readOnly(4) readOnly(4)

genErr(5) X X X genErr(5)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 522

Page 523: Networks and Protocols '2006

PDU Error Codes (RFC 3416)

SNMPv3 Error Code Get/GetNext/GetBulk Set Trap/Inform SNMPv1 Error Code

noAccess(6) X noSuchName(2)

wrongType(7) X badValue(3)

wrongLength(8) X badValue(3)

wrongEncoding(9) X badValue(3)

wrongValue(10) X badValue(3)

noCreation(11) X noSuchName(2)

inconsistentValue(12) X badValue(3)

resourceUnavailable(13) X genErr(5)

commitFailed(14) X genErr(5)

undoFailed(15) X genErr(5)

authorizationError(16) X X X noSuchName(2)

notWritable(17) X noSuchName(2)

inconsistentName(18) X noSuchName(2)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 523

Page 524: Networks and Protocols '2006

PDU Processing Exceptions

• A response can contain per variable binding exceptions.• One or more exceptions in a response are not considered to

be an error condition of the corresponding request.• A response with exceptions still contains useful management

information.• Applications receiving response messages

◦ must check the error code,◦ must detect exceptions, and◦ they must deal with them gracefully.

• Not all applications get this right...

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 524

Page 525: Networks and Protocols '2006

PDU Exceptions (RFC 3416)

SNMPv3 Exception Get GetNext/GetBulk SNMPv1 Error Status

noSuchObject X noSuchName(2)

noSuchInstance X noSuchName(2)

endOfMibView X noSuchName(2)

• The noSuchInstance exceptions indicates that a particularinstances does not exist, but that other instances of theobject type can exist.

• The noSuchObject exception indicates that a certain objecttype is not available.

• This distinctions allows smart applications to adapt to thecapabilities of a particular command responderimplementation.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 525

Page 526: Networks and Protocols '2006

Get Operation (RFC 3416)

GeneratorCommand

ResponderCommand

Get

Response

• The Get operation is used to read one or more MIBvariables.

• Possible error codes: tooBig , genErr• Possible exceptions: noSuchObject , noSuchInstance

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 526

Page 527: Networks and Protocols '2006

Example Get Operations

1. Get(1.1.0)

Response(noError@0, 1.1.0=10.1.2.1)

2. Get(1.2.0)

Response(noError@0, 1.2.0=noSuchObject)

3. Get(1.1.1)

Response(noError@0, 1.1.1=noSuchInstance)

4. Get(1.1.0, 1.2.2.0)

Response(noError@0, 1.1.0=10.1.2.1, 1.2.2.0=54321)

5. Get(1.3.1.1.4, 1.3.1.3.4)

Response(noError@0, 1.3.1.1.4=4, 1.3.1.3.4=2)

6. Get(1.1.0, 1.1.1)

Response(noError@0, 1.1.0=10.1.2.1, 1.1.1=noSuchInsta nce)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 527

Page 528: Networks and Protocols '2006

GetNext Operation (RFC 3416)

ResponderCommand

GeneratorCommand

Response

GetNext

• The GetNext operation allows to retrieve the value of thenext existing MIB instances in lexicographic order.

• Successive GetNext operations can be used to walk theMIB instances without prior knowledge about the MIBstructure.

• Possible error codes: tooBig , genErr• Possible exceptions: endOfMibView

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 528

Page 529: Networks and Protocols '2006

Example GetNext Operations

1. GetNext(1.1.0)

Response(noError@0, 1.2.1.0="ACME Router")

2. GetNext(1.2.1.0)

Response(noError@0, 1.2.2.0=54321)

3. GetNext(1.1)

Response(noError@0, 1.1.0=10.1.2.1)

4. GetNext(1.3.1.1.1)

Response(noError@0, 1.3.1.1.2=2)

5. GetNext(1.3.1.1.6)

Response(noError@0, 1.3.1.2.1=2)

6. GetNext(1.3.1.1.1, 1.3.1.2.1, 1.3.1.3.1)

Response(noError@0, 1.3.1.1.2=2, 1.3.1.2.2=3, 1.3.1.3. 2=3)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 529

Page 530: Networks and Protocols '2006

GetBulk Operation (RFC 3416)

ResponderCommand

GeneratorCommand

Response

GetBulk

• The GetBulk operation is a generalization of the GetNextoperation where the agent performs a series of GetNextoperations internally.

• The GetBulk operation like all the other protocol operationsoperates only on the lexicographically ordered list of MIBinstances and does therefore not respect conceptual tableboundaries.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 530

Page 531: Networks and Protocols '2006

GetBulk Operation (RFC 3416)

• GetBulk processing details:◦ The first N elements (non-repeaters ) of the varbind list

will be processed similar to the GetNext operation.◦ The remaining R elements of the varbind list are

repeatedly processed similar to the GetNext operation.◦ The parameter M (max-repetitions ) defines the upper

bound of repetitions.• The manager usually does not know how to choose a value

for max-repetitions .• If max-repetitions is too small, the potential gain will be

small. If it is too large, there might be a costly overshoot.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 531

Page 532: Networks and Protocols '2006

Example GetBulk Operations

1. GetBulk(non-repeaters=0, max-repetitions=4, 1.1)

Response(noError@0, 1.1.0=10.1.2.1, 1.2.1.0="ACME Rout er",

1.2.2.0=54321, 1.3.1.1.1=1)

2. GetBulk(non-repeaters=1, max-repetitions=2, 1.2.2,

1.3.1.1, 1.3.1.2, 1.3.1.3)

Response(noError@0, 1.2.2.0=54321,

1.3.1.1.1=1, 1.3.1.2.1=2, 1.3.1.3.1=2,

1.3.1.1.2=2, 1.3.1.2.2=3, 1.3.1.3.2=3)

• The non-repeaters are typically used to retrieve adiscontinuity indicating scalars, such as sysUpTime.0 .

• Any ideas for a better GetBulk operation?

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 532

Page 533: Networks and Protocols '2006

Set Operation (RFC 3416)

GeneratorCommand

ResponderCommand

Response

Set

• The Set operation allows to modify a set of MIB instances.The operation is atomic (either all instances are modified ornone).

• Possible error codes: wrongValue , wrongEncoding ,wrongType , wrongLength , inconsistentValue ,noAccess , notWritable , noCreation ,inconsistentName , resourceUnavailable ,commitFailed , undoFailed

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 533

Page 534: Networks and Protocols '2006

Example Set Operations

1. Set(1.2.1.0="Moo Router")

Response(noError@0, 1.2.1.0="Moo Router")

2. Set(1.1.0="foo.bar.com")

Response(badValue@1, 1.1.0="foo.bar.com")

3. Set(1.1.1=10.2.3.4)

Response(noSuchName@1, 1.1.1=10.2.3.4)

4. Set(1.2.1.0="Moo Router", 1.1.0="foo.bar.com")

Response(badValue@2, 1.2.1.0="Moo Router", 1.1.0="foo. bar.com")

5. Set(1.3.1.1.7=7, 1.3.1.2.7=2, 1.3.1.3.7=3)

Response(noError@0, 1.3.1.1.7=7, 1.3.1.2.7=2, 1.3.1.3. 7=3)

• The error codes authorizationError and readOnly arenot used.

• No support for object type specific error codes.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 534

Page 535: Networks and Protocols '2006

Trap Operation (RFC 3416)

NotificationOriginator

NotificationReceiver

Trap

• The Trap operation is used to notify a manager of theoccurance of an event.

• The Trap operation is unconfirmed: The sending agent doesnot know whether the trap was received and processed by amanager.

• All trap specific information in encoded in the varbind list(sysUpTime , snmpTrapOID , snmpTrapEnterprise ).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 535

Page 536: Networks and Protocols '2006

Inform Operation (RFC 3416)

NotificationOriginator

NotificationReceiver

Inform

Response

• The Inform operation is a confirmed trap.• The contents of the varbind list of an Inform operation is

similar to that of a Trap operation.• The reception of an Inform operation is confirmed by a

response message from the notification receiver.• Confirmation indicates that the notification was delivered, not

that the notification was understood.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 536

Page 537: Networks and Protocols '2006

Message Format (RFC 3412, RFC 3414)

msgVersion

msgID

msgMaxSize

msgFlags

msgSecurityModel

msgAuthoritativeEngineID

msgAuthoritativeEngineBoots

msgAuthoritativeEngineTime

msgUserName

msgAuthenticationParameters

msgPrivacyParameters

contextEngineID

contextName

request-id

error-status / non-repeaters

error-index / max-repetitions

variable-bindings

(SNMPv3)

messageheader

parameterssecurity

(USM)

selector(scope)

context

operationprotocol

(PDU)

scop

e of

enc

rypt

ionsc

ope

of a

uthe

ntic

atio

n

• msgVersion identifies themessage processing model.

• msgSecurityModelidentifies the securitymodel.

• contextEngineID andcontextName determinethe context.

• protocol operation type (andversion) is determined bythe tag of the PDU

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 537

Page 538: Networks and Protocols '2006

Classes of Protocol Operations (RFC 3411)

• The processing of a message depends on the class of theembedded protocol operation:

Class Description

Read PDUs that retrieve management information.

Write PDUs which attempt to modify management information.

Response PDUs which are sent in response to a request.

Notification PDUs which transmit event notifications.

Internal PDUs exchanged internally between SNMP engines.

Confirmed PDUs which cause the receiver to send a response.

Unconfirmed PDUs which are not acknowledged.

• PDU classes support the introduction of new protocoloperations without changes the core specifications.

• However, no indication of the set of protocol operationssupported by an SNMP engine implementation.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 538

Page 539: Networks and Protocols '2006

Encoding of SNMPv3/USM Messages

lentag

0x02 - integer

msgID lentag

0x02 - integer

msgMaxSize lentag

0x04 - octet string

msgFlags lentag msgSecurityModel

0x02 - integer

tag len

0x30 - sequence

SNMPv3Message

lentag

0x02 - integer

msgVersion lentag

0x04 - octet string

msgSecurityParameters lentag

0x30 or 0x04 - sequence or octet string

msgDatalentag

0x30 - sequence

msgGlobalData

lentag

0x30 - sequence

UsmSecurityParameters

lentag

0x04 - octet string

msgAuthEngineID lentag

0x02 - integer

msgAuthEngBoots lentag

0x02 - integer

msgAuthEngTime lentag

0x04 - octet string

msgUserName lentag

0x04 - octet string

msgPrivParamlentag

0x04 - octet string

msgAuthParam

lentag

0x04 - octet string

contextEngineID lentag

0x04 - octet string

contextName lentag

depends on PDU type

PDU

lentag

0x30 - sequence

variable-bindingslentag

0x02 - integer

error-index / max-repetitionstag len error-status / non-repeaters

0x02 - integer

lentag

0x02 - integer

request-id

lentag

0x30 - sequence

VarBindlentag

0x30 - sequence

VarBind

lentag

0x08 - object identifier

name lentag

depends on type of value

value / exceptionlentag

0x08 - object identifier

name lentag

depends on type of value

value / exception

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 539

Page 540: Networks and Protocols '2006

Security Issues

• The following questions must be answered in order to decidewhether an operation should be performed or not:1. Is the message specifying an operation authentic?2. Who requested the operation to be performed?3. What objects are accessed in the operation?4. What are the rights of the requester with regard to the

objects of the operation?• 1 and 2 are answered by message security mechanisms

(authentication and privacy).• 3 and 4 are answered by authorization mechanisms (access

control).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 540

Page 541: Networks and Protocols '2006

Authentication and Privacy (RFC 3414)

• Protection against the following threads:1. Modification of Information

(Unauthorized modification of in-transit SNMP messages.)2. Masquerade

(Unauthorized users attempting to use the identity ofauthorized users.)

3. Disclosure(Protection against eavesdropping on the exchangesbetween SNMP entities.)

4. Message Stream Modification(Re-ordered, delayed or replayed messages to effectunauthorized operations.)

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 541

Page 542: Networks and Protocols '2006

USM Security Services (RFC 3414)

• Data Integrity◦ Data has not been altered or destroyed in an

unauthorized manner.◦ Data sequences have not been altered to an extent

greater than can occur non-maliciously.• Data Origin Authentication

◦ The claimed identity of the user on whose behalf receiveddata was originated is corroborated.

• Data Confidentiality◦ Information is not made available or disclosed to

unauthorized individuals, entities, or processes.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 542

Page 543: Networks and Protocols '2006

USM Security Services (RFC 3414)

• Message Timeliness and Limited Replay Protection◦ A message whose generation time is outside of a time

window is not accepted.◦ Message reordering is not dealt with and can occur in

normal conditions too.

• No protection against Denial of Service attacks◦ Too hard of a problem to solve.

• No protection against Traffic Analysis attacks◦ Many management traffic patterns are predictable.◦ Hiding periodic management traffic would be extremly

costly.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 543

Page 544: Networks and Protocols '2006

Data Integrity and Data Origin Authentication

Sender Receiver

Key Data Key Data

MAC MAC

User User

Hash-Function

Data MACMAC Data

Hash-Function

= ?

• Cryptographic strong oneway hash functions generatemessage authentication codes (MACs).

• The MAC ensures integrity, the symmetric key provides forauthentication.

• USM currently uses HMAC-MD5-96 or HMAC-SHA-96.• Other hash functions may be added in the future.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 544

Page 545: Networks and Protocols '2006

Data Confidentiality

Sender Receiver

Key Key Data

DES (CBC) DES (CBC)

UserUser Encrypted DataEncrypted Data

Data

• Optional encryption of the ScopedPDU using symmetric butlocalized keys.

• USM currently uses CBC-DES.• Other encryption functions may be added in the future.• Encryption is CPU expensive — use only when needed.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 545

Page 546: Networks and Protocols '2006

Message Timeliness and Replay Protection

Authoritative Engine Nonauthoritative Engine

Time

Authoritative Clock

EngineID DataDataTimestampEngineID DataDataTimestamp

Boots

Time Window

Boots latestRecvTime

LifetimeTime

valid ?

• A non-authoritative engine maintains a notion of the time atthe authoritative engine.

• A non-authoritative engine keeps track when the lastauthentic message was received from a given engine.

• A message is accepted and considered “fresh” if it falls withina time window.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 546

Page 547: Networks and Protocols '2006

Generating Keys from Passwords

• Algorithmic transformation of a human readable passwordinto a cryptographic key:◦ Produce a string S of length 220 = 1048576 bytes by

repeating the password as many times as necessary.◦ Compute the users key KU using either KU = MD5(S) or

KU = SHA(S).• Slows down naive brute force password attacks.• No serious barrier for an attacker with a transformed

dictionary.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 547

Page 548: Networks and Protocols '2006

Localized Keys

• Algorithmic transformation of the users key KU and anengine identification E into a localized key:◦ For a given engine E, compute either

KUE = MD5(KU , E,KU ) orKUE = SHA(KU , E,KU ).

• Advantage: A compromised key does not give access toother SNMP engines.

• Very important in environments where devices can easily bestolen or accessed physically by attackers.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 548

Page 549: Networks and Protocols '2006

Key Changes

• Key change procedure (initiator):1. Generate a random value r from a random number

generator.2. Compute d = MD5(Kold, r) or d = SHA(Kold, r).3. Compute δ = d ⊕ Knew and send (δ, r).

• Key change procedure (receiver):1. Compute d = MD5(Kold, r) or d = SHA(Kold, r).2. Compute Knew = d ⊕ δ.

• The receiver computes the correct new key sinced ⊕ δ = d ⊕ (d ⊕ Knew) = Knew.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 549

Page 550: Networks and Protocols '2006

Key Change Properties

• Key changes must be possible without encryption sinceencryption is optional.

• An attacker who is able to catch all key updates can calculatethe current keys once an old key has been broken.

• Attackers thus get an unlimited amount of time to break keysif they can catch all key change requests.

⇒ Use encryption for key changes if at all possible!

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 550

Page 551: Networks and Protocols '2006

Authoritative Engine

• Either the sender or the receiver of a message is designatedthe authoritative engine.

• The receiver is authoritative if the message contains aconfirmed class PDU.

• The sender is authoritative if the message contains anunconfirmed class PDU.

• The determination whether a message is recent is maderelative to the authoritative engine.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 551

Page 552: Networks and Protocols '2006

Timeliness Checks (Authoritative Receiver)

• A message is outside the time window if any of the followingholds true:1. snmpEngineBoots = 231 − 1

2. msgAuthoritativeEngineBoots 6=snmpEngineBoots

3. abs(msgAuthoritativeEngineTime −snmpEngineTime ) > 150 seconds

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 552

Page 553: Networks and Protocols '2006

Timeliness Checks (Non-authoritative Receiver)

• A message is outside the time window if any of the followingis true:1. snmpEngineBoots = 231 − 1

2. msgAuthoritativeEngineBoots <snmpEngineBoots

3. msgAuthoritativeEngineBoots =snmpEngineBoots andmsgAuthoritativeEngineTime < snmpEngineTime−150

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 553

Page 554: Networks and Protocols '2006

Clock Synchronization

• For each remote authoritative SNMP engine, an SNMPengine maintains:snmpEngineBoots , snmpEngineTime andlatestReceivedEngineTime

• Time synchronization only occurs if the message isauthentic.

• An update occurs, if at least one of the following conditions istrue:1. msgAuthoritativeEngineBoots >snmpEngineBoots

2. msgAuthoritativeEngineBoots =snmpEngineBoots andmsgAuthoritativeEngineTime >latestReceivedEngineTime

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 554

Page 555: Networks and Protocols '2006

Discovery and Initial Synchronization

• The engine identification is needed to compute localizedkeys and to keep clock information for authoritative engines.

• An SNMP engine can learn the engine identification bysending a noAuthNoPriv request with a zero-lengthmsgAuthoritativeEngineID .

• The receiver returns a Report PDU with the realmsgAuthoritativeEngineID .

• Similarly, (initial) clock synchronization happens by sendingan authentic request and receiving a Report PDU with theauthoritative time.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 555

Page 556: Networks and Protocols '2006

USM MIB (RFC 3414)

• The usmUserTable maps USM user names tosecurityName s.

• New entries may be created by cloning existing entries(together with their keys).

• The usmUserAuthKeyChange andusmUserPrivKeyChange objects may be used by thesecurity administrator to change the user’s keys.

• The usmUserOwnAuthKeyChange andusmUserOwnPrivKeyChange objects may be used by theuser to change his keys.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 556

Page 557: Networks and Protocols '2006

Authorization and Access Control (RFC 3415)

object instance

object type

viewType

securityLevel

securityModel

contextName

securityName

securityModel

who

where

how

why

what

which

groupName

viewName

variableName

yes/no

• Three different securityLevel s: noAuthNoPriv ,authNoPriv , authPriv

• A securityName is a security model independent name fora principal.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 557

Page 558: Networks and Protocols '2006

View-based Access Control (RFC 3415)

����

����

����

���� ��������

��

������

��

��

��

��

��

������

��

����

���� ����

����

��������

��������

����

1.1.2.1.*.1

1.2.1.2.*

1

1

1

1 2 3

1 2 3

1 2 1 2 1 2

1 2 1 2 1 2

1

1

2

2

• A view subtree is a set of managed object instances with acommon OID prefix.

• A view tree family is the combination of an OID prefix with abit mask (wildcarding of OID prefix components).

• A view is an ordered set of view tree families.• Access control rights are defined by a read view, write view

or notify view.slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 558

Page 559: Networks and Protocols '2006

View-based Access Control MIB (RFC 3415)

«smi mib class»vacmSecurityToGroupEntry

-vacmSecurityModel: SnmpSecurityModel {index}-vacmSecurityName: SnmpAdminString {index}+vacmGroupName: SnmpAdminString+vacmSecurityToGroupStorageType: StorageType+vacmSecurityToGroupStatus: RowStatus

«smi mib class»vacmContextEntry

+vacmContextName: SnmpAdminString {index}

«smi mib class»vacmAccessEntry

+vacmGroupName: SnmpAdminString {index}-vacmAccessContextPrefix: SnmpAdminString {index}-vacmAccessSecurityModel: SnmpSecurityModel {index}-vacmAccessSecurityLevel: SnmpSecurityLevel {index}+vacmAccessContextMatch: Enumeration+vacmAccessReadViewName: SnmpAdminString+vacmAccessWriteViewName: SnmpAdminString+vacmAccessNotifyViewName: SnmpAdminString+vacmAccessStorageType: StorageType+vacmAccessStatus: RowStatus

«smi mib class»vacmViewTreeFamilyEntry

+vacmViewSpinLock: TestAndIncr-vacmViewTreeFamilyViewName: SnmpAdminString {index}-vacmViewTreeFamilySubtree: ObjectIdentifier {index}+vacmViewTreeFamilyMask: OctetString+vacmViewTreeFamilyType: Enumeration+vacmViewTreeFamilyStorageType: StorageType+vacmViewTreeFamilyStatus: RowStatus

groupMemberRights

0..*

1

readView

0..*

0..*

writeView

0..*

0..*notifyView

0..*

0..*

• A security name (with a given security level) can not be amember of multiple groups.

• The vacmViewTreeFamilyType can be used to include orexclude a view tree family.

• The context table is kind of degenerated.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 559

Page 560: Networks and Protocols '2006

Remote Configuration (RFC 3413)

«smi mib class»snmpTargetParamsEntry

-snmpTargetParamsName: SnmpAdminString {index}+snmpTargetParamsMPModel: SnmpMessageProcessingModel+snmpTargetParamsSecurityModel: SnmpSecurityModel+snmpTargetParamsSecurityName: SnmpAdminString+snmpTargetParamsSecurityLevel: SnmpSecurityLevel+snmpTargetParamsStorageType: StorageType+snmpTargetParamsRowStatus: RowStatus

«smi mib class»snmpTargetAddrEntry

+snmpTargetSpinLock: TestAndIncr-snmpTargetAddrName: SnmpAdminString {index}+snmpTargetAddrTDomain: TDomain+snmpTargetAddrTAddress: TAddress+snmpTargetAddrTimeout: TimeInterval+snmpTargetAddrRetryCount: Integer32+snmpTargetAddrTagList: SnmpTagList+snmpTargetAddrParams: SnmpAdminString+snmpTargetAddrStorageType: StorageType+snmpTargetAddrRowStatus: RowStatus

usesParameters

0..* 1

«smi mib class»snmpTargetObjects

+snmpUnavailableContexts: Counter32+snmpUnknownContexts: Counter32

«smi mib class»snmpNotifyFilterProfileEntry

-snmpTargetParamsName: SnmpAdminString {index}+snmpNotifyFilterProfileName: SnmpAdminString+snmpNotifyFilterProfileStorType: StorageType+snmpNotifyFilterProfileRowStatus: RowStatus

«smi mib class»snmpNotifyEntry

-snmpNotifyName: SnmpAdminString {index}+snmpNotifyTag: SnmpTagValue+snmpNotifyType: Enumeration+snmpNotifyStorageType: StorageType+snmpNotifyRowStatus: RowStatus

selectsTargets

0..*

0..* «smi mib class»snmpNotifyFilterEntry

+snmpNotifyFilterProfileName: SnmpAdminString {index}-snmpNotifyFilterSubtree: ObjectIdentifier {index}+snmpNotifyFilterMask: OctetString+snmpNotifyFilterType: Enumeration+snmpNotifyFilterStorageType: StorageType+snmpNotifyFilterRowStatus: RowStatus

usesFilters

1 0..*

associatedProfile

1

0..1

«smi mib class»snmpMPDStats

+snmpUnknownSecurityModels: Counter32+snmpInvalidMsgs: Counter32+snmpUnknownPDUHandlers: Counter32

«smi mib class»snmpEngine

+snmpEngineID: SnmpEngineID+snmpEngineBoots: Integer32+snmpEngineTime: Integer32+snmpEngineMaxMessageSize: Integer32

• SNMPv3 defines several MIB modules for remoteconfiguration of SNMP entities.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 560

Page 561: Networks and Protocols '2006

SNMPv3 Status and Limitations

• Many implementations and products are available.• Visit the SNMPv3 Web page for up-to-date information.

<http://www.ibr.cs.tu-bs.de/ietf/snmpv3/>

• Some technology domains (e.g., cable modem industry inthe US) require SNMPv3 support.

• However, general deployment happens much slower thanoriginally expected.

• Manual configuration is an error prone and time consuming.• Lack of integration in deployed AAA systems.• Remote configuration and key management requires

nontrivial applications.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 561

Page 562: Networks and Protocols '2006

SNMPv3 Status and Limitations

• Missing extensibility for new base data types (e.g.,Unsigned64).

• Missing extensibility for new protocol operations (e.g.,GetRange ).

• Limited flexibility in VACM grouping rules.• Asymmetries between notification filtering and VACM

filtering.• Strength of USM security (DES versus AES, key change

procedure).• Initial key assignment problematic (no standardized

Diffie-Helman exchange, no integration with other keymanagement systems).

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 562

Page 563: Networks and Protocols '2006

References[1] J. Case, R. Mundy, D. Partain, and B. Stewart. Introduction and Applicability Statements for

Internet Standard Management Framework. RFC 3410, SNMP Research, Network AssociatesLaboratories, Ericsson, December 2002.

[2] W. Stallings. SNMP, SNMPv2, SNMPv3, and RMON 1 and 2. Addison-Wesley, 3 edition, 1999.

[3] D. Zeltserman. A Practical Guide to SNMPv3 and Network Management. Prentice Hall, 1999.

[4] U. Blumenthal and B. Wijnen. Security Features of SNMPv3. Simple Times, 5(1), December1997.

[5] D. Black, K. McCloghrie, and J. Schönwälder. Uniform Resource Identifier (URI) Scheme for theSimple Network Management Protocol (SNMP). RFC 4088, EMC Corporation, Cisco Systems,International University Bremen, June 2005.

slides.tex – Networks and Protocols ’2006 – Jurgen Schonwalder – 9/10/2006 – 8:18 – p. 563