Bài giảng Mạng máy tính - Chương 4: The network layer and Internetworking - Nguyễn Trung Dũng
• The BOOTP server generates the BOOTP reply which contain its’ answer.
• It broadcasts the response to all the hosts.
• The workstation receives the answer and set its IP address
Dynamic host configuration protocol (DHCP) is the successor to BOOTP. Unlike BOOTP, DHCP
allows a host to obtain an IP address dynamically without individual profile that the network
administrator having to set up for each device. All that is required when using DHCP is a
defined range of IP addresses on a DHCP server. The major advantage that DHCP has over
BOOTP is that it allows users to be mobile. DHCP offers a one to many ratio of IP addresses and
that an address is available to anyone who connects to the network.
DHCP uses the same message structure of BOOTP, with some extentions (subnet
masks, etc.) The idea is that the entire network configuration of a computer can be
obtained in one message.
52 trang |
Chia sẻ: hachi492 | Ngày: 06/01/2022 | Lượt xem: 362 | Lượt tải: 0
Bạn đang xem trước 20 trang tài liệu Bài giảng Mạng máy tính - Chương 4: The network layer and Internetworking - Nguyễn Trung Dũng, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
28-May-09
1
Chapter 4
The Network Layer &
Internetworking
Content
• Internetworking
• The Network Layer in the Internet
• Network Layer Design Issues
• Routing Algorithms
• Congestion Control Algorithms
28-May-09
2
Internetworking
• Overview
• How Networks Differ ?
• How Networks Can Be Connected ?
• Concatenated Virtual Circuits
• Connectionless Internetworking
• Tunneling
• Internetwork Routing
• Fragmentation
Overview
28-May-09
3
How Networks Differ ?
How Networks Can Be Connected ?
28-May-09
4
Concatenated Virtual Circuits
Connectionless Internetworking
28-May-09
5
Tunneling
Internetwork Routing
28-May-09
6
Routed versus Routing
• Routed protocol: used at the network layer that transfer data from one host to another
across a router
• Routing protocols: allow routers to choose the best path for data from source to destination
• Examples: Internet Protocol (IP); Novell's Internetwork Packet Exchange (IPX); DECnet,
AppleTalk, Banyan VINES, and Xerox Network Systems (XNS).
Routing protocol
• Provides processes for sharing route information
• Allows routers to communicate with other routers to update and maintain the
routing tables
• Examples: Routing Information Protocol (RIP), Interior Gateway Routing Protocol
(IGRP), Open Shortest Path First (OSPF), Border Gateway Protocol (BGP), and
Enhanced IGRP (EIGRP)
28-May-09
7
Path Determination
• Path determination enables a router to compare the destination
address to the available routes in its routing table, and to select the
best path
• Static or Dynamic routing
Transportation Analogy
28-May-09
8
The Routing Process
Routing Table
28-May-09
9
Information in Routing Table
• Protocol type – The type of routing protocol that created the
routing table entry
• Destination/next-hop associations – These associations tell a
router that a particular destination is either directly connected to
the router, or that it can be reached using another router called
the “next-hop” on the way to the final destination
• Routing metric – Different routing protocols use different routing
metrics.
• Outbound interfaces – The interface that the data must be sent
out on
Routing Algorithms & Metrics
• Design goals of Routing Protocols
– Optimization
– Simplicity & Low Overhead
– Robustness & stability
– Flexibility
– Rapid Convegence
• Some metrics used by Routing Protocols:
– Bandwidth
– Delay
– Load
– Reliability
– Hop count
– Ticks, cost
28-May-09
10
IGP and EGP
• Autonomous system is a network or set of networks under common administrative control.
An autonomous system consists of routers that present a consistent view of routing to the
external world.
• Interior Gateway Protocols (IGP): route data within an autonomous system. Eg: RIP and
RIPv2; IGRP; EIGRP; OSPF; IS-IS;
• Exterior Gateway Protocols (EGP): route data between autonomous systems. Eg: BGP
Link state and Distance Vector
• The distance-vector routing approach determines the
distance and direction, vector, to any link in the
internetwork. Routers using distance-vector algorithms
send all or part of their routing table entries to adjacent
routers on a periodic basis. This happens even if there
are no changes in the network. Eg: RIP, IGRP, EIRP
• Link state routing protocols send periodic update at
longer time interval (30’), Flood update only when there
is a change in topology. Link state use their database to
creat routing table. Eg: OSPF, IS-IS
28-May-09
11
Routing Protocols
• RIP:distance vector; uses hop count as its metric; RIP
cannot route a packet beyond 15 hops. RIPv1 requires all
devices in the network use the same subnet mask. RIPv2
supports VLSM.
• IGRP:distance-vector; routing protocol developed by Cisco.
IGRP can select the fastest path based on delay,
bandwidth, load, and reliability. It also has a much higher
maximum hop count limit than RIP.
• OSPF
• IS-IS
• EIGRP
• BGP
Fragmentation
Transparent and Non-Transparent Fragmentation
28-May-09
12
The Network Layer in the Internet
• TCP/IP model
• Internet Protocol (IP)
• Addressing
• IP Address
• Internet Control Protocols
o Internet Control Message Protocol
o ARP - Address Resolution Protocol
o RARP, BOOTP, and DHCP
• OSPF - Interior Gateway Routing Protocol
• BGP - Exterior Gateway Routing Protocol
• Internet Multicasting
• Mobile IP
• IPv6
TCP/IP
IP
TCP UDP
Ethernet PPP HDLC ...
HTTP SMTP SNMP ...
28-May-09
13
Internet Protocol (IP)
o Connectionless: Different packets may take different paths to get
through the network; reassembled at the destination, the
destination is not contacted before a packet is sent.
o Connection-oriented: A connection is established between the
sender and the recipient before any data is transferred.
The IPv4 header
28-May-09
14
The IPv4 header
• 4 bits
• Indicates version of IP used
• IPv4: 0100; IPv6: 0110
The IPv4 header
• 4 bits
• Indicates datagram header length in 32 bit words
28-May-09
15
The IPv4 header
• 8 bits
• Specifies the level of importance that has been
assigned by upper-layer protocol
The IPv4 header
• 16 bits
• Specifies the length of the entire packet in bytes,
including data and header
28-May-09
16
The IPv4 header
• 16 bits
• Identifies the current datagram
The IPv4 header
• 3 bits
• The second bit specifies if the packet can be fragmented; the
last bit specifying whether the packet is the last fragment in a
series of fragmented packets.
28-May-09
17
The IPv4 header
• 13 bits
• Used to help piece together datagram fragments
The IPv4 header
• 8 bits
• Specifies the number of hops a packet may travel. This number
is decreased by one as the packet travels through a router
28-May-09
18
The IPv4 header
• 8 bits
• Indicates which upper-layer protocol, such as TCP(6) or
UDP(17), receives incoming packets after IP processing has
been completed
The IPv4 header
• 16 bits
• Helps ensure IP header integrity
• Not caculated for the encapsulation data
28-May-09
19
The IPv4 header
• 32 bits
• Specifies the sending node IP address
The IPv4 header
• 32 bits
• Specifies the receiving node IP address
28-May-09
20
The IPv4 header
• Variable length
• Allows IP to support various options, such as security
The IPv4 header
• Variable length
• Extra zeros are added to this field to ensure that the
IP header is always a multiple of 32 bits.
28-May-09
21
The IPv4 header
• Variable length up to 64 Kb
• Contains upper-layer information
• For any two systems to communicate, they must be able to identify and locate
each other. We call it “addressing”.
• The hosts are “grouped” into networks. In the illustration, we use the A or B to
identify the network and the number sequence to identify the individual host.
• The combination of letter (network address) and the number (host address)
create a unique address for each device on the network.
Addressing
28-May-09
22
• An address generally represents the connection to the network. A device that
have two connection points may need two addresses beloging to two
networks.
• Each connection points (espcially in LAN technologies) also has its ID
(example: MAC address) which is called physical address. There is also the
need to map between physical adresses (layer 2) and logical addresses (layer
3).
Addressing
• Every IP address has two parts. One part identifies the network where the system is
connected, and a second part identifies that particular system on the network.
• Two different networks must have different network address (net-id), and two
different hosts in the same network must have different host address (host-id). Of
cause, hosts in the same network have the same network address.
Addressing Rule
28-May-09
23
IP Address (IPv4)
28-May-09
24
When all host-bits are zeros, we have a number that represents
network address. This address is reserved, namely it cannot be
assigned to any host.
Network Address
• When host-bits are all one, we have a number that represents
broadcast address. This address is also reserved, namely it cannot be
assigned to any host.
• Example where Broadcast addresses are used: a host need to locate a
specific service.
Broadcast Address
28-May-09
25
Unicast and Broadcast Transmission
Unicast transmission Broadcast transmission
The concept of unicast and broadcast transmission exist in both
layer 2 and layer 3 protocols. There are refelections in the
addressing scheme
Certain host addresses are reserved and cannot be assigned to devices on a network.
These reserved host addresses include the following:
– Host-bits = all zeros (network address);
– Host-bits = all ones (broadcast address);
– Network-bits = all ones;
– Network-bits = all zeros;
– 127.x.x.x (loopback address = 127.0.0.1).
Reserved IP Address
28-May-09
26
• The stability of the Internet depends directly on the uniqueness of publicly used
network addresses.
• In the figure, there is an “IP conflict” issue.
• A procedure was needed to make sure that addresses were in fact unique. Originally, an
organization known as the Internet Network Information Center (InterNIC) handled this
procedure. InterNIC no longer exists and has been succeeded by the Internet Assigned
Numbers Authority (IANA).
Required Unique Address
• Public IP addresses are unique. No two machines that connect to a public network can have
the same IP address.
• Public IP addresses must be obtained from an Internet service provider (ISP) or a registry at
some expense.
• With the rapid growth of the Internet, public IP addresses were beginning to run out (IP
address depletion).
• New addressing schemes, such as classless interdomain routing (CIDR) and IPv6 were
developed to help solve the problem. Private IP addresses are another solution.
Public IP Addresses
28-May-09
27
• RFC 1918 sets aside three blocks of IP addresses for private, internal use. These
three blocks consist of one Class A, a range of Class B addresses, and a range of
Class C addresses.
• Addresses that fall within these ranges are not routed on the Internet backbone.
Internet routers immediately discard private addresses.
Private IP Addresses
• When addressing a nonpublic intranet, a test lab, or a home network, we
normally use private addresses instead of globally unique addresses.
• Private addresses can be used to address point-to-point serial links without
wasting real IP addresses.
• Connecting a network using private addresses to the Internet requires
translation of the private addresses to public addresses. This translation
process is referred to as Network Address Translation (NAT).
Using Private Addresses
28-May-09
28
Introduction to Subnetting
• Subnetting is another method of managing IP addresses. This method of
dividing full network address classes into smaller pieces has prevented
complete IP address exhaustion.
• The network is no longer limited to the default Class A, B, or C network masks
and there is more flexibility in the network design.
• Analogy: telephone.
• Subnet addresses include the network portion, plus a subnet field and a host
field.
• To create a subnet address, a network administrator borrows bits from the
host field and designates them as the subnet field.
Reason for Subnetting
28-May-09
29
Establishing SM address
The number of bits in the subnet will
depend on the maximum number of
hosts required per subnet.
The subnet mask: using binary ones in
the host octet(s)
(2 power of borrowed bits) – 2 = usable subnets
(2 power of remaining host bits) –2= usable hosts
Applying the Subnet Mask
28-May-09
30
The Logical ANDing process
• ANDing is a binary process by which the router calculates the
subnetwork ID for an incoming packet
• ANDding process is handled at the binary level
• (IP address) AND (subnetmask address) = subnetwork ID (router uses
that information to forward the packet across the correct interface)
Practice
Router1
LAN4
LAN5
LAN7LAN2
LAN1 LAN8
Switch1
WAN
S0/1
S0/0
F0/0 F0/0
Loopback2 Loopback7
DNS Server
DHCP
Server1
PC2
Router2
Switch2
TFTP
Server
DHCP
Server2
WEB Server1
(www.cisco.com)
Loopback3LAN3
LAN6
Loopback6F0/1 F0/1
PC1 PC3 PC4
Switch3 Switch4
28-May-09
31
IPv4 and IPv6 Addresses
IPv4
32-bit
IPv6
128-bit
IPv4 and IPv6
4.3 e 9 IP addresses
3.4 e 38 IP addresses
28-May-09
32
Internet Control Protocols
• ICMP - Internet Control Message Protocol
• ARP - Address Resolution Protocol
• RARP, BOOTP, and DHCP
ICMP - Internet Control Message Protocol
28-May-09
33
ARP
The issue of address mapping between level-2 and level-3 addresses are
quite relevent. In TCP/IP communication, a host needs to know both IP
address and MAC address of the destination host in order to send packet to
it. So there comes Address Resolution Protocol (ARP) which helps hosts in the
same LAN segments to find each other MAC addresses.
Proxy ARP
Communications among LAN segments have an additional task. TCP/IP has a
variation on ARP called Proxy ARP that will provide the MAC address of an
intermediate device (example router) for transmission outside the LAN to
another network segment.
28-May-09
34
• Some devices keep the IP-MAC mapping in
a so-called ARP table which is stored in
RAM.
• Example: arp -a, arp -d *.
• When a devices needs to send data to a
host --whose IP is known but MAC is
unknown-- it send an ARP request as a
broadcast frame. Then the destination
reply with ARP reply.
• Another way to build ARP table is to
monitor the traffic.
• Router generally do not forward such the
broadcast. If this feature is turned on, a
router performs a Proxy ARP.
• However, in reality, we apply the default
gateway feature. When the destination
host is of the different network, then the IP
packet is sent to the default gateway (MAC)
while IP address is set to the final
destination.
• If there is neither default gateway nor
Proxy ARP, no traffic can leave the local
network.
ARP
Please remember that both ARP and RARP
use the same message structure.
Packet Propagation and Switching
28-May-09
35
Router Protocol Stripping
Router Protocol Stripping
28-May-09
36
Router Protocol Stripping
Router Protocol Stripping
28-May-09
37
Router Protocol Stripping
Router Protocol Stripping
28-May-09
38
Router Protocol Stripping
Router Protocol Stripping
28-May-09
39
Router Protocol Stripping
Encapsulation changes in a Router
28-May-09
40
Routing vs. Switching
Switching occurs at Layer 2, routing occurs at Layer 3.
Routing and switching use different information in the
process of moving data from source to destination
Switching and Layer 2 Routing
28-May-09
41
ARP table and Routing table
Router and Switch
• Each computer and router interface maintains an ARP table for Layer 2
communication. The ARP table is only effective for the broadcast domain
(or LAN) that it is connected to
• MAC addresses are not logically organized, but IP addresses are
organized in a hierarchical manner
28-May-09
42
Obtaining IP Addresses
Devices come with MAC addresses (layer-2). However, IP addresses (layer-3) require
proper configuration. There are basically two ways to obtain IP addresses: static and
dynamic.
Static assignment works best on small,
infrequently changing networks. The
system administrator manually assigns
and tracks IP addresses for each
computer, printer, or server on the
intranet. Good recordkeeping is critical
to prevent problems which occur with
duplicate IP addresses.
28-May-09
43
RARP
Reverse Address Resolution Protocol (RARP) associates a known MAC addresses
with an IP addresses. This association allows network devices to encapsulate data
before sending the data out on the network. A network device, such as a diskless
workstation, might know its MAC address but not its IP address. RARP allows the
device to make a request to learn its IP address.
RARP
Operation:
1: ARP request
2: ARP response
3: RARP request
4: RARP response
5: Dynamic RARP request
6: Dynamic RARP response
7: Dynamic RARP error
8: InARP request
9: InARP response
ARP and RARP share the
same packet format, which is
encapsulated on layer-2
frames. They differentiate
themselves by the
“operation” field.
28-May-09
44
RARP
• Hardware Type specifies a hardware interface type for which the
sender requires a response (ie. ~layer 2).
• Protocol Type specifies the type of high level protocol address the
sender has supplied (ie. ~layer 3).
RARP
• HLen: Hardware address length.
• PLen: Protocol address length.
28-May-09
45
RARP
• Sender Hardware Address: Hardware address of the sender.
• Sender Protocol Address: Protocol address of the sender.
• Target Hardware Address: Hardware address of the targer.
• Target Protocol Address: Protocol address of the target.
RARP
• The workstation boots, and then generates an RARP request.
• It broadcasts the request to all hosts (using layer-2 broadcast address).
• All other host discard the request, except the RARP server, who accepts it.
I needs
an IP
address!
28-May-09
46
RARP
• The RARP server generates the RARP response which contain its’ answer.
• It broadcasts the response to all the hosts.
• The workstation receives the answer and set its IP address.
Thanks. From
now on, I am
192.168.10.36
Here it is:
192.168.10.36!
BOOTP
The bootstrap protocol (BOOTP) operates in a client-server environment and only requires a
single packet exchange to obtain IP information. However, unlike RARP, BOOTP packets can
include the IP address, as well as the address of a router, the address of a server, and
vendor-specific information, etc. BOOTP is encapsulated on UDP datagram.
28-May-09
47
BOOTP
• Op: Message operation code; can be BOOTREQUEST or BOOTREPLY.
• Htype: Hardware address type.
• HLen: Hardware address length.
• Hops: Clients place zero, this field is used by BOOTP server to send request to another
network.
BOOTP
• Xid: Transaction ID
• Seconds: Seconds elapsed since the client began the address
acquisition or renewal process.
28-May-09
48
BOOTP
• Ciadder: Client IP address.
• Yiadder: “Your” (client) IP address.
• Siadder: IP address of the next
server to use in bootstrap.
• Giadder: Relay agent IP address used in
booting via a relay agent.
• Chadder: Client hardware address.
BOOTP
• Server Host Name: Specifies
particular server to get BOOTP
information from.
• Boot File Name:Alow multiple boot files
(example: for different OSes).
• Vendor Specific Area: Optional vendor
information that can be passed to the host.
28-May-09
49
BOOTP
• The workstation boots, and then generates an BOOTP request.
• It broadcasts the request to all hosts (IP source address = unknown).
• All other host discard the request, except the BOOTP server, who accepts it.
I needs
an IP
address!
BOOTP
• The BOOTP server generates the BOOTP reply which contain its’ answer.
• It broadcasts the response to all the hosts.
• The workstation receives the answer and set its IP address.
Thanks. From
now on, I am
192.168.10.36
Here it is:
192.168.10.36!
I keep a profile
for each clients:
IP=..., MAC=...
IP=..., MAC=...
IP=..., MAC=...
28-May-09
50
DHCP
Dynamic host configuration protocol (DHCP) is the successor to BOOTP. Unlike BOOTP, DHCP
allows a host to obtain an IP address dynamically without individual profile that the network
administrator having to set up for each device. All that is required when using DHCP is a
defined range of IP addresses on a DHCP server. The major advantage that DHCP has over
BOOTP is that it allows users to be mobile. DHCP offers a one to many ratio of IP addresses and
that an address is available to anyone who connects to the network.
client server
request
client server
request
client server
request
request
RARP BOOTP DHCP
DHCP
DHCP uses the same message structure of BOOTP, with some extentions (subnet
masks, etc.) The idea is that the entire network configuration of a computer can be
obtained in one message.
28-May-09
51
DHCP
• The laptop boots, and then generates an DHCP request.
• It broadcasts the request to all hosts (to discover who is the server).
• All other host discard the request, except the DHCP servers, who accept it.
I needs
an IP
address!
Both of us are
supposed to
receive DHCP
messages.
DHCP
• The DHCP servers generates the DHCP offers which contain its’ answer.
• It broadcasts the response to all the hosts.
• The laptop receives the answers, select one of them (the first one).
OK, I accept
one offer of
yours.
My offer is:
192.168.10.35!
My offer is:
blah blah!
28-May-09
52
DHCP
• The laptop sends DCHPREQUEST addressed to the specific DHCP server that has
sent the accepted offer.
Here’s my
DHCPREQUEST,
specifically for you.
Good, got
it!
DHCP
• The DHCP server sends the DHCPACK
• And the laptop sets the IP address accordingly.
Thanks! From now
on I am
192.168.10.35!
Here is
the ACK
Các file đính kèm theo tài liệu này:
- bai_giang_mang_may_tinh_chuong_4_the_network_layer_and_inter.pdf