Introduction to TCP/IP Networks

advertisement
Introduction to TCP/IP Networks
Dr Moroney
Contents
Introduction to TCP/IP Networks ................................................................................................................. 1
Introduction ................................................................................................................................................... 3
Operational Terms .................................................................................................................................... 3
Address ................................................................................................................................................. 3
Subnet ................................................................................................................................................... 3
Subnet mask .......................................................................................................................................... 3
Interface ................................................................................................................................................ 3
Protocol Stacks for TCP/IP and the OSI Reference Model ...................................................................... 3
TCP/IP Application Layer - Purpose .................................................................................................... 4
TCP/IP Host-to-Host Transport Layer - Purpose .................................................................................. 4
Internet Layer – Purpose ....................................................................................................................... 5
Network Interface Layer - Purpose ....................................................................................................... 6
Protocols for different layers .................................................................................................................... 6
Application Layer Protocols ................................................................................................................. 7
Internet Layer Protocols ........................................................................................................................ 9
Network Interface Layer Protocols ..................................................................................................... 10
IP addressing ........................................................................................................................................... 10
Class A IP Addresses .......................................................................................................................... 11
Class B IP Addresses .......................................................................................................................... 11
Class C IP Addresses .......................................................................................................................... 11
Class D ................................................................................................................................................ 12
Class E ................................................................................................................................................ 12
Further Restrictions on IP Addresses ...................................................................................................... 12
Network ID Guidelines ....................................................................................................................... 12
Subnets .................................................................................................................................................... 13
Page
Glossary .................................................................................................................................................. 14
1
Book References ..................................................................................................................................... 13
By the end of this article you will be able to answer each of the following questions
1. Solve the following subnetting problems
a. Identify the network and host ID for each of the following IP addresses and subnet
masks.
i. 116.27.123.32
255.255.0.0
ii. 168.174.9.63
255.255.128.0
iii. 147.125.177.12
255.240.0.0
(6 marks)
b. Divide the address range 172.72.64.0 /19 into 3 equally sized subnets.
i. What will the new subnet mask be?
ii. How many usable host addresses will be on each subnet?
iii. What will the network addresses be?
iv. What will the broadcast addresses be?
(7 marks)
c. A new and exciting start-up company from Barnsley named “Magic Balloons inc”
requires a new network. It is going to use the address range 123.123.12.192 /26 to
provide for the following:
● 12 PCs for management
● 27 PCs for sales
● 5 PCs for clowns and unicyclists
Outline a plan to subnet the network, giving the network address, broadcast address,
subnet mask and number of usable addresses (including the default gateway) for each
subnet.
(8 marks)
d. Should they use switches or hubs to connect the devices together? Justify your
answer.
(4 marks)
2. Answer the following
a. Discuss the differences between crossover and straight-through cables in Ethernet
networks. When should each be used?
(5 marks)
b. What hardware would you need to configure VLANs on a network? Describe how
you would go about configuring the hardware to support VLANS
(9 marks)
c. What are the two different kinds of addresses used by devices on an Ethernet
network? Describe the purpose and structure of both types of address and explain
why two different kinds are needed
(8 marks)
Page
2
d. Name the 7 layers of the OSI model and state where the two address types from part
c may be found.
Introduction
This document describes IP addressing and subnetting as it applies to the configuration of a local area
network. It also looks at the protocols used at different layers of the TCP/IP protocol stack.
Operational Terms
The following four terms are defined here as they are crucial to an understanding of how networks work.
Address
This is a unique four part number ID that is assigned to either a host or an interface in a network. For
example, a host computer (a computer on the network) might have IP address 192.168.10.100. An IP
address has two parts: The network id and the host id. To identify the network id and the host id we need
to refer to the subnet mask.
Subnet
A subnet is a portion of a network sharing a particular subnet mask. The computers in a subnet have
addresses in a clearly defined range.
Subnet mask
A subnet mask is used to define the format and range of subnet addresses. A “standard” class C subnet
mask is represented as 255.255.255.255/24.
Interface
An interface is a network connection. It is usually a router port with an assigned IP address.
One of the reasons why many people find networking difficult to learn is that it can be
a very complicated subject. One of the chief reasons for this complexity is that
networks consist of so many hardware and software elements. While a network user
may only perceive that he or she is using one computer program (like a Web browser)
and one piece of hardware (like a PC), these are only parts of a much larger puzzle.
In order for even the simplest task to be accomplished on a network, dozens of
different components must cooperate, passing control information and data to
accomplish the overall goal of network communication.
http://www.tcpipguide.com/free/t_NetworkingLayersModelsandArchitectures.htm
Protocol Stacks for TCP/IP and the OSI Reference Model
Application Layer (HTTP, POP3, SMTP)
Host-to-Host Transport Layer (TCP, UDP)
Internet Layer (IP)
OSI
7. Application Layer
6. Presentation Layer
5. Session Layer
4. Transport Layer
3. Network Layer
Page
TCP/IP
3
TCP/IP stands for Transmission Control Protocol/Internet Protocol, which is a set of networking
protocols that allows two or more computers to communicate (https://kb.iu.edu/d/abkr)
Network Interface Layer (Ethernet, PPP, T1)
2. Data Link Layer
1. Physical Layer
TCP/IP Application Layer - Purpose
The TCP/IP application layer corresponds to layers 5, 6 and 7 on the OSI model. This TCP/IP layer is
primarily concerned with how software applications are to interact with each other. That is to say it is to
do with things like how data will be encoded, compressed or otherwise formatted before it is sent over the
Internet. Thus, the HTTP protocol defines how webpages are to be represented as data to be sent in
packets, and how such packets might be reconstituted when they are received by a destination computer.
Similarly, POP3 and SMTP define how email messages are formatted before being sent in packets to and
from computers.
TCP/IP Host-to-Host Transport Layer - Purpose
The purpose of the host-to-host transport layer is to define how data is to be sent from one computer to
another, and whether or not any checking will be done to see that transmitted packets are received
accurately.
The host-to-host transport layer has two alternate protocols that define the transfer of packets of data from
one computer to another. These TCP/IP protocols are UDP (User Datagram Protocol) and TCP
(Transmission Control Protocol).
UDP is a very simple protocol. It defines how data packets are sent but doesn’t prescribe any processes or
procedures to verify that packets have been received intact. For example, there is nothing in the protocol
to say that a packet should be resent if it is not received. Figure 1 presents the 5 parts of a UDP message.
Note that the Data (payload) for a UDP packet will be defined by an application layer protocol. Note that
a port is an application programming interface. A port will be assigned by the operating system for data
coming in across the network that is destined for use by a specific application. The software will “listen”
to the port and when data arrives this will be used by the relevant application. An application will use a
second port for sending data to a remote destination. Each application will use one or more different
ports. Email programs typically use ports 25 and 110.
Figure 1. UDP packet structure (http://www.tcpipguide.com/free/t_UDPMessageFormat.htm)
Page
4
Note that a datagram specifies source and destination port numbers. Some common UDP applications
and port assignments are specified in Figure 2.
Figure 2. UDP applications and port assignments
Some other important port assignments follow here. Note that SMTP is on port 25 and POP3 is on 110
(both used for email). It is important to configure applications so that they each application uses unique
ports. When two different applications use the same port then this causes a network conflict that prevents
communication for both applications.
21: File Transfer Protocol (FTP)
22: Secure Shell (SSH)
23: Telnet remote login service
25: Simple Mail Transfer Protocol (SMTP)
53: Domain Name System (DNS) service
80: Hypertext Transfer Protocol (HTTP) used in the World Wide Web
110: Post Office Protocol (POP3)
119: Network News Transfer Protocol (NNTP)
143: Internet Message Access Protocol (IMAP)
161: Simple Network Management Protocol (SNMP)
194: Internet Relay Chat (IRC)
443: HTTP Secure (HTTPS)
465: SMTP Secure (SMTPS)
8443: Router remote access
Internet Layer – Purpose
The Internet Layer protocol (IP) is at the heat of the TCP/IP protocol suite. IP defines network layer addresses
Page
5
that identify any host or router interface that connects to a TCP/IP network. Any interface that expects to receive IP
packets needs an IP address.
IP is responsible for defining a number of important network functions. Much of the following few
paragraphs can be attributed to:
Some of the specific jobs normally performed by the network layer include:
o
Logical Addressing: Every device that communicates over a network has associated with it a
logical address, sometimes called a layer three address. For example, on the Internet, the
Internet Protocol (IP) is the network layer protocol and every machine has an IP address (e.g.
192.168.10.100). Note that addressing is done at the data link layer as well, but those addresses
refer to local physical devices. In contrast, logical addresses are independent of particular
hardware and must be unique across an entire internetwork.
o
Routing: Moving data across a series of interconnected networks is probably the defining
function of the network layer. It is the job of the devices and software routines that function at the
network layer to handle incoming packets from various sources, determine their final destination,
and then figure out where they need to be sent (route) to get them where they are supposed to go.
o
Datagram Encapsulation: The network layer normally encapsulates messages received from
higher layers by placing them into datagrams (also called packets) with a network layer header.
o
Fragmentation and Reassembly: The network layer must send messages down to the data link
layer for transmission. Some data link layer technologies have limits on the length of any
message that can be sent. If the packet that the network layer wants to send is too large, the
network layer must split the packet up, send each piece to the data link layer, and then have
pieces reassembled once they arrive at the network layer on the destination machine. The IP
describes how messages are broken up into packets that are sent to a destination computer.
o
Error Handling and Diagnostics: Special protocols are used at the network layer to allow
devices that are logically connected, or that are trying to route traffic, to exchange information
about the status of hosts on the network or the devices themselves. Sometimes packets are
“dropped” and in this case there needs to be a message sent back to the source to resend.
Note, for most intents and purposes use “packet” and “datagram” interchangeably. The usual reason for
using different terms is to make it clear which TCP/IP layer is being referred to. It can be confusing when
the term packet is used for all layers as the format and content of packets is different at each layer level.
Network Interface Layer - Purpose
The bottommost layer of the Internet protocol suite (TCP/IP) is the Network Interface Layer. It defines
the software and hardware used to carry TCP/IP traffic across an underlying network technology.
Protocols for different layers
Page
6
Error! Reference source not found. presents a list of some of the protocols that are associated with the
CP/IP protocol stack.
Figure 3. TCP/IP protocols
Application Layer Protocols
The TCP/IP protocol suite presents the different protocols that are represented at each of the layers of the
TCP/IP model.
Telnet
Telnet is a protocol that allows you to connect to remote computers (called hosts) over a TCP/IP network
such as the Internet (https://kb.iu.edu/d/aayd). Telnet is often used for logging onto a remote computer
(over the internet). It is an old text based protocol that was introduced in 1969.
FTP
FTP is an acronym for File Transfer Protocol. As the name suggests, FTP is used to transfer files between
computers on a network (https://kb.iu.edu/d/aerg).
SMTP
SMTP is an acronym for Simple Mail Transfer Protocol. As the name suggests, SMTP is used to transfer
mail between computers (through an SMTP server). An SMTP server is a computer that receives
outgoing mail messages from users and routes them to their intended recipients (https://kb.iu.edu/d/aibb).
Page
7
DNS
DNS is an acronym for Domain Name System. The DNS is used to resolve host names into IP addresses
(Peterson & Davie, 2012). For example (see Figure 4), http://edtechlearn.org resolves to 66.117.4.177. It
is clearly easier for people to remember the URL than to remember the IP address. You may visit
http://edtechlearn.org.ipaddress.com/ to find the IP address of a URL.
Figure 4. DNS URL to IP address resolution
You may use tools at http://tcpiputils.com to find out information about internet web sites. As shown in
Figure 5, the address of the computer that hosts edtechlearn.org has IP address 66.117.4.177.
Figure 5. Ping for edtechlearn.org
RIP
RIP is an acronym for Routing Information Protocol.
RIP plays an important role providing the shortest and best path for data to take from node to
node. The hop is the step towards the next existing device, which could be a router, computer or
other device. Once the length of the hop is determined, the information is stored in a routing table
for future use. RIP is being used in both local and wide area networks and is generally considered
to be easily configured and implemented. (https://www.techopedia.com/definition/24846/routinginformation-protocol-rip)
Page
A network manager will often have a GUI and graphical display (of a client application) that he can use
to evaluate the network (see Figure 6). The data that is processed to produce this graphical display comes
from SNMP GET statements.
8
SNMP
SNMP is an acronym for Simple Network Control Protocol. SNMP is used in the tools used by network
managers that need to know the status and performance of different parts of a network (Peterson & Davie,
2012). SNMP serves two purposes: “SNMP is essentially a specialised request/reply protocol that
supports two kinds of request messages: GET and SET” (Peterson & Davie, 2012, p. 756).
Figure 6. Graphical user interface used by a network manager
There is a limit to what the network management software is able to find from the network. The list of
types of GET statement is listed in an MIB (management information base). For example, a “System”
GET request might ask for general parameters about a host such as where the host is located, how long it
has been up and what the name of the host is.
The SET commands place new information in the host device – basically a way of configuring a device.
Figure 7 shows how a network manager might use an SNMP SET command has been used to update the
authentication protocol to SHA1 on a target device.
Figure 7. SNMP Set commands example
Internet Layer Protocols
IP
IP is an acronym for an Internet layer protocol called the “Internet Protocol”.
Some of the specific jobs normally performed by the network layer include:
Logical Addressing: Every device that communicates over a network has associated with it a
logical address, sometimes called a layer three address. For example, on the Internet, the Internet
Protocol (IP) is the network layer protocol and every machine has an IP address (e.g.
192.168.10.100). Note that addressing is done at the data link layer as well, but those addresses
refer to local physical devices (e.g a physical address (MAC) like 2C-33-7A-4B-2F-8F ). In
contrast, logical addresses are independent of particular hardware and must be unique across an
entire internetwork.
o
Routing: Moving data across a series of interconnected networks is probably the defining
function of the network layer. It is the job of the devices and software routines that function at the
Page
9
o
network layer to handle incoming packets from various sources, determine their final destination,
and then figure out where they need to be sent (route) to get them where they are supposed to go.
o
Datagram Encapsulation: The network layer normally encapsulates messages received from
higher layers by placing them into datagrams (also called packets) with a network layer header.
o
Fragmentation and Reassembly: The network layer must send messages down to the data link
layer for transmission. Some data link layer technologies have limits on the length of any
message that can be sent. If the packet that the network layer wants to send is too large, the
network layer must split the packet up, send each piece to the data link layer, and then have
pieces reassembled once they arrive at the network layer on the destination machine. The IP
describes how messages are broken up into packets that are sent to a destination computer.
o
Error Handling and Diagnostics: Special protocols are used at the network layer to allow
devices that are logically connected, or that are trying to route traffic, to exchange information
about the status of hosts on the network or the devices themselves. Sometimes packets are
“dropped” and in this case there needs to be a message sent back to the source to resend.
Network Interface Layer Protocols
Ethernet
To be completed
Token Ring
To be completed
Frame Relay
To be completed
ATM
To be completed
MPLS
Multi-Protocol Label Switching (MPLS) is a technology that is used to reduce the
overhead that routers must deal with when they receive packets on a TCP/IP network.
Basically, once a route is determined for a set of packets heading to the same
destination then relevant packets are embedded with a code that labels each packet as
belonging to a specified route.
There are guidelines for how a network address is created for a device on a network. There are three
important classes of IP address on a TCP/IP network.
Page
Every interface (on a router) and host on a network (anything capable of sending or receiving TCP/IP
packets) has to have an IP address. An IP address is made up of 4 octets (IPV4). Each Octet is 8 bits in
size, and therefore the size of an IPv4 IP address is always 32 bits.
10
IP addressing
Class A IP Addresses
Class A addresses are used for the largest sized networks. The first bit of an address is always 0. All of
the last three octets are used for host IDs. (https://technet.microsoft.com/en-us/library/cc940018.aspx)
Example:
74.125.43.99 converts to 01001010.01111101.00101011.01100011
IP address
74.125.43.99
Octet 1
01001010
Octet 2
01111101
Octet 3
00101011
Octet 4
01100011
(http://www.miniwebtool.com/ip-address-to-binary-converter/)
Note that the first bit of the example binary address above is 0 and therefore this is a Class A address.
Since the last three octets are used for the host ID then there are 224 possible IP addresses for this network.
This means that the 74 class A network has a domain range of 16777216 addresses.
However, we must note here that some addresses (class A and otherwise) are reserved for special
purposes. For example, the class A address 127.0.0.0 is reserved as the “loopback address”.
Class B IP Addresses
Class B addresses are assigned to medium-sized to large-sized networks. The two high-order bits in a
class B address are always set to binary 1 0. The next 14 bits (completing the first two octets) complete
the network ID. Class B network numbers range from 128.0.0.0 to 191.255.0.0, for a total of 214 networks. The remaining
16 bits (last two octets) represent the host ID. This allows for 16,384 networks and 65,534 hosts per
network. Within each network there is a range of 16384 IP addresses.
Example of a class B IP Address.
129.3.50.101 = 10000001.00000011.00110010.01100101
IP address
129.3.50.101
Octet 1
10000001
Octet 2
00000011
Octet 3
00110010
Octet 4
01100101
The first two octets (red) define the network and the last two octets (green) define the host ID. Notice
that the first two bits are “10” as they need to be for a class B address.
Compared to a class A network there are far fewer host addresses available. This being said there are still
enough addresses (16384 IP addresses) for a large network.
Class C IP Addresses
Page
The three high-order bits in a class C address are always set to binary 1 1 0. The next 21 bits (completing
the first three octets) complete the network ID. The remaining 8 bits (last octet) represent the host ID.
This allows for 2,097,152 networks and 254 hosts per network.
11
Class C addresses are used for small networks. These addresses are the most important for to know about
as these are the addresses that are to be used in a SOHO network.
Example
192.168.10.101 = 11000000.10101000.00001010.01100101
IP address
129.3.50.101
Octet 1
11000000
Octet 2
10101000
Octet 3
00001010
Octet 4
01100101
As the above example indicates, there can be very many different small networks connected together, but
within one network the range of IP addresses is limited to 255. Of the addresses that are valid class C
addresses, some are reserved and cannot be assigned to any device.
Please do refer to the Microsoft information page (https://technet.microsoft.com/enus/library/cc940018.aspx) for a thorough explanation of the different address classes as well as various
reserved addresses.
Address Class
Class A
Class B
Class C
First Network ID
1.0.0.0
128.0.0.0
192.0.0.0
Last Network ID
126.0.0.0
191.255.0.0
223.255.255.0
Class D
Class D addresses are reserved for IP multicast addresses. The four high-order bits in a class D address
are always set to binary 1 1 1 0. The remaining bits are for the address that interested hosts recognize.
Microsoft supports class D addresses for applications to multicast data to multicast-capable hosts on an
internetwork.
Class E
Class E is an experimental address that is reserved for future use. The high-order bits in a class E address
are set to 1111.
Further Restrictions on IP Addresses
Network ID Guidelines
The network ID identifies the TCP/IP hosts that are located on the same physical network. In a
SOHO the network ID is the first three octets of an IP address. All hosts on the same physical
network must be assigned the same network ID to communicate with each other. Usually
the network ID will begin with 192.168.XX.aa (class C addresses) for a SOHO network.
The network ID must be unique to the IP internetwork. If you plan on having a direct
routed connection to the public Internet, the network ID must be unique to the Internet. If
Page

12
Follow these guidelines when assigning a network ID:



you do not plan on connecting to the public Internet, the local network ID must be unique
to your private internetwork.
The network ID cannot begin with the number 127. The number 127 in a class A address
is reserved for internal loopback functions.
All bits within the network ID cannot be set to 1. All 1's in the network ID are reserved
for use as an IP broadcast address.
All bits within the network ID cannot be set to 0. All 0's in the network ID are used to
denote a specific host on the local network and are not routed.
Subnets
A subnet is a group of computers within a larger network. For example, all the computers in an
administration department may be brought together as a subnet that has a specific range of IP addresses
associated with it. One reason for wanting to subnet is that if an organisation has multiple networks then
each would need a separate router interface if it is to connect to the internet. This creates a certain
amount of router processing overhead that can be avoided by subnetting. Typically all the computers in a
subnet are in the same geographical area. For example, a subnet might include all the computer in a
design department, and computers in the finance department have a separate subnet.
Without subnets, an organization could get multiple connections to the Internet, one for each of its
physically separate subnetworks, but this would require an unnecessary use of the limited number of
network numbers the Internet has to assign. It would also require that Internet routing tables on gateways
outside the organization would need to know about and have to manage routing that could and should be
handled within an organization.
Subnetting is achieved by changing the subnet mask. For example, Table 1 shows that if we wanted to
divide our network into two subnets then we would use the subnet mask 255.255.255.128.
Table 1. Subnet masks for class C network addresses
Required Number of Subnets Number of Subnet Bits
Subnet Mask
Number of Hosts per Subnet
1-2
1
255.255.255.128 or /25 126
3-4
2
255.255.255.192 or /26 62
5-8
3
255.255.255.224 or /27 30
9-16
4
255.255.255.240 or /28 14
17-32
5
255.255.255.248 or /29 6
33-64
6
255.255.255.252 or /30 2
For further information about subnets: https://technet.microsoft.com/en-us/library/cc958834.aspx
Page
Peterson, l., & Davie, B. (2012). Computer networks: a systems approach (5th ed.). Burlington, MA:
Morgan Kaufmann.
13
Book References
Glossary
Broadcast address -- An IP address with a host portion that is all ones.
Host -- A computer or other device on a TCP/IP network.
Internet -- The global collection of networks that are connected together and share a common range of IP
addresses.
InterNIC -- The organization responsible for administration of IP addresses on the Internet.
IP -- The network protocol used for sending network packets over a TCP/IP network or the Internet.
IP Address -- A unique 32-bit address for a host on a TCP/IP network or internetwork.
Network -- There are two uses of the term network in this article. One is a group of computers on a single
physical network segment; the other is an IP network address range that is allocated by a system
administrator.
Network address -- An IP address with a host portion that is all zeros.
Octet -- An 8-bit number, 4 of which comprise a 32-bit IP address. They have a range of 0000000011111111 that correspond to the decimal values 0- 255.
Packet -- A unit of data passed over a TCP/IP network or wide area network.
RFC (Request for Comment) -- A document used to define standards on the Internet.
Router -- A device that passes network traffic between different IP networks.
Subnet Mask -- A 32-bit number used to distinguish the network and host portions of an IP address.
Subnet or Subnetwork -- A smaller network created by dividing a larger network into equal parts.
TCP/IP -- Used broadly, the set of protocols, standards and utilities commonly used on the Internet and
large networks.
Page
14
Wide area network (WAN) -- A large network that is a collection of smaller networks separated by
routers. The Internet is an example of a very large WAN.
Download