You are on page 1of 31

CS 52 COMPUTER NETWORKS

UNIT III
Circuit switching vs. packet switching / Packet switched networks – IP – ARP – RARP – DHCP –
ICMP – Queueing discipline – Routing algorithms – RIP – OSPF – Subnetting – CIDR – Interdomain
routing – BGP – Ipv6 – Multicasting – Congestion avoidance in network layer

1. CIRCUIT SWITCHING VS. PACKET SWITCHING


• In circuit switching, two communicating stations are connected by a dedicated communication
path which consists of intermediate nodes and links.

• Above figure consist of a simple circuit switch which consists of a 3×3 matrix, capable of
connecting its inlets (a, b, and c) to its outlets (d, e, and f).
• Each crosspoint appears as a circle. A hollow circle means that the crosspoint is off (i.e., the two
crossing wires are not connected).
• A solid circles means that the crosspoint is on (i.e., the crossing wires are connected).
• When the two hosts initiate a connection, the network determines a path through the intermediate
switches and establishes a circuit which is maintained for the duration of the connection. When the
hosts disconnect, the network releases the circuit.

• Circuit switching and packet switching differ in many ways

Item Circuit Switched Packet Switched


Call Setup Required Not Needed
Dedicated Physical Path Yes No
Each Packet Follows the same path Yes No
Packets arrive in order Yes No
Is a switch crash fatal Yes No
Bandwidth available Fixed Dynamic
Time of possible congestion At setup time On every packet
Potentially wated bandwidth Yes No
Store and forward transmission No Yes
Transparency Yes No

1
charging Per minute Per Packet

2. PACKET SWITCHED NETWORKS


2.1. SWITCHING AND FORWARDING
• A switch is a mechanism to interconnect links to form a larger network.
• A switch is a multi-input, multi-output device, which transfers packets from an input to one or
more outputs.
• A switch provides a star topology. A star topology has several attractive properties:
1. Large networks can be built by interconnecting a number of switches.
2. Switches can be connected with each other and to hosts using point-to-point links, which
helps n building networks of large geographic scope.
3. Adding a new host to the network will not degrade the performance of already connected
host to the network.
STAR TOPOLOGY OF A SWITCH

• Switched networks are more scalable than shared-media networks.


• A switch is connected to a set of links and data link protocols run at these links to provide
communication with other links.
• A switch’s primary job is to receive incoming packets on one of its links and to transmit
them on some other link. This function is called as switching or forwarding
• It is the main function of the OSI Architecture’s network layer.
• The switch decides the output port of a packet by the information given in the header.
There are three approaches.
1. Datagram or connectionless approach.
2. Virtual circuit or connection-oriented approach.

2
3. Source routing (less commonly used)
• The end nodes are identified using addresses. The ports can be identified using port
numbers or using the name of the host to which the port leads.
2.2. DATAGRAMS
• Every packet should contain the complete destination address.
• Consider the example network given below
Datagram forwarding: an example network

All the hosts have addresses A, B, C, and so on. To decide how to forward a packet, a switch consults a
forwarding table or routing table.

Forwarding table or routing table

3
Connectionless (datagram) networks have the following characteristics
1. A host can send a packet anywhere at any time, when the packet turns up at a switch it
can be immediately forwarded. Incase of connection-oriented networks, “connection state” must
be established before sending the first data packet.
2. When a host sends a packet, it does not know if the network is capable of delivering it or
if the destination host is up and running.
3. Each packet is forwarded independently of previous packets sent to the same destination.
Thus, two successive packets from host A to host B may follow completely different paths.
4. A switch or link failure does not cause any serious effect on communication if it is
possible to find an alternate route around the failure.
2.3. VIRTUAL CIRCUIT SWITCHING
• A widely used technique for packet switching is virtual circuit (VC). This is also called a
connection-oriented model.
• A virtual connection is set up from the source host to the destination host before sending
any data.
• The process of sending packets from a host to another is in virtual circuit switching is
considered as a two-stage process.
1. connection setup
2. data transfer

