William Stallings Data and Computer Communications


Data and Computer


Internet Protocols

Network Architecture Features


Packet size

Access mechanism


Error recovery

Flow control


User access control

Connection based or connectionless

Connectionless Internetworking




No unnecessary overhead


Not guaranteed delivery

Not guaranteed order of delivery

Packets can take different routes

Reliability is responsibility of next layer up

(e.g. TCP)

IP Operation

Go to Router X

MAC address for Router X

Encapsulated with LAN protocol

Encapsulated with X.25 protocol


Design Issues


Datagram lifetime

Fragmentation and re-assembly

Error control

Flow control


End systems and routers maintain routing tables

Indicate next router to which datagram should be sent


May contain alternative routes


Flexible response to congestion and errors

Source routing

Source specifies route as sequential list of routers to be followed

Datagram Lifetime

Datagrams could loop indefinitely

Consumes resources

Transport protocol may need upper bound on datagram life

Datagram marked with lifetime

Time To Live field in IP

Once lifetime expires, datagram discarded (not forwarded)

Hop count

Decrement time to live on passing through a each router

Time count

Need to know how long since last router

Fragmentation and


Different packet sizes

When to re-assemble

At destination

Results in packets getting smaller as data traverses internet

Intermediate re-assembly

Need large buffers at routers

Buffers may fill with fragments

All fragments must go through same router

 Inhibits dynamic routing

IP Fragmentation (1)

IP re-assembles at destination only

Uses fields in header

Data Unit Identifier (ID)

Identifies end system originated datagram

 Source and destination address

 Protocol layer generating data (e.g. TCP)

 Identification supplied by that layer

Data length

Length of user data in octets

IP Fragmentation (2)


Position of fragment of user data in original datagram

In multiples of 64 bits (8 octets)

More flag

Indicates that this is not the last fragment

Fragmentation Example

Application data

IP header is the same as origin

TCP header is not duplicated –

More is the same as original

Internet Protocol (IP)

Part of TCP/IP

Used by the Internet

Specifies interface with higher layer

 e.g. TCP

Specifies protocol format and mechanisms


 addresses are 32 bits wide

Its header is 20 bytes at minimum

