Sunteți pe pagina 1din 8

1.1 What is a network?

Put simply, a network is a collection of devices that share a common communication


protocol, and a common communication medium (such as network cables, dial-up
connections, or wireless communication). I say devices, and not computers, even though
most people think of a network as being a collection of computers. In most cases these
devices are in fact computers, and it’s often simpler to think of networks as being made
up of only network servers and desktop machines.

However, a network is not made up solely of computers. There’s a whole lot more to the
average network, the sort of behind-the-scene things that one does not immediately
notice. For example, printers may be shared across a network, allowing more than one
machine to gain access to their services. Other types of devices can also be connected to a
network; these devices can provide access to information, or offer services that may be
controlled remotely. Indeed, there’s a growing movement towards connecting non-
computing devices to networks. The most famous example is the soda machine that is
connected to the Internet, so that people can see how many cans of a certain flavor of
drink are available. Indeed, as home networks become simpler to use and more
affordable, we may even see regular household appliances such as telephones, televisions
and home stereo systems connected to local networks or even the Internet. To say that
networks are merely a collection of computers is to limit the range of hardware that can
use a network.

Beyond devices that provide services, there are the devices that keep the network going.
There’s a lot more going on behind the scenes of a network than you might expect.
Depending on the complexity of a network, and its physical architecture, you’ll find other
networking devices like network cards, cables, routers, hubs and gateways that form part
of a typical network. Don’t worry if these terms aren’t familiar – they’re fairly simple to
understand: -

• Network cards are hardware devices added to a computer to allow it to


talk to a network. The most common network card in use today is an
Ethernet card. Network cards usually connect to a network cable, which is
the link to the network and the medium through which data is transmitted.
However, other mediums exist, such as dial-up connections through a
phone line, or wireless communication.

• Routers are machines that act as switches. These machines direct packets
of data to the next hop in their journey across a network.

• Hubs provide connections that allow multiple computers to access a


network (for example, allowing two desktop machines to access a local
area network).
• Gateways connect one network to another, for example a local area
network to the Internet.

While it is useful to understand such networking terminology, as it is widely used in


networking texts, and protocol specifications, we as programmers don’t always need to
be concerned with the implementation details of a network, and its underlying
architecture. However, it is important, to be aware that networks are made up of more
than just computers.

1.2 How do networks communicate?


Networks consist of connections between computers and devices. These connections are
most commonly physical connections, like wires and cables, through which electricity is
sent. However, many other mediums exist. For example, it is possible to use infrared and
radio as a communication medium for transmitting data wirelessly, or fiber-optic cables
that use light rather than electricity.

Such connections carry data between one point in the network and another. This data is
represented as bits of information (either on or off, a zero or a one). Whether through a
physical medium such as a cable, through the air, or using light, this raw data is passed
across different points in the network. We call these points ‘nodes’, and a node could
represent a computer, another type of hardware device such as a printer, or a piece of
networking equipment that relays this information onward to other nodes in the network,
or even to an entirely different network. Of course, for data to be successfully delivered
to a node, there must be a way of identifying individual nodes.

1.2.1 Addressing
Each node in a network is usually represented by an address, just as your home or office
has a street number, suburb, and zip code. The manufacturer of the network interface card
(NIC) installed in such devices, is responsible for ensuring that no two card addresses are
alike, and chooses a suitable addressing scheme. Each card will have this address stored
permanently, so that the address remains fixed – you cannot manually assign these
addresses or modify them, though some operating systems will allow faking of these
addresses in the event of an accidental conflict with another card’s address.

Since there are a wide variety of different networking interface cards, many different
addressing schemes are used, and these can be of various lengths. For example, Ethernet
network cards are assigned a unique 48-bit number to distinguish one card from another.
Usually, a numerical number is assigned to each card, and manufacturers will be
allocated batches of numbers. This must be strictly regulated by industry, of course – two
cards with the same address would cause headaches for network administrators. The
physical address is referred to by many names (some of which are specific to a certain
type of card, while others are more general), including: -
Hardware address
Physical address
Ethernet address
Media Access Control (MAC) address
NIC address