4
• Connection setup phase establishes a “connection state” in the switches between the source and
destination hosts.
• The connection state for a single connection consists of an entry in a “VC table”. One entry in
the VC table for a single switch contains
1. a virtual circuit identifier (VCI) that uniquely identifies the connection at this switch and that
will be carried inside the header of the packets
2. an incoming interface on which packets for this VC arrive at the switch
3. an outgoing interface in which packets for this VC leave the switch
4. a different VCI that will be used for outgoing packets
• There may be many virtual connections established in the switch at one time.
The incoming and outgoing VCI values are generally not the same.
• Thus, the VCI is not a global identifier for the connection it has link local scope.
• Whenever a new connection is created, a new VCI is assigned for that
connection on the link. It should be ensured that the newly assigned VCI on a given link is not
currently used by any other existing connection.
• There are two approaches to establishing connection state.
1. A network administrator can configure the state. It this case the virtual
circuit is “permanent” called Permanent Virtual Circuit (PVC). It can be deleted only
by the administrator.
2. A host can send messages into the network to cause the state to be
established. This is referred to as signaling and the virtual circuit created is called
switched virtual circuit (SVC). The host can set up and delete the VC without the
involvement of a network administrator.

5
• If a network administrator wants to manually create a new virtual
connection from host A to host B. First, the administrator needs to identify a path through the
network from A to B. In the example network, there is only one such path, but in general this may
not be the case.
• The administrator then picks a VCI value that is currently unused
on each link for the connection. Virtual circuit table entries
(a) Switch 1

(b) Switch 2

(c) Switch 3

• The “outgoing” VCI value at one switch is the “incoming” VCI


value at the next switch. Once the VC tables have been set up, the data transfer phase can proceed.
A packet is sent into a virtual circuit network

6
• For any packet that it wants to send to host B, A puts the VCI
value of 5 in the header of the packet and sends it to switch 1. Switch 1 receives any such packet on
interface 2, and it uses the combination of the interface and the VCI in the packet header to find the
appropriate VC table entry. This process continues until the packets arrive at host B with the VCI
value of 4 in the packet.
• The above procedure of configuring the VC tables in large
networks is difficult and excessive. Thus, some sort of signalling is used in setting up “permanent”
VCs also.
• In the case of PVCs, signalling is initiated by the network
administrator, while SVCs are set up using signaling initiated by one of the hosts.
• To start the signalling process of a permanent VC, host A sends a
setup message into the network, that is, to switch 1.
• The setup message includes the complete destination address of
host B.
• The setup message move towards B and create the necessary
connection state in every switch.
• The transfer of setup message to B is like transferring a datagram
to B. The main difference is that the VCI value is assigned by the switch.
• Each switch can pick any number as the VCI value, as long as that
number is not currently used by some other connection on that port of that switch.
• Finally, the setup message arrives at host B. Assuming that B is
healthy and willing to accept a connection from host A.
• Host B sends an acknowledgment of the connection setup to switch
3 including its VCI value. The Acknowledgement is send to switch 2, then to switch 1 and finally
reaches host A.

7
• The data transfer phase can now begin and is identical to that used
in the PVC case.
• When host A no longer wants to send data to host B, it tears down
the connection by sending a teardown message to switch 1.
• The switch removes the relevant entry from its table and forwards
the message on to the other switches in the path, which similarly delete the appropriate table entries.
• After breaking down the connection, if host A were to send a
packet with a VCI of 5 to switch 1, the packet would be dropped.
There are several things to note about virtual circuit switching:
1. Since host A has to wait for the connection request to reach the far side of the network
and return before it can send its first data packet, there is delay before sending data.1
2. While the connection request contains the full address for host B, each data packet
contains only a small identifier. Thus, the per-packet overhead caused by the header is reduced
relative to the datagram model.
3. If a switch or a link in a connection fails, the connection is broken and a new one will be
established. The old one need to be torn down to free up table storage space in the switches.
4. The issue of how a switch decides which link to forward the connection request is based
on routing algorithm.
• A packet-switched network that uses the connection-oriented model employs the
following three-part strategy:
1. Buffers are allocated to each virtual circuit when the circuit is initialized.
2. The sliding window protocol is run between each pair of nodes along the virtual circuit.
3. The circuit is rejected by a given node if not enough buffers are available at that node
when the connection request message is processed.
• In doing these three things, each node is ensured of having the buffers it needs to
queue the packets that arrive on that circuit. This basic strategy is usually called hop-by-hop flow
control.
• In the virtual circuit model, each circuit provides a different quality of service
(QoS). The term “quality of service” is some kind of performance-related guarantee.
• The examples of virtual circuit technologies are Frame Relay and asynchronous
transfer mode (ATM).

8
• One application of Frame Relay is the construction of virtual private networks
(VPNs). Frame Relay provides some basic quality of service and congestion-avoidance.

