Tải bản đầy đủ
4 Layer 3 ¡ª network layer and network layer addresses
Basic data networks and protocols
through his letter box (or alternatively: it gets lost somewhere or for some other reason cannot
The main advantage of a connectionless-network service is that the sender need not wait
for the receiver to be ready and the network need not be encumbered with the extra effort
of setting up a connection. The message, called a packet or datagram is simply despatched.
Since a single packet or datagram (for example, containing a single data file) represents the
entire content of many data communications ‘messages’, it is easier to treat the datagram like
a postal telegram and route it from node to node along its path to the destination based upon
the network address appearing in the header (the equivalent of the telegram’s envelope). The
disadvantage is that the sender gets no clear guarantee or confirmation of message delivery.
The sender is left in doubt: Did the receiver get the message? — Were they simply too lazy
to reply? Or did the receiver not get the message? Was the address not written correctly?
Theoretically, the multiple packets making up a large message, when sent in a connectionless manner, may take different paths through the network to the destination. This would
make it very difficult for ‘eavesdroppers’ to intercept the entire message, so making the communication more ‘secure’. This idea appealed to the military users who were some of the
first users of IP (Internet protocol). On the other hand, the different routes of the different
packets usually lead to different propagation delays and so, in turn, can lead to complications
in the communication between the two end-points. In practice, this is overcome by the use of
deterministic or path-oriented routing (all packets are routed along the same path). But where
this is used (nearly always), the ‘security’ benefit is lost.
One of the important distinctions between connection-oriented and connectionless networks
is the type of device used as a network node in the respective networks. In connection-oriented
networks, it is normal to refer to the network nodes as switches and to the function they carry
out as switching. A switch switches a connection. In contrast, connectionless networks have
no connections to be switched. The nodes of a connectionless network, usually called routers,
merely route and forward datagrams (like the ‘sorters’ in a postal network).
Connection-oriented and connectionless networks have very different strengths and weaknesses. And since we shall concentrate in this book most on the connectionless ways of IP,
let us take just a few moments to consider the comparative strengths of connection-oriented
switching — and I make no apologies for doing so!. While some readers may consider X.25,
frame relay, ATM (asynchronous transfer mode) and other connection-oriented protocols as
only of ‘historic’ significance (i.e., overtaken and replaced by IP-suite protocols), this ignores
their continuing widespread use — including in the backbone of some IP-networks! Not only
this, but the principles (and even the details!) of the protocol operation of connection-oriented
packet-switching (as developed for X.25, frame relay and ATM) are nowadays being adopted
into the IP-suite protocols. The following brief discussion of connection-oriented packet
switching and X.25 will help us later to understand the motivation for using a connectionoriented transport layer protocol in the IP suite: TCP (transmission control protocol). It will
also lay the foundations for understanding MPLS (multiprotocol label-switching). Both TCP
and MPLS are discussed in more detail in Chapter 7.
Circuit-switched, X.25-packet, frame relay and ATM networks are
connection-oriented data networks!
The distinguishing property of a circuit-switched network is the existence throughout the
communication phase of the call, of an unbroken physical and electrical connection between
origin and destination points. The connection is established at call set-up and cleared after the
call. The connection may offer either one direction (simplex) or two direction (duplex) use.
Telephone networks are said to be circuit-switched networks and are also connection-oriented.
Layer 3 — network layer and network layer addresses
Conversely, although X-25-12 and frame relay-based13 packet-switched networks are also
connection-oriented, an entire and exclusive physical connection from origin to destination
will not generally be established at any time during communication. This may seem confusing
at first, but is important to understand, since it is at the root of how a connection-oriented data
networking protocol works. The important point about connection-oriented network services
(CONS) is that a connection set-up phase confirms the readiness of the receiver to receive
information and determines the route through the network which will be used to carry the
packets before data transfer commences. The connection which results is actually termed a
logical channel, virtual circuit (VC) or virtual channel, since though it appears to the two endusers as though a dedicated (‘virtual’) path exists, the physical connection is actually shared
with other users. Bandwidth is only consumed when an actual packet needs to be conveyed.
Historically, circuit-switched networks (providing connections for users’ exclusive use)
were considered necessary when very rapid or instantaneous interaction was required (as is
the case with speech or live video). Conversely, packet-switched networks (both connectionoriented ones such as X.25 and frame relay, as well as connectionless networks such as those
based on IP) are more efficient when instantaneous reaction is not required, but when very
low ‘corruption’ of data is paramount.
Cell-switching (as used in ATM — asynchronous transfer mode)14 is a specialised connectionoriented form of packet switching in which the packet lengths are standardised at a fixed
length. Cell switching (also called cell relay switching) was developed by ITU-T as the basis of
the broadband integrated services digital network (B-ISDN) and ATM (asynchronous transfer
mode). It is intended to carry high bit rate mixed voice, data and video (so-called multimedia) signals.
Logical channels, relaying and tag- or label-switching
A special mechanism is usually built into connection-oriented network protocols to cater
efficiently for the needs of statistical multiplexing. The packets of the various different endusers and their connections have to be ‘labelled’ in an efficient manner in order that they do not
get mixed up with one another en route. In the case of the X.25-packet switching protocol, this
is done by labelling each packet sent during the data transfer phase of a particular connection
with the same logical channel number (LCN). In the case of other protocols, a range of other
names are used to describe the ‘label’, but all have a similar function. Example label names are:
• logical channel number (LCN) (X.25 layer 3 protocol);
• data link connection identifier (DLCI) (frame relay protocol);
• virtual path identifier(VPI)/virtual channel identifier(VCI) (ATM, asynchronous transfer
• tag (IP tag-switching);
• label (MPLS, multi-protocol label switching).
It is important to understand how logical channels (and their above-listed equivalents) are
used and thus how label switching works, since it is used in the design of connection-oriented
data switches and routers to improve their data throughput capacity. The logical channel
number or label is usually allocated only for the duration of a connection at the time of the
See Appendix 8.
See Appendix 9.
See Appendix 10.
Basic data networks and protocols
Note:* Logical channel numbers on each link do not share the same value.
Figure 3.23 Layer 3 addresses: Logical channels and network addresses.
connection- or call-set-up. It provides for fast identification (and thus for fast-switching) of
packets belonging to a given connection.
Let us study the connection from end-user device A to end-user device B in Figure 3.23.
The connection traverses two switches (Switch 1 and Switch 2). There are thus three separate
links or ‘hops’ along the route. Each of these links or hops represents a network interface
(e.g., UNI, NNI, etc). For each network interface, a logical channel number (LCN) or othernamed label is allocated and ‘tagged’ to each of the packets traversing the connection. Thus
the end-to-end connection of our example comprises three separate logical channels (one for
each of the network interfaces), concatenated end-to-end. On the first (end-user device A to
Switch 1) logical channel 2 is allocated. On the inter-switch trunk, logical channel number 7
is allocated, and from Switch 2 to end-user device B, logical channel 4 is allocated.
During the data transfer phase (of the call or connection), the switches revert to providing
a switching or relaying service as follows. Switch 1 switches or relays packets with the
‘logical channel number 2’ (from end-user device A) to the ‘logical channel 7’ on the trunk to
Switch 2. Similarly, Switch 2 only needs to switch or relay ‘logical channel 7’ on the trunk to
‘logical channel 4’ on the end-user connection. This switching or relaying can be performed
by specialised hardware. This has significant advantages for the design and performance of
the switch hardware.
We shall assume that in the example of Figure 3.23 there are a maximum of 8 logical
channels on each of the three data links, each represented by a logical channel number between
0 and 7, and represented therefore by a three- logical channel number (LCN). The relaying
procedure need only study this relatively short address and be aware of the pre-determined
‘next hop’ and ‘next logical channel’ of the connection to which it must switch. For this
purpose very fast hardware and software can be designed. This specialised hardware and
software can perform a lot faster by restricting itself to relaying than rather than having to
perform a ‘look-up’ of the [60 or more bit-] destination network address for each packet to
be forwarded. The importance of this relaying technique is underlined in its recent adoption
as part of the modern IP (Internet Protocol)-based techniques called tag switching, MPLS
(multi-protocol label switching) and IP version 6 (IPv6). (More on this subject in Chapter 7.)
The logical channel numbers are allocated at the time of connection set-up. End-user
device A may have selected the preferred logical channel number ‘2’ on the first link. Switch
1, meanwhile, allocated logical channel number ‘7’ on the middle link of the connection, and
Layer 3 — network layer and network layer addresses
Switch 2 allocated logical channel 4 on the last link. The basis of the choice of logical channel
might have been simply the ‘next free one available’ or ‘the one best-suited to the type of
connection requested by the caller’. Usually, only a limited number of logical channels are
available at each network interface. This depends upon the number of labels made available in
the protocol and reflects the limitations posed by the hardware design of the network switches
or end-devices. There is a limited amount of storage capacity and number of different data
buffers which can be assured to serve multiple simultaneous connections!
The network address 15 of the destination needs to be identified to each of the two switches
in our example of Figure 3.23 only during the connection set-up phase. The network address
allows each switch or router to select the most appropriate ‘next hop’ of the connection. After
the decision, a logical channel number (or label) for the next hop is allocated and the connection is switched through. The network address is signalled to switches or routers by means of
the layer 3 (network) protocol, using a call or connection set-up procedure. However, once the
data transfer phase of the connection commences, the network address is no longer required and
the subsequent user data packets ‘transferred’ do not include it. Instead, the packets are merely
labelled with the (much shorter) logical channel numbers (LCN) or other label equivalent.
Layer 3 (network) protocol control information (PCI) and frame structure
The protocol control information (PCI) necessary for, and the procedures undertaken by
connection-oriented packet networks differ greatly from those of connectionless networks.
In particular, in connectionless routing, each packet sent from the source to the destination
must be labelled with the full network address of the destination and must be routed and
forwarded separately by intermediate routers according to this address.
Next, we shall use the X.25 layer 3 packet-format here to illustrate the functions of a
connection-oriented protocol. Afterwards we will compare how this differs with the format
and function of a connectionless protocol, using IP (Internet protocol) as our main example.
IP itself will be covered in detail in Chapter 5.
X.25-layer 3 packet format and protocol
The X.25-protocol is a network (layer 3) protocol used between peer devices at the UNI (usernetwork interface) of a public packet-switched data network (often called an X.25 network
or packet-switched network ). Imagine that the DTE of Figure 3.1 is ‘talking’ to the network
(DCE) using the X.25 layer 3 protocol to tell the first node in the network how to handle
the X.25 calls. The protocol handlers in the DTE and in the first switch node in the packet
network are peer partners, there being a network interface between them.
Being a connection-oriented protocol, X.25 (ITU-T recommendation X.25) defines distinct
procedures for signalling and data transfer during the various phases of the call, including:
• call request and connection set-up;
• data transfer, including flow control;
The network address (the layer 3 address) is the unique address identifying the network port to which the
destination device — end-user device B (see Figure 3.23) — is attached. (It should not be confused with the
layer 2 and MAC-addresses we spoke of earlier). The network address is usually a lengthy number. International
telephone numbers, for example, may be up to 15 digits long. Coding each decimal digit as a 4-bit binary coded
decimal (BCD) number, the network address is a total of 60 bits long. Internet addresses (which are examples
of network addresses) usually comprise a 32-bit main address and up to 32 bits of subaddress (64 bits in total).
And the ever increasing demand for more numbers means that we can only expect network addresses to get
even longer than 64 bits (8 bytes). IPv6 address, as we shall see in Chapter 5, are 128 bits long!
Basic data networks and protocols
• supervision, including retransmission, interrupt, reset, restart, registration and diagnostics; and
• call clearing (once communication is finished).
Before being able to communicate across a packet-switched-network, an X.25 DTE first has
to signal its desire for a connection to be set-up. For this purpose the DTE generates an X.25
call request packet which includes all the information needed by the network ‘control point’
to set up the connection (including called address (the B-end destination), calling address (the
A-end origin of the call), features, facilities and network services needed for the connection
and any related call user data. The DTE selects the preferred logical channel number (LCN)
it would like to use for the call, signalling this in the call request packet (Figure 3.24). This
logical channel is then put in the DTE-waiting state, while the network node (i.e., DCE)
decides what to do next.
During the DTE-waiting period, the network node uses its internal routing table to determine the best route to the indicated called address, and continues the call set-up procedure
by negotiating with nodes further along the connection. When all the nodes have mutually
‘agreed’, the connection of the various links and nodes to the destination can be established. At this point, the DCE sends a call accept packet back to the DTE and data transfer
During data transfer, a much simpler packet can be sent (Figure 3.25), including only
the general format identifier (bits Q, D and modulo), the logical channel number (LCN),
comprising the 4-bit logical channel group number (LCGN) and the 8-bit logical channel
number (LCN), the user data and the packet type, which during data transfer contains nothing
more than the send and receive packet sequence numbers, P(S) and P(R), as used for data
flow control. The Q-bit (qualifier bit) distinguishes user data packets from control packets.
You may wonder why there is a similar data flow control mechanism (using sequence
numbers) to that implemented in layer 2 protocols. Why do we need a second one, you may
ask? This lies in the use and meaning of the D-bit (delivery confirmation bit) in the first
Figure 3.24 X.25 call request packet format (call set-up phase).
Layer 3 — network layer and network layer addresses
Figure 3.25 X.25 Data packet format (data transfer phase).
byte of the packet.16 Set at D = ‘1’, this bit indicates that the local DTE wishes to receive a
confirmation from the remote DTE of the receipt of a given packet on an ‘end-to-end’ basis.
In other words, the layer 3 flow control mechanism is acknowledging packets received across
the entire end-to-end connection across the network.
More details of the X.25 protocol and packet format appear in Appendix 8.
Connectionless layer 3 protocols — the internet protocol (IP)
The principle difference between connectionless networks and connection-oriented ones is
that a connectionless network has to handle and forward each packet of data (each message)
separately. There is no ‘stream’ of messages passing between the two same end-points making up a virtual circuit. As far as a connectionless network is concerned, no two messages
are related, each individual packet must have its destination network address inspected and
each must be routed individually. Consequently, the nodes in connectionless networks are
usually called routers. Both the Internet and IP (Internet protocol) are based on connectionless networking.
A layer 3 (network) protocol intended to support connectionless network service (e.g., IP)
differs from a layer 3 protocol such as X.25 intended to support connection-oriented switching.
Instead of there being a distinct two-phase establishment of communication (first, connection
set-up and then an optimised data transfer phase using logical channels), there is only one
routing function and a single packet-format. If you like, each packet has to be built like a call
request packet of X.25, but with the entire user data (a much larger field) already attached
to it. There is no confirmation or acceptance of the connection, merely a forwarding of each
The process of confirmation is occurring by means of a ‘cascaded’ process across each of the interfaces of
the network, not necessarily using identical packet sequence numbers at each of the interfaces along the way.
Remembering the delay problems we discussed in conjunction with Figure 2.28, you can imagine how careful
we have to be in setting the layer 3 window size, for now the unacknowledged packets are spread all along
Basic data networks and protocols
packet to the next hop. Many more details of the exact IP (Internet protocol) packet formats
and protocol procedures follow in Chapter 5.
Route selection and routing tables
No matter whether a connection-oriented or a connectionless network protocol is in use in
a data network, each network node relies on an internal routing table to determine the most
appropriate next hop (i.e., next link and next node) towards the destination, as identified
by the destination network address. Figure 3.26 illustrates an example network in which 5digit network addresses are in use. Thus all addresses in the range 001XX (e.g., 00146) are
located on node A. Similarly the ports with addresses in the range 091XX are connected
to node F. The diagram shows possible routing tables (for use in nodes A and B) for each
of the six available number ranges. For each number range, the routing table provides first,
second and third choice routes.17 The first choice route will always be selected, provided
that it is both available (i.e., in operation rather than in a faulty state) and not already overloaded with traffic. Should the first choice route be unavailable or congested, then the second
choice route will be taken. And if this in turn is also unavailable or congested, then the third
choice route will be used. Only if all three routes are busy or unavailable will the connection
The process of looking an address up in a routing table involves comparing the first few
digits of the destination network address with the entries in the routing table. The routing
table entries are normally listed in ascending numerical order (as in Figure 3.26). The routing
table entry which provides the nearest match (to the most number of leading digits) is used
to determine the appropriate route (i.e., next hop).
Figure 3.26 Network routing tables and associated considerations.
In many routers only a first choice route is saved in the routing table. The best second choice route is
calculated only following the failure of the first choice route.
Layer 4 — transport layer protocol
The three greatest challenges faced when creating routing tables are:
• determining the full list of reachable addresses and keeping this permanently up-to-date;
• creating a routing algorithm (calculation procedure) for ensuring the most efficient overall
use of the network when working out the best routes to each individual destination; and
• avoiding network instability, which might occur if different nodes chose routes uncoordinated with their neighbours. Examples of instabilities are circular routing and route flapping.
Figure 3.26 illustrates how easy it is to introduce the possibility of circular routing. Consider
a call being made to the network address range 069XX located on node E. The routing table
at B for reaching node E is: first choice via D, second choice via A. There could also have
been a third choice via C (in case the link BD was congested). Now let us consider routes
from node A to node E: first choice direct, second choice via D, third choice via B. This all
seems to make sense! But what happens in the case that node D fails? First: calls from B to
E are routed via A to E. But maybe link AE becomes congested as a result, causing A to
select its third choice route to E — via B! Now circular routing occurs: B will select A as
the next hop to reach E, but node A will decide subsequently to route the call back to B. B,
of course, sends back to A and so on ad infinitum, until either the caller ‘hangs up’ or until
either link AE or node D recovers. In the meantime, the AB link rapidly congests, as the call
spirals between the two nodes, locking up further capacity.
Route flapping can occur in the case where routing tables are automatically updated. Automatic adjustments of routing might be undertaken in an attempt to adapt the network routing
according to current overall traffic load. Let us assume that particularly heavy traffic is affecting the route originating at node B and destined for node E. Let us further assume, that the first
and second route choices selected at node B for the address range 069XX are automatically
swapped around (to be via A second choice via D) in the case that the link BD exceeds a
certain traffic congestion level. What might happen in practice? Answer: all the traffic from
B to E is first routed via D and loaded onto link BD. The traffic congestion threshold is
reached on this link, so the first choice of node B for address range 069XX is changed to
be ‘via node A’. Immediately all the traffic routes via node A, so link BD becomes virtually
free again — and the first choice route reverts back to be via link D. Subsequently, the route
continues switching from ‘via D’ to ‘via A’ ad infinitum (until the overall traffic drops). This
is called route flapping. It is dangerous because it leads to very unpredictable traffic flows
across the individual links of the network.
In public telephone networks, it is normal to establish the routing tables manually — working out the network address ranges which need to be reachable and determining the best
outgoing route to reach them. Data networks, on the other hand, have traditionally been
designed to work the routing tables out for themselves. This requires an automatic mechanism
allowing network nodes to inform one another of the exact whereabouts of each destination
network range or even individual network address. This is the domain of routing protocols and
routing algorithms, examples of which are RIP (routing information protocol), OSPF (open
shortest path first) and BGP (border gateway protocol). We shall detail the precise functioning
of these protocols and the operational network management problems which they bring in
3.5 Layer 4 — transport layer protocol
The transport layer (layer 4) protocol is responsible for providing network-independent communication services between computer applications running in end-user terminals. In theory,
data communication (i.e., transport of data) may have to traverse different networks along
Basic data networks and protocols
the way. The transport layer in this case has to ensure the coordination and control of all the
various networks and arrange communication end-to-end. The transport layer provides what
is correctly called the transport service.
The most commonly used transport protocols nowadays are TCP (transmission control
protocol) and UDP (user datagram protocol). Both of these protocols are normally used in
conjunction with IP (Internet protocol)18 based networks. TCP is said to provide a reliable
transport service, and works as a connection-oriented transport service (COTS). The reliable
and connection-oriented nature of TCP/IP gives it similar properties to an X.25 network. Note
how X.25 did not need a transport layer to achieve this — users of X.25 typically use a null
layer at the transport layer. UDP, meanwhile, is unreliable and is based on a connectionless
transport service. Unlike TCP, UDP is unable to guarantee delivery of the message, but UDP
is efficient in the use of the network for lower priority and short messages, since it requires
much less protocol control information (PCI). In other words, it uses a shorter packet header.
One often speaks of UDP being a ‘best effort’ protocol.
Peer-to-peer communication at the transport layer usually takes place between peer partner
software applications running in the two end-user computing devices. At the originating end,
the transport layer organises a ‘connection’ on behalf of the computer application, thereby
isolating the application completely from the constraints of the network or networks over which
the data will be carried. The transport layer need only be informed by the application of the
destination network address and software application (i.e., the peer partner — for example,
the IP address of the destination device to which data is to be transported).
As necessary, the transport layer may split up a long stream of data into separate packets
or individual messages and organise for these to be transported over one or more different
networks and paths to the destination (Figure 3.27). This is important when using IP networks,
since each packet is carried at the IP level as if it were a completely separate message.
At the destination, the separate packets are once again reassembled into the correct data
sequence. For this, the transport layer protocol uses data sequence numbers just like layer 2
and layer 3 protocols. (Yet more sequence numbers, I here you say!) These are necessary for
the reassembly process — helping ensure that packets which travelled via different networks
are reassembled in order. In addition, the transport layer (as also at layers 2 and 3) provides
for flow control and error correction on an application-to-application basis.
You may be wondering why each protocol layer appears to have yet another provision
for sequence numbers, flow control and error correction. The simple answer is that each
progressively higher layer may have to coordinate multiple networks or datalinks of the layer
beneath it, and has a responsibility to ‘bring this all together’ as a single, coordinated service.
Figure 3.27 Transport layer functions of multiplexing and splitting.
TCP is also well suited to use with frame relay.