Uses doted-decimal notation (e.g.


Provides larges address domain; addresses are 128 bits wide

Multiple separate headers are supported

Handles audio and video; providing high quality paths

Supports unicast, multicast, anycast

Dealing with Failure

Re-assembly may fail if some fragments get lost

Requires buffer

Need to detect failure – but how?

Re-assembly time out

Assigned to first fragment to arrive

If timeout expires before all fragments arrive, discard partial data

Use packet lifetime (time to live in IP)

If time to live runs out, kill partial data

Parameters (1)








Source address

Destination address


Recipient e.g. TCP

Type of Service

Specify treatment of data unit during transmission through networks

0 - 3


4 - 7

Header length


Time to Live

8 - 15

Type of Service


Source Address

Destination Address

Options + padding


Source, destination address and user protocol

Uniquely identifies PDU

Needed for re-assembly and error reporting

Send only

16 - 18 19 - 31

Total Length

Flags Fragment Offset

Header Checksum

192 Data

IP Packet Format - TTL

TTL (time-to-live) refers to the number of router hops the IP packet is allowed before it must be discarded.

Each router that receives a packet subtracts one from the count in the TTL field.

When the count reaches zero, the router detecting it discards the packet and sends an Internet Control

Message Protocol (ICMP) message back to the originating host

IP Header

The IP datagram contains data and IP address

The IP datagram is encapsulated in a frame with physical address

The header changes as the frame goes from one network domain to the next

IP Datagram







Encapsulated IP Packet in Ethernet Frame

Ethernet Frame Carrying IP Packet

MAC and


IP address

Encapsulated IP Packet in Ethernet Frame

Ethernet Frame Carrying IP Packet

An Ethernet frame containing IP information has

08 00 in its type field

IP starting with 45 Hex indicates IPv4 with standard length of 20 bytes

IP starting with 4F Hex indicates IPv4 with standard length of 60 bytes

Remember: 2 4 =16; 45= 0100 0101 = One Byte


Protocol Analyzer Display:

00 00 C0 A0 51 24 00 C0 93 21 88 A7

0020 B8 03 2a B4 DD …..

08 00 45 08

0010 00 5A DC 28 00 00 FF 01 88 08 C0 99 B8 01 C0 99


99 is one byte

1001 1001

IP Addressing

Two address types

Physical address (the frame has the physical address)

Embedded in the hardware (NIC, e.g., 00 00 11 00 11 33)

Also called the Media Address Control (MAC) address


IP datagram contains the logical IP address

To transport IP packets both physical and IP addresses must be known

Static address resolution

Dynamic address resolution

How to map physical and IP addresses

Local tables of IP addresses

Centralized directory

Address resolution mechanism

Address resolution mechanisms

ARP (address resolution protocol) – IP  48 bit Ethernet address

RARP (reverse) address resolution protocol are used to convert

MAC to IP address and vice versa

IP Addressing – IPv4

A network address is divided into Netid and Hostid

IP Address classification

( number of hosts per network )


Class A

Class B

Class C

Class D (multicast)

Class E (reserved)

Leading bits







Address (Netid)

7 bit ( 125 ) *

14 bit ( 16,368 )

21 bit ( 2,096,896 )


Address (Hostid)

24 bit ( 16,777,151,750 )

16 bit ( 65,534 )

8 bit ( 254 )

* Some values are reserved!

IP Addressing Classification



Host Address

Multicast Address

Network Address Host Address

Reserved for Internet research





Example of IP Addressing

Q1: Determine the network address for the following IP addresses:

1- (84 = 54 Hex = 0101 0100)

 Netid=

 Class A

 Hostid=

2- (144 = 90 Hex = 1001 0000)

 Netid=

 Class B

 Hostid=

Q2: What type of IP address classification will a large organization with 1000 individual users in 150 dispersed buildings use?  Class B

IP Routing Protocols

Routing packets requires having knowledge about the network

Partial (know your own neighbors)

Full (know the entire network elements)

Retrieving network information (network discovery protocols)

RIP (routing information protocol): routing based on the least number of hops

OSPF (open shortest path first): Routing based on number of hops, link speed, congestion

TCP/IP Stack Protocol


IS used to connect two LANs using similar LAN protocols

Address filter passing on packets to the required network only

OSI layer 2 (Data Link)


Connects two (possibly dissimilar) networks

Uses internet protocol present in each router and end system

OSI Layer 3 (Network)

00 10 00 00

Subnets and

Subnet Masks

Each LAN assigned subnet number

Site looks to rest of internet like single network

Host portion of address partitioned into subnet number and host number

Local routers route within subnetted network

Subnet mask indicates which bits are subnet number and which are host number

Allow arbitrary complexity of internetworked

LANs within organization

Insulate overall internet from growth of network numbers and routing complexity

Routing Using Subnets


IP Address of B:

IP Address of A:

IP Address of X:

00 1 | 1 10 01

00 1 | 0 00 01

00 1 | 0 00 00

3-bit subnet

5-bit host

Subnet mask:

11 10 00 00

Note: if we XOR IP Address of B & Subnet Mask

We will have:

00 11 10 01 XOR 00 10 00 00 = 00 01 10 01

Host number is 25  00 01 10 01;

192  1100 0000, hence, Class C network (8-bit host/subnet) !

NetId SubNetId Host

Why Change IP?

Address space exhaustion

Two level addressing (network and host) wastes space

Network addresses used even if not connected to Internet

Growth of networks and the Internet

Extended use of TCP/IP

Single address per host

Requirements for new types of service

IP v6 Header vs. IPV4


IPv5 used for Stream

Protocol- IP-layer protocol that provides end-to-end guaranteed service across a network.


Extended address space

Improved option mechanism

Dynamic address assignment

Multicasting and anycasting

Flow routing

128 bits

128 bits

Internet Addressing

Over half million networks are connected to the


Network numbers are managed by ICNN

(Internet Corporation for Assigned Names and

Numbers) http://www.icann.org/

Delegates part of address assignments to regional authorities

IP addresses are given to ISPs and companies

IP addresses are based on dotted decimal notation:

IP address refer to machine’s own network when it is being booted (This host) broadcast on the LAN

127.x.y.z reserved for loopback testing

More about subnets….

Routers can be connected to multiple LANs

LANS are divided into subnets each identified by a subnet mask: (… 1111 1100 0000 0000)  32-

10=22 to identify the subnet!

Mask: netID + SunnetID or /22 (subnet mask is 22 bit long)

Subnets are not visible outside the network

Example: Assume subnet mask is

Subnet 1:

Subnet 2:

Subnet 3:

000010|00 00000001

000011|00 00000001

Assume a packet’s destination is

 which subnet does it belong to?

Mask: … 1111 11|00 0000 0000

Adrs: … 0000 11|11 0000 0110

Hence: the packet must go to Subnet 3

Classes and subnets…

Classful routing is not very efficient

Having IP address classes creates issues

Addresses can be under utilized (Class A)

Addresses can be over utilized (Class C)

Management of addresses may be difficult

Organizations can grow!

Classless InterDomain Routing (CIDR)

Allocate remaining IP addresses in variable-sized block; no regard to class!

Use 32-bit mask!

Uses a single routing table

Classless Routing - Example

What happens if a packet has an address of


Where does it go?

O: ….1111 0000 0000 0000 AND 0001 0001 0000 0100 

…. 0001 0000 0000 0000 (

How do you represent class B using CIDR?

16-bit NetID + 16-bit HostID  /16

Network Address Translation (NAT)

Addresses are growing! What is the solution?

Use IPV6



Allows using one IP address per company

Internally new nodes can be added!


NAT Operation

IP reserved addresses




Receiving a packet from the



Add IP address

TCP will have the destination port


The port determines which server on the remote (destination) side to process the packet

NAT box:

Using the PORT address in TCP, change the IP address to a designated address (10.0.01)

Sending a packet into the Internet

NAT box:

Changes to

NAT Issues…

Addresses are not unique: many!

NAT controls are the incoming and outgoing packets – reliability!

NAT accesses TCP and IP layers – layers should work independent of one another

NAT only allows TCP/IP or UDP/IP

NAT does not support applications which insert the IP address in the body (FTP or


Internet Control Protocols

IP protocol only deal with the data transfer

We need control protocol to check the network


Internet Control Message

Protocol (ICMP)

ICMP error messages are used by routers and hosts to tell a device that sent a datagram about problems encountered in delivering it

Used to test the network

Messages are encapsulated in the IP packet

Has many message types

Code field is used for subtypes

ARP (address resolution protocol)

Exploits broadcast property of a LAN

Each host on LAN maintains a a table of IP subnetwork addresses

If the address can not be found ARP broadcasts a request

Shouting: Who know about this IP address?

Other hosts listen and reply

The reply includes IP address and MAC

Any interested host can learn about the new information

ARP Example

Assume 1 is sending a message to 2 ( rose@sonoma.edu


Sonoma.edu is the host

Host 1 sends a message to Domain Name System (DNS): what is the IP address for Sonoma.edu? 

What is the MAC address for Use ARP broadcast!

Host 2 respond: it is E2

Host 1 maps IP and MAC; encapsulate the IP message in the Ethernet frame and send it

Cashing can enhance ARP operation

ARP Example

Assume 1 is sending a message to 4 ( rose@sonoma.edu


Sonoma.edu is the host

Host 1 sends a message to Domain Name System (DNS): what is the IP address for Sonoma.edu?  What is the MAC address for ARP cannot pass through the router!

Two choices:

Reconfigure routers to response to ARP (Proxy ARP)

Send the message to the LAN router (E3)  F1  F3  4 – Each router looks are the IP address and passes it to the next node using the routing table


Reverse ARP translates the Ethernet address to

IP address

A diskless machine when it is booking can ask: My MAC is; what is my IP?

RARP broadcasts the question (destination address is all one)

Not passed through the router!

Each LAN needs a RARP server!

Bootstrap protocol uses UDP and forwards over routers

Mapping must be done manually in each router!

Uses one server but harder to implement!

Dynamic Host Configuration Protocol

DHCP allows many and automatic configuration

Replaces BOOTP and RARP

DHCP sends a DISCOVER Packet

What is the IP address for this MAC?

Even when an IP address is assigned, how long is it good for?

Before the IP address is removed find another IP address….called Leasing


This is My MAC; what is my IP address?


This is the destination host name, what it is IP address? DNS Server

This is the IP address, what is your` MAC address? ARP



Tomasi Text Book

Comer Text book