2.4. SOURCE ROUTING


• All the information about network topology that is required to switch a packet across the
network is provided by the source host. There are various ways to implement source routing.
• To assign a number to the output of each switch and to place that number in the header of
the packet. The switching function is when a packet arrives on the input of the switch it should read
the port number in the header and transmit the packet on that output.
• There will be more than one switch in the path between the sending and the receiving
host, the header should contain enough information to pass through all the switch in the path.
• An ordered list of switch ports is placed in the header and the list is rotated so that the
next switch in the path is at the front of the list.
Source routing in a switched network

• In this example, the packet needs to traverse three switches to get from host A to host B.
• At switch 1, it needs to exit on port 1, at the next switch it needs to exit at port 0, and at
the third switch it needs to exit at port 3.
• Thus, the original header when the packet leaves host A contains the list of ports (3, 0, 1),
switch reads the rightmost element of the list.

9
• Each switch rotates the list after it has read its own entry.
• The header entries can be done only if host A has enough details about the topology of
the network. This is not possible in all networks.
• Header size can not be predicted because each header must hold one word of information
for every switch on the path. This implies that headers should be of variable length with no upper
bound
• Rather than to rotate the header, each switch strip of the first element as it uses it. But
rotation has an advantage over stripping, i.e., the destination (host B) gets a copy of the complete
header, which may help it figure out how to get back to Source (host A).
• Another method is to make the header carry a pointer to the current “next port” entry, so
that each switch can just updates the pointer rather than rotating the header, this method is more
efficient to implement.

Three ways to handle headers for source routing

(a) Rotation (b) Stripping (c) Pointer

• In each case, the entry that this switch needs to read is A, and the entry that the next
switch needs to read is B.
• Source routing can be used in both datagram networks and virtual circuit networks.
• Source routing has scaling problem. In a large network, it is very difficult for a host to get
the complete path information to construct correct headers.

3. INTERNET PROTOCOL (IP)

10
• An internetwork is an interconnected collection of networks. The interconnected network may
include technologies like 802.5, Ethernet, or ATM.
• When the interconnection of network is with in an organization such internetwork are some
times called as “internet” with a lowercase i.
• The global internetwork to which a large percentage of networks are connected is called as
“Internet” with a capital I.
• An internetwork is often referred to as a “network of networks” because it is made up of lots of
smaller networks.
• Ethernets, an FDDI ring, and a point-to-point link form a single network. They can be
interconnected to form a large network.
• The nodes that interconnect the networks are called routers. They are also sometimes called
gateways.

A simple internetwork

• The Internet Protocol is the key tool used to build scalable, heterogeneous internetworks.
• It was originally known as the Kahn-Cerf protocol after its inventors.

11
• IP runs on all the nodes (both hosts and routers) in the networks and allows the nodes and
networks to function as a single logical internetwork.
A simple internetwork, showing the protocol layers used to connect H1 to H8 in
the above figure. ETH is the protocol that runs over Ethernet.

3.1. SERVICE MODEL


• Service model defines the host-to-host services provided by the internetwork.
• Host-to-host service can be provided only if the underlying physical networks are capable
of providing the service.
• The IP service model has two parts:
1. An addressing scheme, to identify all hosts in the internetwork
2. A datagram (connectionless) model of data delivery.
• This service model is sometimes called best effort.
3.2. DATAGRAM DELIVERY
• Datagram is a type of packet that is sent in a connectionless manner over a network.
• Every datagram carries enough information to forward the packet to its correct
destination.
• The “best-effort” means that if something goes wrong and the packet gets lost, corrupted,
misdelivered, or fails to reach its intended destination, the network does nothing it made its best
effort.
• Sometimes they can get delivered out of order, and sometimes the same packet can get
delivered more than once. The higher-level protocols or applications that run above IP need to be
aware of all these possible failure modes.
• It does not make any attempt to recover from the failure. This is sometimes called an
unreliable service.

12
• In Reliable service model lot of extra functionality should be implemented into the
routers to recover from deficiencies of the underlying network. Unreliable network service model is
simple to implement.
• The ability of IP to “run over anything” is most important characteristics.
3.3. PACKET FORMAT
• The IP datagram packet consists of a header followed by a number of bytes of data.