These addresses are used to send information to the right node – if two nodes shared the
same address, they might be competing for the same information and one would
inevitably lose out, or two would receive the same data. Often machines are known by
more than one type of address as well – a network server may have a physical Ethernet
address as well as an IP address that distinguishes it from other hosts on the Internet, or it
may have more than one network card.

Within a local area network, machines can use physical addresses to communicate.
However, since there are many types of these addresses, they aren’t appropriate for inter-
network communication. As you’ll see later in the chapter, the Internet Protocol (IP)
address is used for this purpose.

1.2.2 Data transmission using packets


Now, in order to send information from a node to another node, an address is needed.
However, sending individual bits of information is not very cost effective as there is a fair
bit of overhead involved with sending this address information every time a byte of data
is ready. Most networks, instead, group data into packets. Packets consist of a header and
data segment, as shown in Figure 1-1. The header contains addressing information (such
as the sender, and the recipient), checksums to ensure that a packet has not been
corrupted, as well as other useful information that is needed for transmission across the
network. The data segment contains sequences of bytes, which is the actual data being
sent from one node to another. Since the header information is only needed for
transmission, applications are only interested in the data segment. Ideally, you’d want to
combine as much data into a packet as possible, to minimize the overhead of the headers.
However, if information needs to be sent quickly, packets may be dispatched when nearly
empty. Depending on the type of packet and protocol being used, packets may also be
padded out to fit a fixed length of bytes.

Figure 1-1. Pictorial representation of a packet header

When a node on the network needs to transmit a packet, there is usually not a direct
connection to the destination node. Instead, intermediary nodes carry packets from one
location to another, and this process is repeated indefinitely until the packet reaches its
destination. Due to network conditions (such as congestion or network failures) packets
may take completely different routes, and sometimes packets may be lost in transit or
arrive out of sequence. This may seem like a chaotic way of communicating, but as you’ll
learn in later chapters, there are ways to guarantee delivery and sequencing. Indeed, the
properties of guaranteed delivery, and sequential order, often aren’t even needed by
applications, as software itself can keep track of lost packets and out-of-sequence data.

Packet transmission and transmission of raw bits of information are very low-level
processes, while most network programming deals with higher-level transmission of data.
Rather than covering the gamut of transmission from raw bytes through to packets, and
then on up to actual program data, it is simpler to split these different types of
communication into layers.

1.3 Communication across different layers


Because networking theory can be so complex, the concept of layers was introduced. The
most popular approach to network layering is the Open Systems Interconnection (OSI)
model, created by the International Standards Organization (ISO). This model groups
network operations into seven different layers, from the most basic physical layer through
to the application layer, where software applications such as web clients and email
servers communicate.

Let’s examine the OSI model, and its various layers. Under the OSI model,
communication is grouped into seven separate layers. Each layer can be referred to by
number, or by a descriptive name. Generally, when network programmers refer to a
particular layer (e.g. Layer n), they are referring to the nth layer of the OSI model. Each
of the seven layers is illustrated in Figure 1-2
Figure 1-2. Seven layers of the OSI Reference Model

Each of the layers is responsible for some form of communication task – but each task is
narrowly defined, and usually relies on the services of one or more layers beneath it. In
some systems, one or more layers may be absent, while in other systems all layers may be
used. Frequently though, only a subset of the seven layers is used by an operating system.
Generally, we as programmers limit ourselves to working with one layer at a time, and
use of many of the layers below are hidden from view.

1.3.1 Layer 1 - Physical Layer


The physical layer is networking communication at its most basic level. When we talk
about the physical layer, this means the very lowest form of communication between
network nodes. At this level, networking hardware, such as cards and cables, transmit a
sequence of bits between two nodes. No Java programmer will ever have to work at this
level – this is the domain of hardware driver developers and electrical engineers. At this
layer, no real attempt is made to ensure error-free data transmission. Errors can occur for
a variety of reasons, such as a spike in voltage due to interference from an outside source,
or line noise in networks that use analog transmission mediums.

