Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4021: Networks Discussion Chapter 3 INTERNETWORKING Eng. Haneen El-Masry March, 2014
Islamic University of Gaza Faculty of Engineering
Department of Computer Engineering ECOM 4021: Networks Discussion
Chapter 3
INTERNETWORKING
Eng. Haneen El-Masry
March, 2014
3.1 SWITCHING & BRIDGING
A switch is a device that interconnects links of the same type.
Multi-input, multi-output.
Transfers packets from an input to one or more outputs.
We can connect switches to each other and to hosts using point-to-point links to
build networks of large geographic scope.
Switched networks are scalable.
Every host on a switched network has its own link to the switch, so many hosts
can transmit at the full link speed provided that the switch is designed with
enough aggregate capacity.
Switching (Forwarding)
A switch’s primary function is to receive incoming packets on one of its links and to
transmit them on some other link. This is referred to as switching or forwarding. It is
the main function of the network layer.
How does the switch decide which output port to place each packet on?
It looks at the header of the packet for an identifier that it uses to make the decision.
Three common approaches:
Datagram or Connectionless approach.
Virtual circuit or Connection-oriented approach.
Source Routing.
Datagram switching (connectionless)
Each packet contains the complete destination address.
Forwarding decision is made by consulting a forwarding table.
Routing is the process by which forwarding tables are built.
A host can send a packet anywhere at any time.
When a host sends a packet, it has no way of knowing if the network is capable of
delivering it or if the destination host is even up and running.
Each packet is forwarded independently of previous packets that might have
been sent to the same destination.
A switch or link failure might not have any serious effect on communication if it is
possible to find an alternate route around the failure and update the forwarding
table accordingly.
Exercise 3
Exercise 4
Virtual Circuit Switching (connection-oriented)
Three steps to send the data:
1. Set up a virtual circuit (VC) from the source host to the destination host.
2. Data Transfer.
3. Tear Down the VC after sending data.
Connection Setup
During connection setup, connection state is established in each of the switches
between the source and destination hosts.
In each switch, the connection state for a VC consists of an entry in the VC table
containing:
A virtual circuit identifier (VCI) that uniquely identifies the connection at this
switch and that will be carried inside the header of the packets that belong to this
connection.
An incoming interface on which packets for this VC arrive at the switch.
An outgoing interface on which packets for this VC leave the switch.
A potentially different VCI that will be used for outgoing packets.
The semantics of an entry
If a packet arrives on the designated incoming interface and that packet contains the
designated VCI value in its header, then the packet should be sent out the specified
outgoing interface with the specified outgoing VCI value having been placed in its
header.
The combination of the VCI of the packets as they are received at the switch and the
interface on which they are received uniquely identifies the virtual connection.
VCI is not a globally significant identifier for the connection; it has significance only on a
given link.
Whenever a new connection is created, we need to assign a new VCI for that connection
on each link that the connection will traverse. We need to ensure that the chosen VCI
on a given link is not currently in use on that link by some existing connection.
A VC can be set up manually by a network administrator or be set up automatically by
signaling from the source host.
Data Transfer
Each packet carries a VC identifier (VCI) in its header.
Forwarding decision at a switch is made by consulting the VC table.
All packets belonging to the same connection follow the same path.
Connection teardown
Each switch removes the entry for the VC from its VC table.
Exercise 1
a) A >> C
SW1ل address of Cفيها setup messageرح ترسل Aفي البداية -1
2- SW1 رح يستقبل الmsg منPort # 2
3- SW1 بيقدر يوصل لC من خلالPort # 3 اذن حيكون الVC table :له بالشكل التالي
Output VCI Outgoing Interface Input VCI Incoming interface
3 2
فلازم ناخد بالنا من نقطتين : input VCIهلأ بدنا نحدد ال -4
انهinput VCI + Incoming Interface مع بعضunique ع نفسLink .
في السؤال حاكي انه الconnection هوbidirectional connection وهدا معناه انه ما
داخله منه لهم نفس packetsطالعه منه و >>> Port Packetsع نفس ال بينفع يكون فيه
. VCIال
لي طالعهال packetsلل و port # 2من داخلهاللي Packetsالمستخدمة لل VCIsفهلأ بنشوف شو ال
المستخدمة input VCIشو ال SW1ل input interfaceهو Port #2يعني بشوف لما يكون منه :
غيرهم. CVIالمستخدمة وبختار output VCIشو هيا ال SW1ل output interfaceولما يكون
. 0فهنا لسه ما فيه شي مستخدم فرح نختار
5- SW1 رح يرسل الsetup msg من خلالPort # 3 لC .
اللي رح Packetsمن خلاله تعرف كل ال VCIرح تختار Aجاهزة للاتصال مع Cاذا كانت -6
التالية: وبتختاره بناء عالنقاط Aتوصلها من
انهVCI اللي رح تختاره لازم يكونunique للinterface اللي استلمت منه الsetup msg.
اذا كان connection هوbidirectional connection ما بينفع يكون فيه ع نفس ال فPort
Packets <<< طالعه منه وpackets داخله منه لهم نفس الVCI .
ولما يكون المستخدمة output VCIsشو ال output interfaceهو Port # 3لما يكون فهلأ بنشوف
input interface شو الinput VCIs 0المستخدمة وبنختار غيرهم وهنا رح نختار.
7- C ترسلACK يحتوي علىVCI اللي اختارته لSW1
8- SW1 بيعمل الoutput VCI هو اللي استلمه منC .
9- SW1 يرسلACK يحتوي علىinput VCI الىA .
::SW1 ل VC tableوبهيك بيكون
Output VCI Outgoing Interface Input VCI Incoming interface
0 3 0 2
b) D>>B
1- D سل ترsetup message فيهاaddress of B لSW1
2- SW1يستقبل ال رحmsg منPort # 0
3- SW1 بيقدر يوصل لB من خلالPort # 1 اذن حيكون الVC table :له بالشكل التالي
Output VCI Outgoing Interface Input VCI Incoming interface
1 0
inputشو ال input interfaceهو Port #0شوف لما يكون: رح ن inputهلأ بدنا نحدد ال -4
VCI المستخدمة ولما يكونoutput interface شو هيا الoutput VCI المستخدمة وبختارCVI
. 0فهنا لسه ما فيه شي مستخدم فرح نختار غيرهم.
5- SW1 رح يرسل الsetup msg من خلالPort # 1 لSW2 .
6- SW2 رح يستلمها منport # 3 وبيقدر يوصل لB منPort #0 اذن رح يكون الVC table
له :
Output VCI Outgoing Interface Input VCI Incoming interface
0 3
هو port # 3المستخدمة لما يكون input VCI رح نشوف ال input VCIهلأ بدنا نحدد ال -7
input و output VCI لما يكونoutput 0: رح نختار.
8- SW2 يرسلsetup msg عبرport #0 الىSW3
9- SW3 يستلم الmsg منport # 0 وبيوصل لB منport # 3 اذن الtable :
Output VCI Outgoing Interface Input VCI Incoming interface
3 0
port # 0المستخدمة لما يكون input VCI رح نشوف ال input VCIهلأ بدنا نحدد ال -10
.0: رح نختار outputلما يكون output VCI و inputهو
11- SW3 يرسل الmsg منport #3 الىB
اللي Packetsمن خلاله تعرف كل ال VCIرح تختار Dجاهزة للاتصال مع Bاذا كانت -12
:Dرح توصلها من
ولما المستخدمة output VCIsشو ال output interfaceهو Port # 3لما يكون هلأ بنشوفف
.0المستخدمة وبنختار غيرهم وهنا رح نختار input VCIsشو ال input interfaceيكون
13- B ترسلACK يحتوي علىVCI اللي اختارته لSW3
14- SW3 بيعمل الoutput VCI هو اللي استلمه منB .
15- SW3 يرسلACK يحتوي علىinput VCI الىSW2 .
16- SW2 يرسلACK يحتوي علىinput VCI االىSW1
17- SW1 يرسلACK يحتوي علىinput VCI االىD
::SW1 ل VC tableوبهيك بيكون
Output VCI Outgoing Interface Input VCI Incoming interface
0 1 0 0
SW2 VC Table
Output VCI Outgoing Interface Input VCI Incoming interface
0 0 0 3
SW3 VC Table
Output VCI Outgoing Interface Input VCI Incoming interface
0 3 0 0
كامل لكل الفروع ما عدا الاخير: tableوهدا ال هكذااااااااااا لكل الفروووعو
وهلأ خلينا نشوف الفرع الأخير ::
f) H>>A
1- H سل ترsetup message فيهاaddress of A لSW4
2- SW4يستقبل ال رحmsg منPort # 0 وبيقدر يوصل لA من خلالPort # 3 اذن
:له بالشكل التالي VC tableحيكون ال
Output VCI Outgoing Interface Input VCI Incoming interface
3 0
SW4ل input interfaceهو Port #0شوف لما يكون: رح ن input VCIهلأ بدنا نحدد ال -3
output VCIشو هيا ال output interfaceالمستخدمة ولما يكون input VCIشو ال
. 0فهنا لسه ما فيه شي مستخدم فرح نختار غيرهم. CVIالمستخدمة وبختار
4- SW4 رح يرسل الsetup msg من خلالPort # 3 لSW2 .
5- SW2 رح يستلمها منport # 1 وبيقدر يوصل لA منPort #3 اذن رح يكون الVC table
له :Output VCI Outgoing Interface Input VCI Incoming interface
3 1
هو port # 1المستخدمة لما يكون input VCI رح نشوف ال input VCIبدنا نحدد ال هلأ -6
input و ”0“ وهنا عنا output VCI لما يكونoutput 1رح نختار وهنا ما فيه فبالتالي
7- SW2 يرسلsetup msg عبرport #3 الىSW1
8- SW1 يستلم الmsg منport # 1 وبيوصل لA منport # 2 اذن الtable :
Output VCI Outgoing Interface Input VCI Incoming interface
2 1
هو port # 1المستخدمة لما يكون input VCI رح نشوف ال input VCIهلأ بدنا نحدد ال -9
input لازم نشوف 0وفي هاي الحاله ما فيه ولكن لسه ما بنقدر نحكي انه output VCI لما
.3رح نختار اذن (0,1,2)وبهاي الحاله موجود عنا outputهو port #1يكون
10- SW1 يرسل الmsg منport #2 الىA
اللي Packetsمن خلاله تعرف كل ال VCIرح تختار Hجاهزة للاتصال مع Aاذا كانت -11
:Hرح توصلها من
وكمان المستخدمة output VCIsشو ال output interfaceهو Port # 2لما يكون هلأ بنشوفف
input VCIsشو ال input interfaceلما يكون فبنشوف 0ما فيه بس ما بنقدر ع طول نحكي
.2وبنختار (0,1)وبنلاقي المستخدمة
12- A ترسلACK يحتوي علىVCI اللي اختارته لSW1
13- SW1 بيعمل الoutput VCI هو اللي استلمه منA .
14- SW1 يرسلACK لى يحتوي عinput VCI الىSW2 .
15- SW2 يرسلACK يحتوي علىinput VCI االىSW4
16- SW4 يرسلACK يحتوي علىinput VCI االىH
:كاااامل VC tableوبهيك بيكون
Exercise 2
Characteristics of VC
There is at least one RTT of delay before data is sent.
The per-packet overhead caused by the header is reduced relative to the
datagram model.
Each data packet contains only a small identifier, which is only unique on one
link.
If a switch or a link in a connection fails, the connection is broken and a new one
will need to be established.
Also the old one needs to be torn down to free up table storage space in the
switches.
The issue of how a switch decides which link to forward the connection request
on is similar to the function of a routing algorithm.
By the time the VC is set up, the host knows that there is a route to the receiver
and that the receiver is willing to receive data.
It is possible to provide each VC with a different quality of service (QoS).
Quality of Service (QoS)
It means that the network gives the user some kind of performance related guarantee
(e.g., bandwidth, delay).
Switches allocate resources they need to meet this guarantee at the time a VC is
established.
Examples of VC technologies: X.25, Frame Relay, ATM
Contention vs. Congestion
Contention occurs when multiple packets have to be queued at a switch because they
are competing for the same output link.
Congestion happens when a switch has so many packets queued that is runs out of
buffer space and has to drop packets
Virtual circuit avoids congestion by allocating enough buffer space for each VC,
but it causes that a switch may be underutilized.
Datagram uses buffers more efficiently, but invites congestion.
Source Routing
All the information about network topology that is required to switch a packet across
the network is provided by the source host.
Three ways to handle headers for source routing:
1. Rotation.
2. Stripping.
3. Pointer.
Bridges and LAN Switches
A bridge (also referred to as LAN switch) is a switch that forwards packets between
LANs such as Ethernets.
Suppose you want to interconnect two Ethernets:
One approach is put a repeater in between them.
It might exceed the physical limitation of the Ethernet.
Performance will degrade due to more collisions.
An alternative is to put a bridge between the two Ethernets.
The bridge accepts all frames transmitted on each Ethernet and forwards frames from
one Ethernet to the other.
The bridge implements the Ethernet’s MAC protocol on each interface.
A collection of LANs connected by one or more bridges is said to form an Extended LAN.
Benefits of Bridging
Interconnects multiple LANs transparently.
Isolates collision domains: each Ethernet in an extended LAN is one collision
domain.
A bridge increases the total bandwidth of a network: If a bridge interconnects N
100 Mbps Ethernets, then the bridge can carry 100N Mbps of traffic.
Early bridges forward all received frames out on all ports other than the incoming port.
Learning Bridges address the inefficiency of early bridges.
Observe that there is no need to forward a frame out on all other ports.
How does a bridge come to learn on which port the various hosts reside?
One solution is to manually configure a forwarding table.
A better solution is to have the bridge learn the information in the table by itself .
Forwarding table is initially empty. Table entries are added over time.
If a frame carrying source address A is received on port n, then add entry [A, n] in the
table.
Each entry has an expiration timer, entry removed when timer expires.
Timer for A is reset every time the bridge sees a frame from A.
This is to protect against the situation in which a host is moved from one network to
another.
Bridge’s Forwarding Algorithm
When a frame is received, look up the destination address in forwarding table.
If destination is not found, forward the frame out on all the other ports.
If destination is found:
If destination and source are on the same port, discard the frame.
If destination and source are on different ports, forward the frame out on the
port indicated in the table entry.
Exercise 15
a) A >> C
1. A forwards the frame to B1.
2. B1 inserts <A, A-interface> in its table, and because of C isn’t in its table, it
forwards the frame to B2.
3. B2 inserts <A,B1-interface> in its table, and because C isn’t in its table, it forwards
the frame to B3 and B4.
4. B3 inserts <A,B2-interface> in its table, and because C isn’t in its table, it forwards
the frame to C and C accepts the frame.
5. B4 inserts <A,B2-interface> in its table, and because C isn’t in its table, it forwards
the frame to D that discards the frame.
B1 Table:
Destination Port
A A-interface
B2 Table:
Destination Port
A B1-interface
B3 Table:
Destination Port
A B2-interface
B4 Table:
Destination Port
A B2-interface
b) C >> A
1. C forwards the frame to B3.
2. B3 inserts <C, C-interface> in its table, and forwards the frame to B2-interface.
3. B2 inserts <C,B3-interface> in its table, and forwards the frame to B1-interface.
4. B1 inserts <C,B2-interface> in its table, and forwards the frame to A-interface.
B1 Table:
Destination Port
A A-interface
C B2-interface
B2 Table:
Destination Port
A B1-interface
C B3-interface
B3 Table:
Destination Port
A B2-interface
C C-interface
c) D >> C
1. D forwards the frame to B4.
2. B4 inserts <D, D-interface> in its table, and because of C isn’t in its table, it
forwards the frame to B2.
3. B2 inserts <D,B4-interface> in its table, and forwards the frame to B3-interface.
4. B3 inserts <D,B2-interface> in its table, and forwards the frame to C-interface.
B1 Table:
Destination Port
A A-interface
C B2-interface
B2 Table:
Destination Port
A B1-interface
C B3-interface
D B4-interface
B3 Table:
Destination Port
A B2-interface
C C-interface
D B2-interface
B4 Table:
Destination Port
A B2-interface
D D-interface
Spanning Tree Algorithm
When the extended LAN has a loop, frames may loop forever.
Loops are built into the network to provide redundancy in case of failures.
Solution:
The bridges run a distributed spanning tree algorithm to agree upon a spanning tree.
Spanning Tree
It is a subset of the network topology that reaches all the LANs and contains no loops.
The algorithm disable some ports from the bridges to eliminate loops.
The algorithm is dynamic: the bridges are always prepared to reconfigure
themselves into a new spanning tree if some bridges fail.
The Spanning Tree Algorithm
Each bridge has a unique identifier.
The bridge with the smallest ID is the root of the spanning tree.
The root bridge always forwards frames out over all of its ports.
Each bridge computes the shortest path to the root and note which port is on this
path.
This port is selected as the bridge’s preferred path to the root.
All the bridges connected to a LAN elect a single designated bridge that will be
responsible for forwarding frames toward the root bridge.
The designated bridge is the one that is closest to the root.
Tie breaking: the smallest ID wins.
Each bridge is connected to more than one LAN, So it participates in the election
of a designated bridge for each LAN it is connected to.
Each bridge decides if it is the designated bridge relative to each of its ports.
The bridge forwards frames over those ports for which it is the designated bridge.
Exercise 13:
. B1وهنا رح نختار IDوهي الأقل Root Bridgeفي البداية رح نختار -1
ال اللي رح يوصل Portوهو عبارة عن ال Bridgeلكل Preferred Portرح نحدد ال -2
Bridge للRoot " بأقل مسافةNumber of Hobs " واذا كان فيه اكتر منport بنختار
.IDالاقل bridgeالمتصل بال
بالشكل التالي: Bridgeوحيكون لكل
واذا كان في أكتر من Rootوهي الأقرب لل LANلكل Designated Bridgeرح نختار ال -3
LAN لهم نفس البعد عن الRoot بنختار الأقلID.
في السؤال :::::
LAN A:
وهلأ رح B7اذن رح نختار Root أقرب لل B2, B7 : :B7المتصله فيها هي Bridgesال
.B7ل Preferred Portوال A, B7اللي بيوصل بين Portنفتح ال
LAN B:
2تبعد ب B5وكمان 2ب Rootتبعد عن ال B2, B5 : :B2المتصله فيها هي Bridgesال
وال B, B2اللي بيوصل بين Port. وهلأ رح نفتح ال IDلأنها أقل B2اذن رح نختار
Preferred Port لB2.
LAN C,E:
C,E متصلة بالRoot مباشرة اذن رح نفتح الPort اللي بيوصلها مع الRoot.
LAN D:
وهلأ رح B3.اذن رح نختار Rootأقرب لل B2, B3 : :B3المتصله فيها هي Bridgesال
B3ل Preferred Portوال D, B3اللي بيوصل بين Portنفتح ال
LAN F:
وهلأ رح B3.اذن رح نختار Root 3أقرب لل B5, B3 : :B3المتصله فيها هي Bridgesال
B3ل Preferred Portوال F, B3بين اللي بيوصل Portنفتح ال
LAN G:
وهلأ رح B3.اذن رح نختار Root أقرب لل B4, B3 : :B3المتصله فيها هي Bridgesال
B3ل Preferred Portوال G, B3اللي بيوصل بين Portنفتح ال
LAN H:
وهلأ رح B3.اذن رح نختار Rootأقرب لل B6, B3 : :B3المتصله فيها هي Bridgesال
B3ل Preferred Portوال H, B3اللي بيوصل بين Portنفتح ال
LAN I:
2تبعد ب B6وكمان 2ب Rootتبعد عن ال B6, B4 : :B4المتصله فيها هي Bridgesال
Preferredوال I, B4اللي بيوصل بين Port. هلأ رح نفتح ال IDلأنها أقل B4.اذن رح نختار
Port لB4
LAN J:
Preferredوال B6اللي بيوصلها مع Portاذن رح نفتح ال B6المتصله فيها هي Bridgesال
Port لB6.
وبيكون الناتج كالتالي: LANsوبهيك بنكووووون خلصنا كل
Exercise 14:
The Spanning Tree Protocol
It is a distributed implementation of the spanning tree algorithm.
Bridges exchanges configuration messages with each other.
A configuration message contains:
ID for the bridge that is sending the message.
ID for what the sending bridge believes to be the root bridge.
The distance (in hops) from the sending bridge to the root bridge.
Initially each bridge thinks it is the root, so it sends a configuration message on
each of its ports identifying itself as the root and giving a distance to the root of
0.
Upon receiving a configuration message over a particular port, the bridge checks
to see if the new message is better than the current best configuration message
recorded for that port.
The new configuration message is better than the currently recorded one if:
Case 1: It identifies a root with a smaller ID.
Case 2: It identifies a root with an equal ID but with a shorter distance.
Case 3: The root ID and distance are equal, but the sending bridge has a
smaller ID.
If the new message is better than the currently recorded one:
The bridge discards the old information and saves the new information
It adds 1 to the distance-to-root field.
When a bridge receives a configuration message indicating that it is not the root
bridge, that is, a message from a bridge with a smaller ID:
The bridge stops generating configuration messages on its own.
Only forwards configuration messages from other bridges.
When a bridge receives a configuration message that indicates it is not the
designated bridge for that port, that is, a message from a bridge that is closer to
the root or equally far from the root but with a smaller ID:
The bridge stops forwarding configuration messages over that port.
When the system stabilizes:
Only the root bridge is still generating configuration messages.
Other bridges are forwarding these messages only over ports for which they
are the designated bridge.
Even after the system has stabilized:
The root bridge continues to send configuration messages periodically.
Other bridges continue to forward these messages.
When a bridge fails:
The downstream bridges will not receive the configuration messages.
After waiting a specified period of time, they will once again claim to be the
root and the algorithm starts again.
Exercise 21:
Broadcast and Multicast
Broadcast: each bridge forwards a frame with a broadcast destination address out on
each active (selected) port other than the incoming port.
Multicast: is the same as broadcast, with each host deciding for itself whether or not to
accept the frame.