• Version: The first field defines the version number of the IP. The current version of IP is
4, and it is sometimes called IPv4 with a binary value of 0100.
• Header Length (HLEN): The HLEN field specifies the length of the header in 32
words. Most of the times the header is 20 bytes long (i.e., 5 words).
• TOS (Type of Service): It specifies how the datagram should be handled. It includes bits
containing priority of the datagram. It also contains bits that specify the level of throughput,
reliability and delay.
• Length: 16 bits length field defines the total length of the datagram including the header.
The maximum size of an IP datagram is 65,535 bytes.
• Identification: This field is used in fragmentation. A datagram, when passing through
different networks may be divided into fragments to match the network frame size. Each fragment is
identified with a sequence number in this field.
• Flags: The bits in flag field also deal with fragmentation.
• Offset: It is a pointer that shows the offset of the data in the original datagram.

13
• TTL (Time to Live): The Time to live field defines the number of hops a datagram can
travel before it is discarded. The source host sets this field to an initial value. Then, as the datagram
travels through the internet, router by router, each router decrements the value by 1. If the value
becomes 0 before reaching the destination, the datagram is discarded. This prevents the packets
moving around the routers back and forth.
• Protocol: The Protocol field is a demultiplexing key that identifies the higher-level
protocol to which this IP packet should be passed.
• Checksum: The Checksum is calculated by considering the entire IP header as a
sequence of 16-bit words, adding them up using ones complement arithmetic, and taking the ones
complement of the result. Thus, if any bit in the header is corrupted in transit, the checksum will not
contain the correct value upon receipt of the packet. Since a corrupted header may contain an error in
the destination address. The packet is discarded.
• Source Address: This is a 4 byte field to identify the source of the datagram.
• Destination Address: This is also a 4 byte field to identify the destination of the
datagram.
• Options: This field gives more functionality to the IP datagram. It carry fields that
control routing, timing, management and alignment.

3.4. FRAGMENTATION AND REASSEMBLY


• Internetwork is a collection of heterogeneous networks and each network technology
supports different packet size. For example, an Ethernet can accept packets up to 1500 bytes long,
while FDDI packets may be 4500 bytes long.
• To deal with the size of the packets the IP datagrams are made small enough to fit inside one
packet on any network technology or provide the packets can be fragmented and reassembled when
they are too big to go over a given network technology.
• Fragmentation and reassembly is the better choice because if we chose small sized packets it
leads to wastage of band width and consumes process resources.
• Each network type has a maximum transmission unit (MTU), which is the largest IP
datagram that it can carry in a frame. When a host sends an IP datagram, MTU of the network to
which the host is directly attached is chosen as the packet size.

14
• Fragmentation occurs in a router when it receives a datagram that it wants to forward over a
network has MTU smaller than the received datagram.
• To be reassembled the fragments at the receiving host the header includes Ident field. IP does
not attempt to recover from missing fragments.
• Consider the following figure and if host H1 wants to send a datagram to host H8.

• Assuming that the MTU is 1500 bytes for the two Ethernets, 4500 bytes for the FDDI
network, and 532 bytes for the point-to-point network, then a 1420-byte datagram (20-byte IP header
plus 1400 bytes of data) sent from H1 makes it across the first Ethernet and the FDDI network
without fragmentation but must be fragmented into three datagrams at router R2. These three
fragments are then forwarded by router R3 across the second Ethernet to the destination host.
IP datagrams traversing the sequence of physical networks

• Each fragment is itself a self-contained IP datagram that is transmitted over a sequence of


physical networks, independent of the other fragments.

15
• Each IP datagram is reencapsulated for each physical network over which it travels.
• The fragmentation process can be understood in detail by looking at the header fields of each
datagram,
Header fields used in IP fragmentation
(a) Unfragmented packet

(b) Fragmented packets.

• The unfragmented packet has 1400 bytes of data and a 20-byte IP header. When the packet
arrives at router R2 it has to be fragmented because its MTU is 532 bytes.
• A 532-byte MTU allows 512 bytes for data and 20-byte for IP header.
• The router sets the Flags field because the datagram is fragmented and the Offset is set to 0,
since this fragment contains the first part of the original datagram.

16
• The data carried in the second fragment starts with the 513th byte of the original data, so the
Offset field is set to 64 (ie, 512 ÷ 8).
• The third fragment contains the last 376 bytes of data, and the offset is 2 × 512 ÷ 8 = 128.
Since this is the last fragment, the flag field is not set.

3.5. GLOBAL ADDRESSES