1.3.2 Layer 2 – Data link Layer


The data link layer is responsible for providing a more reliable transfer of data, and for
grouping data together into frames. Frames are very similar to data packets, but are
blocks of data specific to a single type of hardware architecture (whereas data packets are
used at a higher level, and can move from one type of network to another). Frames have
checksums to detect errors in transmission, and usually a start and end marker to show
hardware the division between one frame and another. Sequences of frames are
transmitted between network nodes, and if a frame is corrupted it will be discarded. The
data link layer helps to ensure that garbled data frames won’t be passed to higher layers,
confusing applications. However, the data link layer doesn’t normally guarantee
retransmission of corrupted frames – higher layers normally handle this behavior.

1.3.3 Layer 3 – Network Layer


Moving up from the data link layer, which sends frames over a network, we reach the
network layer. The network layer deals with data packets, rather than frames, and
introduces several important concepts like the network address, and routing. Packets are
sent across the network, and in the case of the Internet, all around the world. Unless
traveling to a node in an adjacent network where there is only one choice, these packets
will usually travel different routes (the route is determined by special network devices,
called routers). Communication at this level is still very low-level, and few network
programmers would write software services for this layer.

1.3.4 Layer 4 – Transport Layer


The fourth layer, the transport layer, is concerned with controlling how data is
transmitted. This layer deals with issues such as automatic error detection and correction,
and flow control (limiting the amount of data sent to prevent overload).

1.3.5 Layer 5 – Session Layer


The purpose of the session layer is to facilitate application-to-application data exchange,
and the establishment and termination of communication sessions. Session management
involves a variety of tasks, including establishing a session, synchronizing a session and
re-establishing a session if abruptly terminated. Not every type of application will need
this type of service, as the additional overhead of connection-oriented communication
can increase network delays and bandwidth consumption. Some applications will instead
choose to use a connectionless form of communication.

1.3.6 Layer 6 – Presentation Layer


This layer deals with data representation and data conversion. Different machines use
different types of data representation (an integer might be represented by eight bits on
one system and sixteen bits on another). Some protocols may want to compress data, or
encrypt it. Whenever data types are being converted from one format to another, the
presentation layer handles these types of tasks.

1.3.7 Layer 7 - Application Layer


The final OSI layer is the application layer, which is where the vast majority of
programmers write code. Application layer protocols dictate the semantics of how
requests for services are made, such as requesting a file or checking for email. In Java,
almost all network software written will be for the application layer, though the services
of some lower layers may be called upon.

1.4 Advantages of layering


The division of network protocols and services into layers not only helps simplify
networking protocols by breaking them into smaller, more manageable units, but also
offers greater flexibility. By dividing protocols into layers, protocols can be designed for
interoperability. Software that uses Layer n can communicate with software running on
another machine that supports Layer n, regardless of the details of Layer n-1, Layer n-2,
and so on. Lower level layers, for example, can be substituted and replaced without
having to modify or redesign higher-level layers, or recompile application software. For
example, a network layer protocol can work with an Ethernet network and a token ring
network, even though at the physical and data-link layers, two different protocols and
hardware devices are being used. In a world of heterogeneous networks, this is an
important quality as it makes networks interoperable.

This section briefly describes some guidelines for hierarchical network design. Following these
simple guidelines will help you design networks that take advantage of the benefits of
hierarchical design.
The first guideline is that you should control the diameter of a hierarchical enterprise network
topology. In most cases, three major layers are sufficient:

1. The core layer


2. The distribution layer
3. The access layer

Controlling the network diameter provides low and predictable latency. It also helps you
predict routing paths, traffic flows, and capacity requirements. A controlled network diameter
also makes troubleshooting and network documentation easier.

Finally, one other guideline for hierarchical network design is that you should design the
access layer first, followed by the distribution layer, and then finally the core layer. By starting
with the access layer, you can more accurately perform capacity planning for the distribution
and core layers. You can also recognize the optimization techniques you will need for the
distribution and core layers.

S-ar putea să vă placă și