CH - Islamic University of Gazasite.iugaza.edu.ps/wp-content/uploads/Networks... · 4.2 Virtual...
Transcript of CH - Islamic University of Gazasite.iugaza.edu.ps/wp-content/uploads/Networks... · 4.2 Virtual...
Lecture # 5
CH.4
The Network Layer
Islamic University of Gaza
Faculty of Engineering
Computer Engineering Department
Networks Discussion ECOM 4021
By
Eng. Wafaa Audah
April 2013
Networks Discussion Eng. Wafaa Audah
(Theoretical material: page 2-9, Review questions and problems :10-end)
4.1 Introduction
- Forwarding: move packets from router’s input to
appropriate router output.
خاص به Forwarding tableلكل راوتر يوجد
- Routing: determine route taken by packets from source to
destination.
الخاصة Tablesلتحديد الراوتنج وعمل ال Algorithms يوجد عدة
بالشبكة
Network service model
- Characteristics of end-to-end transport of packets between
sending and receiving end systems.
- Services that could be provided by the network layer
includes:
• Guaranteed delivery: This service guarantees that the
packet will eventually arrive at its destination.
• Guaranteed delivery with bounded delay: This service not
only guarantees delivery of the packet, but delivery within
a specified host-to-host delay bound (for example, within
100 msec).
في الكتاب 543يوجد كثير من األنواع ولكن شرحها المفصل في صفحة
" pdfفوق في ترقيم ال"
4.2 Virtual circuit and datagram networks
- Computer networks that provide only a connection service
at the network layer are called virtual-circuit (VC) networks.
- Computer networks that provide only a connectionless
service at the network layer are called datagram networks.
2
Networks Discussion Eng. Wafaa Audah
Virtual Circuit Network
- VC consists of:
1. Path: from source to destination: all links/routers
between source and destination.
2. VC numbers: one number for each link along path ***
3. entries in forwarding tables in routers along path
عند التعامل مع النوعين الفيرتشوال سيركت والداتاجرام الزم نفرق ***
بين شغلتين
: VC number - بحيث تمثل الرقم الخاص بكل لينك لتمييزه في الشبكة ,
"خاص بنوع الفيرتشوال" نك رقم خاص فيه غير مسموح تكرارهلذلك لكل لي
interface number - : رقم بحيث هو وهيا شغلة موجودة في النوعين
أيبد( طرف اللينك بالنسبة للراوتر)يُعطى لكل انترفيس خاص بالراوتر
ولكل راوتر يتكرر نفس الشي بمعنى انو الرقم ممكن 1الترقيم عادة من
الشكل التالي يوضح الفرق بين النوعين السابقين من _ يتكرر بالشبكة
:االرقام
There are three identifiable phases in a virtual circuit:
- VC Setup: The network layer determines the path between
sender and receiver, that is, the series of links and routers through which all packets of the VC will travel. The network layer also determines the VC number for each link along the path. Finally. the network layer adds an entry in the forwarding table in each router along the path.
A
3
Networks Discussion Eng. Wafaa Audah
- Data transfer: As shown in figure below, once the VC has
been established, packets can begin to flow along the VC.
- VC teardown: This is initiated when the sender (or
receiver) informs the network layer of its desire to
terminate the VC. The network layer will then typically
inform the end system on the other side of the network of
the call termination and update the forwarding tables in
each of the packet routers on the path to indicate that the
VC no longer exists.
Forwarding Table For Virtual circuit Networks :
Aمقطع من التيبل الخاص بالراوتر
لحتى نالحظ الفرق بين الفيرتشوال سيركت والداتاجرام الزم نثبت
بيختلف في بالنا شكل التيبل هادا والمدخالت الثابتة اللي فيه النو
.......عن التيبل الخاص بالراوتر في الداتاجرام نتورك
A
4
Networks Discussion Eng. Wafaa Audah
Datagram Network
- No call setup at network layer
- Packets forwarded using destination host address
Forwarding table
بحيث قد يكون عنوان destinationنالحظ هنا ان التيبل يعتمد على عنوان
في . االنترفيس الخاص فيها Rangeمعين ولكل subnetل Rangeواحد او
billion 4بت للعنوان رح يكون عنا احتمال وجود 32هاي الحالة عنا
possible entries احنا مش محتاجين نكتب كل هاي الشغالت بالتيبل
:زي التالي Prefix Matchالحل هوا استخدام
5
Networks Discussion Eng. Wafaa Audah
- The router matches a prefix of the packet's destination address
with the entries in the table; if there's a match, the router
forward the packet to a link associated with the match.
- When there are multiple matches, the router uses the longest
prefix matching rule; that is. it finds the longest matching entry
in the table and forwards the packet to the link interface
associated with the longest prefix match.
4.3 What’s inside a router
Input Port Functions
6
Networks Discussion Eng. Wafaa Audah
Input Port Queuing
Fabric slower than input ports combined queuing may
occur at input queues.
.بسرعة أكبر من معدل النقل fabric switchعندما تصل الداتاجرامز إلى
Head-of-the-Line (HOL) blocking: queued datagram at
front of queue prevents others in queue from moving
forward.
تمنع غيرها من االنتقال فتكون شاغلة queueحالة وجود داتاجرام في
المسار مع انو غيرها موجود والطرف اآلخر مستعد الستقبالها ولكن اليتم
:النقل كما في الصورة التالية
حسب الصورة فان الداتا باللون األخضر رح تستنى الداتا اللي باللون االحمر
مستعد الستقبال الداتا باللون ويسير عندها ديلي مع انو الطرف التاني
HOLالوسطى اللي بالطرف اليمين فارغة وهادا معناه queueال_االخضر
Blocking
Queuing delay and loss due to input buffer overflow!
Output Ports
- Buffering when arrival rate via switch exceeds output line
speed
.بسرعة أكبر من معدل النقل fabric switchالداتاجرامز من عندما تصل
7
Networks Discussion Eng. Wafaa Audah
- Queuing (delay) and loss due to output port buffer
overflow!
Three types of switching fabrics
يرجى مراجعة ..... لمزيد من المعلومات والتفاصيل عن هادا الموضوع
563-533الكتاب من صفحة
4.4 IP: Internet Protocol
IP Fragmentation & Reassembly
من الداتا إلى مجموعة من البلوكات األصغر حجما عملية تقسيم بلوك كبير
fragmentationتسمى عملية ال
- Network links have MTU (max. transfer size) - largest
possible link-level frame.
- Large IP datagram divided (“fragmented”) within net
one datagram becomes several datagrams
“reassembled” only at final destination
IP header bits used to identify, order related
fragments
سيتم توضيحها بالتفصيل مع fragmentation شرح كيفية التعامل مع ال
....... السؤال الحقا في هذه المتريال
8
Networks Discussion Eng. Wafaa Audah
مارح يتم IP Addresses and Subnettingباقي مواضيع السكشن زي
شرحها هنا النو تم تغطيتها في الالب وموجودة بالكتاب والساليدز
4.5 Routing algorithms
- Link-State Routing Algorithm
Dijkstra's algorithm requires that each node must have complete information about the network; that is, each node must know the link costs of all links in the network.
عشان نعمل الراوتنج تيبل الزم نعرف معنى الرموز اللي موجودة فيه وهيا
:كالتالي
- L(v): current value of cost of path from source to dest. V
= ∞ if not direct neighbors
- P: path from source to v
- M: set of nodes whose least cost path definitively known (visited nodes)
- Distance Vector Algorithm
The Bellman-Ford algorithm uses only on information from its neighbors and knowledge of its link costs, to update it costs and paths.
ستأتي Bellman-Ford و Dijkstraشرح آلية العمل الخاصة ب ***
****بالتفصيل مع األسئلة الخاصة بها الحقا
باقي المواضيع التي لم تتم تغطيتها هنا في المتريال هيا اكيد :مالحظة
^_^مطلوبة وموجودة بالساليدز والكتاب ويجب قراءتها
9
Networks Discussion Eng. Wafaa Audah
Review Questions and Problems
Review Questions
R.9 Describe how packet loss can occur at input ports. Describe how
packet loss at input ports can be eliminated (without using infinite
buffers).
Packet loss occurs if queue size at the input port grows large because of slow
switching fabric speed and thus exhausting router’s buffer space. It can be
eliminated if the switching fabric speed is at least n times as fast as the
input line speed, where n is the number of input ports.
Speed=
n*port speed n input ports
10
Networks Discussion Eng. Wafaa Audah
Problems
a. Destination Address Link Interface
H3 3
b. No, because forwarding rule is only based on destination address.
!!!!!(وكل واحد له انترفيس H3عمل التيبل ألنو رح يكون عنا صفين ل اليمكن)
c. Incoming interface Incoming VC# Outgoing Interface Outgoing VC#
1 12 3 22
2 63 4 18
P.4 Consider the network below.
a. Suppose that this network is a datagram network. Show the
forwarding table in router A, such that all traffic destined to host H3 is
forwarded through interface 3.
b. Suppose that this network is a datagram network. Can you write down
a forwarding table in router A, such that all traffic from H1 destined to
host H3 is forwarded through interface 3, while all traffic from H2
destined to host H3 is forwarded through interface 4?
c. Now suppose that this network is a virtual circuit network and that
there is one ongoing call between H1 and H3, and another ongoing call
between H2 and H3. Write down a forwarding table in router A, such
that all traffic from H1 destined to host H3 is forwarded through
interface 3, while all traffic from H2 destined to host H3 is forwarded
through interface 4.
11
Networks Discussion Eng. Wafaa Audah
P.8 Consider the switch shown below. Suppose that all datagrams have
the same fixed length, that the switch operates in a slotted, synchronous
manner, and that in one time slot a datagram can be transferred from an
input port to an output port. The switch fabric is a crossbar so that at
most one datagram can be transferred to a given output port in a time
slot, but different output ports can receive datagrams from different
input ports in a single time slot. What is the minimal number of time
slots needed to transfer the packets shown from input ports to their
output ports, assuming any input queue scheduling order you want (i .e.
, it need not have HOL blocking)? What is the largest number of slots
needed, assuming the worst-case scheduling order you can devise,
assuming that a non-empty input queue is never idle?
12
Networks Discussion Eng. Wafaa Audah
Slot 1 Slot 2 Slot 3
Q1
Q2
Q3
Slot 1: From Q1: X Slot 2: From Q1: - Slot 3: From Q1: -
From Q2: Y From Q2: X From Q2: -
From Q3: - From Q3: Y From Q3: Z
The number of time slots needed is 3
خلينا .....هنا رح نحتار هل هادا الرقم اللي طلع معنا هوا المينمم وال الماكسيمم
نشوف هل عنا حل آخر غير الموجود بمعنى هل في خيارات في اختيار الداتا ممكن
؟؟؟؟!!!تغير في عدد التايم سلوت
Slot 1 Slot 2 Slot 3
Slot 1: From Q1: X Slot 2: From Q1: - Slot 3: From Q1: -
From Q2: - From Q2: Y From Q2: X
From Q3: Y From Q3: Z From Q3: -
The minimum and maximum slots equal 3 !!!
بس هنا في هاي الحالة صدفت انو نفس الشي وما فرق معنا بس في حاالت تانية
بيكون في عدة HOLبيكون الوضع فيها معقد أكتر بمعنى انو لو كان في أكتر من حالة
خيارات لالرسال بتعطي فرصة وجود مينمم وماكسيمم تايم
X
X Y
Z Y
X
X Y
Z Y
X
Z Y
Z
X Y
z
X
13
Networks Discussion Eng. Wafaa Audah
P.9 Consider a datagram network using 32-bit host addresses. Suppose a
router has four links, numbered 0 through 3, and packets are to be
forwarded to the link interfaces as follows:
a. Provide a forwarding table that has four entries, uses longest prefix
matching, and forwards packets to the correct link interfaces.
b. Describe how your forwarding table determines the appropriate link
interface for datagrams with destination addresses:
14
Networks Discussion Eng. Wafaa Audah
P.10 Consider a datagram network using 8-bit host addresses. Suppose
a router uses longest prefix matching and has the following forwarding
table:
Prefix Match Interface
00 0
010 1
011 2
10 2
11 3
For each of the four interfaces, give the associated range of destination
host addresses and the number of addresses in the range.
a. Prefix Match Link Interface
1st 11100000 00 0
2nd 11100000 01000000 1
3rd 1110000 2
4th 11100001 1 3
5th otherwise 3
لو انا حكيت هادا العنوان بدي اعرف اليا .. لسبب مهم وهوا entryالزم نحط هادي ال
؟؟؟؟1110000110000000000000000000000 :انترفيس بيتبع
2لو ما كنا حاطين هاي االنتري رح يكون الجواب انو هادا العنوان تابع لالنترفيس
هادا الشي مش صحيح لذلك الزم .حسب ال بريفكس اللي موجود بالتيبل السابق !!
الرينج بحيث بنبحث عال بريفكس تبع 5نميز العناوين اللي رح يبدا منها رينج انترفيس
1 11100001الجديد وهوا
b. Prefix match for first address is 5th entry: link interface 3
Prefix match for second address is 3nd entry: link interface 2
Prefix match for third address is 4th entry: link interface 3
الزم نتتبع عشان نطلع البريفكس
على العنوان بداية من الشمال
بحيث انو نطلع المقطع الثابت
في كل الرينج بحيث انو العناوين
متتالية وبداية كل رينج هيا
التالية الخر عنوان بالرينج
......السابق
15
Networks Discussion Eng. Wafaa Audah
هنا الحل هوا عكس حل السؤال السابق بمعنى انو هنا المعطى هوا ال بريفكس
والمطلوب الرينج
عشان نحسب عدد الهوست في كل رينج بنشوف كم عدد البتات اللي بيسير فيها
كم عنوان عنا ؟؟؟ بيكون الحل هوا 111 ل 000التغيير في الرينج مسال لما احكي من
هنا بالسؤال نفس ......عناوين 8=3^2عدد البتات اللي صار فيها التغيير يعني ^ 2
الشي بنشوف كم بت صار فيهم التغيير في الرينج وعأساسهم بنشوف عدد الهوست
16
Networks Discussion Eng. Wafaa Audah
P.17 Consider sending a 2400-byte datagram into a link that has an
MTU of 700 bytes . Suppose the original datagram is stamped with the
identification number 422. How many fragments are generated? What
are the values in the various fields in the IP datagram(s) generated
related to fragmentation?
Subnet 1: 2^n-2> 63: n= 7 -------- 128 interfaces
Subnet 2: 2^n-2> 95: n= 7 -------- 128 interfaces
Subnet 3: 2^n-2> 16: n= 5 -------- 32 interfaces
Subnet 1: 223.1.17.0
Subnet 2: 223.1.17.128 ------ الخر الشبكة
Subnet 3: مالها مكان بالشبكة
So,we can’t make a classsfull subnetting based on the topology above
with network prefix address 223.1.17/24
P.12 Consider a router that interconnects three subnets: Subnet I,
Subnet 2, and Subnet 3. Suppose all of the interfaces in each of these
three subnets are required to have the prefix 223.1.17/24. Also suppose
that Subnet I is required to support up to 63 interfaces, Subnet 2 is to
support up to 95 interfaces, and Subnet 3 is to support up to 16
interfaces. Provide three network addresses that satisfy these
constraints.
17
Networks Discussion Eng. Wafaa Audah
P.24 Consider the following network. With the indicated link costs, use
Dijkstra's shortest-path algorithm to compute the shortest path from X to
all network nodes.
- Datagram = Header + Data
- MTU = Header + Data
- We will assume that the size of the IP header is 20 bytes
بايت 2533بايت يعني الداتا الفعلية اللي موجودة فيها 2433الداتاجرام حجمها
بايت اللي هيا اكبر حجم 633بايت معناها الداتا الفعلية هيا MTU =033وحجم ال
الوحدة fragment مسموح الي انقلها في ال
Flag Offset
(8 bytes) ID Data length
(bytes) Fragment
number
1 0 422 680 1
1 680/8 = 85 422 680 2
1 (680+680)/8=170 422 680 3
0 (680+680+680)/8=255 422 340 4
- fragment offset must be a multiple of 8-byte.
- n = number of fragments
- d = total data
- m = maximum data size
General form: n= |‾ d/m ‾| = |‾ 2380/680 ‾| = |‾ 3.5 ‾| = 4
So we need 4 fragments.
: Offset 8متغير بيشوف كم حجم الداتا اللي تم نقلها مسبقا بوحدة ال-bytes
: More Flag بما معناه انو لسه ضايل داتا ماعدا اخر مرة بيكون 1دايما بيكون
زيرو بما يعني انو الداتا خلصت
18
Networks Discussion Eng. Wafaa Audah
P.26 Consider the network shown below, and assume that each node
initially knows the costs to each of its neighbors. Consider the distance-
vector algorithm and show the distance table entries at node z.
L (z) P L (y) P L (w) P L (v) P L (u) P L (t) P M Step
8 x-z 6 x-y 6 x-w 3 x-v ∞ - ∞ - x 1
8 x-z 6 x-y 6 x-w 3 x-v 6 x-v-u 7 x-v-t xv 2
8 x-z 6 x-y 6 x-w 3 x-v 6 x-v-u 7 x-v-t xvu 3
8 x-z 6 x-y 6 x-w 3 x-v 6 x-v-u 7 x-v-t xvuw 4
8 x-z 6 x-y 6 x-w 3 x-v 6 x-v-u 7 x-v-t xvuwy 5
8 x-z 6 x-y 6 x-w 3 x-v 6 x-v-u 7 x-v-t xvuwyt 6
8 x-z 6 x-y 6 x-w 3 x-v 6 x-v-u 7 x-v-t xvuwytz 7
وبنحط الكوست تبعها xنحل بنشوف مين المتصلين مباشرة بالنود اول ما نبدا
عطول في الجدول وغير هيك ايا نودز مش متصلة بنحطلها انفينيتي
بحيث Mبنشوف مين من النودز الموجودين الكوست تبعها اقل شي وبنضمها ل
اني اتحرك من خاللها مجموعة النودز اللي تم زيارتها واللي بامكاني Mتمثل
بس بقدر اوصل لمين وهيك في xيعني اول صف في الجدول بنحكي من خالل
بقدر اوصل لمين وبنضل ماشيين في كل الخطوات x,vالصف التاني من خالل
زي هيك نشوف االقل ونضيفو للجدول ومابنرجع نطلع عالنود بعد مانضيفها عال
M وفي حال تساوي قيمتين لنودز . ولخلص بنثبت الكوست تبعها الخر الجد
نفس الكوست ايا شي yو wو uال : بناخد ايا وحدة فيهم زي هادي مسال
.فيهم مابيفرق
في كل مرة انا بقارن الكوست الجديد اللي بيطلع معي والخاص بنود معينة
باللي موجود مسبقا مابغير في الجدول القيمة اال لو كانت القيمة الجديدة اقل
leastالقيمة الموجودة اصال بالجدول النو احنا معنيين بالحصول على من
cost\shortest path
حتى لو Mبنضل ماشيين في الجدول لحد مايسير كل النودز موجودين في
الحظنا انو االجابات ثبتت وبالمقابل ممنوع نزيد خطوة بعد ما يسير كل النودز
".^_^ ا مش ضروري نحطها بالجواب ازا بدنا نتأكد نتأكد بمخن" Mفي ال
19
Networks Discussion Eng. Wafaa Audah
P.28 Consider the network fragment shown below. x has only two
attached neighbors, wand y. w has a minimum-cost path to destination u
(not shown) of 5, and y has a minimum-cost path to u of 6. The complete
paths from wand y to u (and between w and y) are not shown. All link
costs in the network have strictly positive integer values.
a. Give x's distance vector for destinations w, y, and u.
b. Give a link-cost change for either c(x, w) or c(x,y) such that x will
inform its neighbors of a new minimum-cost path to It as a result of
executing the distance-vector algorithm.
Lh (y) P Lh (x) P Lh (v) P Lh (u) P h
∞ - ∞ - ∞ - ∞ - 0
∞ - 2 z-x 6 z-v ∞ - 1
5 z-x-y 2 z-x 5 z-x-v 7 z-v-u 2
5 z-x-y 2 z-x 5 z-x-v 6 z-x-v-u 3
5 z-x-y 2 z-x 5 z-x-v 6 z-x-v-u 4
المسموح التحرك فيهم للوصول hops فكرة الحل هنا بتعتمد على زيادة عدد
وفي كل مرة .... او... او ... او 1او 0للنودز ففي كل مرة بنشوف لو كان
بقدر اوصل للنودز وبجيب " اللينكات" hopsبنشوف هل من خالل هادا العدد من
الكوست وزي ماشفنا في الدايجسترا انو لو الكوست الجديد اقل في كل مرة
لحد ما يبطل hopsوبنوقف زيادة عدد ال من الموجود بنغير غير هيك ال
عندي تغيير يعني لما اوصل اطول باث بين ايا نودز بيكون وقتها خلص انتهى
الحل
20
Networks Discussion Eng. Wafaa Audah
See You at Next lecture
Best Wishes
a. Dx(w) = 2, Dx(y) = 4, Dx(u) = 7
" Dx(u) = min(x-u = x-w + x-u = 2+5=7 , x-y + y-u=4+6 = 10) = 7 "
b. First consider what happens if c(x,y) changes:
- If c(x,y) becomes larger ( بمقدار كممش مهم أكبر ), c(x,u) remains 7
.
- If c(x,y) becomes smaller (الزم نحدد رح تقل بمقدار كم او شو الحد):
y وبما انو احنا بنغير في wحسب التعامل مع 7بما انو الكوست لحتى اآلن
1ثابتةومحتاجة y-u =6عاعتبار انو 1رح يكون الفرق اللي رح يعمل التغيير هوا
:عشان هيك 0توصل لحتى
- If c(x,y) =δ<1, then the least cost path now passes through y and
has cost δ+6.
-
- Now consider if c(x,w) changes. If c(x,w) becomes smaller ( مش
then the least-cost path to u continues to ,(مهم أصغر بمقدار كم
pass through w and its cost changes to 5 + ε.
-
- If c(x,w) = δ > 5, then the least cost path now passes through y
and has cost 10.
-
اللي هيا خاصة 10يعني محتاجين تكون اقل من w بما انو احنا بنغير في ال (
( 5هيا 13لل wيعني اللي رح يوصل ال 5ثابتة انها w-uواحنا عنا yب
21