• To send data to a host in the network there should be a way to identify all the systems in the
network uniquely.
• To provide uniqueness global addressing scheme is used. Ethernet addresses are globally
unique, but that alone will not be sufficient for large internetwork.
• Ethernet addresses are also flat, which means that they do not support routing protocols.
• IP addresses are hierarchical. IP addresses consist of two parts,
1. a network part
2. a host part
• The network part of an IP address identifies the network to which the host is attached; all
hosts attached to the same network have the same network part in their IP address.
• The host part identifies each host uniquely on that particular network.
• The routers will be attached to two networks and will have two address assigned for each
interface.
• IP addresses are divided into three different classes, which defines different-sized network
and host parts.

IP addresses
(a) Class A (b) Class B

(c) Class C

17
• Class D addresses specifies multicast group and class E addresses are currently unused.
• In all classes, the address is 32 bits long.
Class A
• If the first bit is 0, it is a class A address. Class A networks have 7 bits for the network part
and 24 bits for the host part
Class B
• If the first bit is 1 and the second is 0, it is a class B address. Class B addresses allocates 14
bits for the network and 16 bits for the host, meaning that each class B network has room for 65,534
hosts.
Class C
• If the first two bits are 1 and the third is 0, it is a class C address. Class C addresses have only
8 bits for the host and 21 for the network part. Therefore, a class C network can have only 256
unique host identifiers, which allows only 254 hosts
• IP addressing scheme described is known as “classful” addressing.
• IP addresses are written as four decimal integers separated by dots. Example,
171.69.210.245.

3.6. DATAGRAM FORWARDING IN IP


• Forwarding is the process of taking a packet from an input and sending it out on the appropriate
output, while routing is the process of building up the tables that allow the correct output for a
packet.
• The main points in forwarding of IP datagrams are as following:
1. Every IP datagram contains the IP address of the destination host.
2. The “network part” of an IP address uniquely identifies a physical network that is part of
the larger Internet.
3. All hosts and routers that have the same network part of their address are connected to the
same physical network.
4. Every physical network connected to the Internet has at least one router this router can
exchange packets with hosts or routers on either network.
• A datagram is sent from a source host to a destination host, possibly passing through several
routers along the way.

18
• The source first identifies whether the destination system is connected to the same physical
network.
• The network part of the IP address is compared, if a match occurs then both source and
destination lies in the same physical network and the packet can be directly delivered over that
network.
• If the node is not connected to the same physical network as the destination node, then it needs to
send the datagram to a router.
• Each node will have a choice of several routers, and so it needs to pick the best one. The router
that it chooses is known as the next hop router.
• The router finds the correct next hop by consulting its forwarding table.
• There is a default router that is used if none of the entries in the table match the destination’s
network number.
if (NetworkNum of destination = NetworkNum of one of my interfaces)
then
deliver packet to destination over that interface
else
if (NetworkNum of destination is in my forwarding table) then
deliver packet to NextHop router
else
deliver packet to default router
For a host with only one interface and only a default router in its forwarding table
if (NetworkNum of destination = my NetworkNum) then
deliver packet to destination directly
else
deliver packet to default router

19
• In the above figure if H1 wants to send a datagram to H2. Since they are on the same physical
network, H1 and H2 have the same network number in their IP address.
• H1 can deliver the datagram directly to H2 over the Ethernet.
• Now suppose H1 wants to send a datagram to H8. Since these hosts are on different physical
networks, they have different network numbers, so H1 can send datagram only through a router.
• R1 is the only choice so H1 sends the datagram over the Ethernet to R1.
• Similarly, R1 cannot deliver a datagram directly to H8 because R1is not in the same network as
H8.
• Suppose R1’s default router is R2; R1 sends the datagram to R2 over the token ring network.
• Assuming R2 has the forwarding table as shown below, it looks up H8’s network number
(network 1) and forwards the datagram to R3.

Example forwarding table for router R2

• R3 is on the same network as H8 and it forwards the datagram directly to H8. Forwarding table
can be constructed by using a routing protocol.

20
• Hierarchical addressing of splitting the address into network and host parts has improved the
scalability of a large network.
4. ADDRESS TRANSLATION (ARP)
• The IP datagrams contain IP addresses, but the physical interface on the host or router to which
the datagram should be forwarded can understand the addressing scheme of that particular network
only.
• Thus the IP address is translated to a link-level address. Then the IP datagram is encapsulated
inside a frame that contains that link-level address and sends it either to the destination or to a router
that forwards the datagram toward the destination.
• IP address is mapped into physical network address by encoding the host part of the host’s IP
address.
• While this solution has been used on some networks, but it cannot be used in network having
physical address more than 16 bits.
• A more general solution is each host can maintain a table of address pairs. i.e., the table should
map IP addresses into physical addresses.
• This table should be centrally managed by a system administrator and then copied to each host
on the network. This can be accomplished using the Address Resolution Protocol (ARP).
• The goal of ARP is to enable each host on a network to build up a table of mappings between IP
addresses and link-level addresses. Since these mappings may change over time, the entries are
timed out periodically and removed. This happens every 15 minutes.
• The set of mappings currently stored in a host is known as the ARP cache or ARP table.
• If a host wants to send an IP datagram to a host that it is on the same network, it first checks for a
mapping in the cache. If no mapping is found, it needs to invoke the Address Resolution Protocol
over the network.
• It does this by broadcasting an ARP query onto the network. This query contains the “target IP
address”.
• Each host receives the query and checks to see if it matches its IP address.
• If the IP address match, the host sends a response message that contains its link-layer address
back to the sender of the query.
• The sender adds the information contained in the response to its ARP table.
• The query message also includes the IP address and link-layer address of the sending host.

21
• Thus, when a host broadcasts a query message, each host on the network can learn the sender’s
link-level and IP addresses and place that information in its ARP table.
• However, not every host adds this information to its ARP table. If the host already has an entry
for that host in its table, it “refreshes” this entry; that is, it resets the time to discard the entry.
• If that host is the target of the query, then it adds the information about the sender to its table
because it needs the source’s physical address to send a response or ACK back to the source.
• If a host is not the target and does not already have an entry for the source in its ARP table, then
it does not add an entry for the source.
• Address Resolution Protocol (ARP) associates IP address with the physical address.

ARP packet format for IP-to-Ethernet address mappings.

• In addition to the IP and link-layer addresses of both sender and target, the packet contains
1. A HardwareType field, which specifies the type of physical network (e.g.,Ethernet)
2. A ProtocolType field, which specifies the higher-layer protocol (e.g., IP)
3. HLen (“hardware” address length) and PLen (“protocol” address length) fields, which
specify the length of the link-layer address and higher-layer protocol address, respectively
4. An Operation field, which specifies whether this is a request or a response
5. The source and target hardware (Ethernet) and protocol (IP) addresses

5. RARP (Reverse Address Resolution Protocol)


• The reverse address resolution protocol allows a host to find its internet address when it knows
only its physical address.

22
• RARP requires one or more servers to maintain a database to store the mappings of Link Layer
addresses to their respective protocol addresses.
• RARP works similar to that of ARP. The host wishing to retrieve its internet address broadcasts
an RARP query packets that contain its physical address to every host on its physical network.
• A server on the network recognizes the RARP packets and returns the host’s internet address.
6. DHCP (Dynamic Host Configuration Protocol)
Host Configuration
• In addition to an IP address, there is some other information needed by the host before
transmitting a packet.
• The most important of these is the address of a default router. Most host operating systems
allows manually configure of all information by a system administrator.
• There are some drawbacks in manual configuration. It is difficult to configure all the hosts in a
large network manually.
• The configuration process is error-prone, since it is necessary to ensure that every host gets the
correct network number and that no two hosts receive the same IP address.
• So automated configuration methods are required. Dynamic Host Configuration Protocol
(DHCP) is one of the automatic configuration methods.
• DHCP relies on the existence of a DHCP server that is responsible for providing configuration
information to hosts.
• There is at least one DHCP server for an administrative domain. The DHCP servers act as a
centralized repository for host configuration information server and automatically retrieved by the
host when it is booted or connected to the network.
• The configuration information for each host is stored in a table that is indexed by some form of
unique client identifier, like “hardware address”.
• The DHCP server maintains a pool of available addresses that can be assigned to the host when
requested.
• DHCP minimize the amount of manual configuration.
• To contact a DHCP server, a newly booted or attached host sends a HCPDISCOVER message to
a special IP address (255.255.255.255). It will be received by all hosts and routers on that network
since it is a broadcast message.
• One of the nodes in the network will be DHCP server.

23
• The server would then reply to the host that generated the discovery message and all the other
nodes would ignore it.
• It is not desirable to have one DHCP server on every network because this leads to large number
of servers that need to be correctly and consistently configured.
• DHCP uses the concept of a relay agent. There is at least one relay agent on each network, and it
is configured with the IP address of the DHCP server.
• When a relay agent receives a DHCPDISCOVER message, it unicasts it to the DHCP server and
waits for the response. The response is then send back to the requesting client.

The process of relaying a message from a host to a remote DHCP server

• The message is actually sent using a protocol called UDP (the User Datagram Protocol) that runs
over IP.
DHCP packet format

24
• The client puts its hardware address in the chaddr field. The DHCP server replies by filling in the
yiaddr (“your” IP address) field and sending it to the client.
• Other information such as the default router to be used by this client can be included in the
options field.
• In the case where DHCP dynamically assigns IP addresses to hosts, the hosts cannot keep
addresses indefinitely.
• Thus, DHCP allows addresses to be “leased” for some period of time. Once the lease expires, the
server is free to return that address to its pool.
• A host with a leased address should renew the lease periodically if it is connected to the network
and functioning correctly even after the lease period.

7. ICMP (Internet Control Message Protocol)


Error Reporting
• The Internet Control Message Protocol (ICMP) is a mechanism used by hosts and routers to send
notification of datagram problems back to the sender.
• IP is an unreliable and connectionless protocol. ICMP is a companion protocol to IP. ICMP helps
IP to inform a sender if a datagram is undelivered.
• Internet Control Message Protocol (ICMP), defines a collection of error messages that are sent
back to the source host whenever a router or host is unable to process an IP datagram successfully.
• ICMP defines error messages indicating
1. the destination host is unreachable

25
2. the reassembly process failed
3. the TTL had reached 0
4. the IP header checksum failed
• ICMP also defines control messages that a router can send back to a source host.
• One of the most useful control messages is ICMP-Redirect; it tells the source host that there is a
better route to the destination.
• ICMP-Redirects are used in the following situation.
• Suppose a host is connected to a network that has two routers attached to it, called R1 and
R2, R1is used as default router by the host.
• Since R1 is the default router most of the datagram uses R1 to forward its datagram based
on its forwarding table.
• If R2 serves as a better choice for a particular destination address, ICMP protocol sends
an ICMP-Redirect message back to the host instructing it to use R2 for all future datagrams
addressed to that destination.
• The host then adds this new route to its forwarding table.
8. QUEUEING DISCIPLINE
• Each router must implement queuing discipline to govern the packets that are buffered while
waiting for transmission.
• The queuing algorithm can be used for allocating both bandwidth and buffer space.
• There are two common queuing algorithms
1. first-in-first-out (FIFO)
2. fair queuing (FQ)

8.1. FIFO
• FIFO queuing is called first-come-first-served (FCFS) queuing. The first packet that arrives at a
router is the first packet to be transmitted.

FIFO queuing

26
• FIFO queue has “slots” to hold up to eight packets. If a packet arrives and the queue is full, then
the router discards that packet. This is sometimes called tail drop, since packets that arrive at the tail
end of the FIFO are dropped.
Tail drop at queue end

• FIFO is a scheduling discipline it determines the order in which packets are transmitted.
• Tail drop is a drop policy it determines which packets get dropped.
• FIFO and Tail drop are two different concepts but combined together and referred to as “FIFO
queuing,”
• FIFO with tail drop is the simplest of all queuing algorithms and most widely used in Internet
routers.
• FIFO is not responsible for congestion control and resource allocation. TCP takes responsibility
for detecting and responding to congestion.
• A simple variation on basic FIFO queuing is priority queuing.
• Each packet is assigned with a priority and stored in Type of Service (TOS) field of IP packet.
• The routers then implement multiple FIFO queues, one for each priority class.
• The router always transmits packets in the highest-priority queue first. Only if the high priority
queue is empty the packet from next priority is transmitted.

27
• Each priority packets are managed in FIFO manner.
• The problem with priority queuing is that the high-priority queue leads the other queues to
starvation.
• That is, as long as there is a high-priority packet in the high-priority queue, lower-priority queues
should wait.
• To overcome this problem there need to be limits on how much high-priority traffic to be
inserted in to the queue. The users should not be allowed to set high priority to their own packets in
an uncontrolled way.
• The network should charge more to deliver highpriority packets than low-priority packets.
• Implementing such a scheme in a decentralized environment such as the Internet is difficult.
• The need for priority queuing in Internet is to protect the most important packets like the routing
updates information to update the routing table.
• There is special queue for such packets, which can be identified by the TOS field in the IP
header.

8.2. Fair Queuing


• FIFO queuing does not differentiate between different traffic sources and does not provide
congestion-control mechanism. Fair queuing (FQ) is an algorithm proposed to address this problem.
• FQ maintains a separate queue for each flow handled by the router. The router services these
queues in a round-robin fashion.
Fair Queuing at a router

28
• When a queue reaches a particular length, additional packets belonging to that flow’s queue
are discarded.
• FQ is used in conjunction with an end to end congestion-control mechanism.
• The packets processed at a router are not of the same length. In a bit-by-bit round-robin
technique, the router transmits a bit from flow 1, then a bit from flow 2, and so on. But it is not
feasible to interleave the bits from different packets.
• The FQ mechanism determines the time required to transmit a given packet using bit-by-bit
round robin, and then using this finishing time to sequence the packets for transmission.
• To understand the algorithm of bit-by-bit round robin, consider the behavior of a single flow
and imagine a clock that ticks once each time one bit is transmitted from all of the active flows. (A
flow is active when it has data in the queue.)
• For this flow,
1. Pi length of packet i
2. Si time when the router starts to transmit packet i
3. Fi time when the router finishes transmitting packet i
• If Pi is expressed in terms of how many clock ticks it takes to transmit packet i
Fi = Si + Pi.
• If the packet i arrives before the transmission of i-1, then first bit of packet i is transmitted
immediately after the last bit of packet i −1.
• If the packets arrive after the transmission of i-1 the round-robin mechanism could not
transmit any packets from this flow.
• If Ai denote the time that packet i arrives at the router, then Si = max(Fi−1, Ai ) and Fi =
max(Fi−1, Ai ) + Pi
• For every flow Fi is calculated. Then Fi is treated as timestamps, and the packet lowest
timestamp is transmitted first.
• Consider the following example for fair queue implementation
(a) Shorter packets are sent first

29
The algorithm selects both packets from flow 1 to be transmitted before the packet in the flow 2 queue.

(b) Sending of longer packet, already in progress, is completed first.

The router has already begun to send a packet from flow 2 when the packet from flow 1 arrives. Though
the packet arriving on flow 1 would have finished before flow 2, the implementation does not preempt
the flow 2 packet.
• There are two things about fair queuing.
1. The link is never left idle when there is a packet in the queue. This characteristic is said
to be work-conserving. Work-conserving allows full link capacity to be used by a link as long as
there is no other flow to transmit packets. As soon as the other flows start sending, the available
capacity of the link should be shared by all the flow.
2. If the link is fully loaded and there are n flows sending data, then each flow can use only
1/nth of the link bandwidth.
• Weighted fair queuing (WFQ), assigns weight to each flow (queue). This weight specifies the
number of bits to be transmitted each.
• Simple FQ gives each queue a weight of 1, which means that only 1 bit is transmitted from
each queue each time.
• WFQ may assign one queue with a weight of 2, a second queue with a weight of 1, and a
third queue with a weight of 3.
• Then the first flow will get one-third of the available bandwidth, the second will get one-
sixth of the available bandwidth, and the third will get one-half of the available bandwidth.
• Note that a router performing WFQ must learn what weights to assign to each queue from
somewhere, either by manual configuration or by some sort of signaling from the sources.

9. ROUTING

30
• Forwarding consists of taking a packet to its destination address, consulting a table. Routing is
the process of building forwarding tables.
• Routing uses routing algorithms to build the forwarding table. It contains mappings from
network numbers to next hops.
• The routing protocols are collectively known as intradomain routing protocols, or interior
gateway protocols (IGPs).
• To understand routing a routing domain is taken into consideration. A routing domain is an
internetwork in which all the routers are under the same adminstrative control.
9.1. Network as a Graph
• Routing is, in essence, a problem of graph theory. Figure 4.14 shows a graph representing a
network. The nodes of the graph, labeled A through F, may be either hosts, switches, routers, or
networks. For our initial discussion, we will focus on the case where the nodes are routers. The
edges of the graph correspond to the network links. Each edge has an associated cost, which gives
some indication of the desirability of sending traffic over that link. A discussion of how edge costs
are assigned is given in Section 4.2.4.3 The basic problem of routing is to find the lowest-cost path
between any two nodes, where the cost of a path equals the sum of the costs of all the edges that
make up the path. For a simple network like the one in Figure 4.14, you could imagine just
calculating all the shortest paths and loading them into some nonvolatile storage on
each node. Such a static approach has several shortcomings:

31

You might also like