Вы находитесь на странице: 1из 23

T216 Cisco networking (CCNA)

Subnet 1
Introduction 2

1 Introduction to IP addressing 3

1.1 Why do addresses exist on networks? 3

1.2 The advent and application of IP addressing 5

2 The IP address classes 6

2.1 How the TCP/IP protocol identifies a class 6

2.2 How the classes of IP addresses are organised 10

2.3 Types of IP addresses 12

2.4 Uses of each IP address class 15

3 Sub-networking 15

3.1 The purpose of sub-networking 15

3.2 How subnetting is achieved 16

3.3 Identifying a sub-network address and related addresses 20

Answers to SAQs 23

Copyright © 2008 The Open University WEB 00309 7 1.1


T216 Cisco networking (CCNA)

Introduction
Understanding the structure of IP addresses and how they are used in networks is
central to being able to build and maintain local and wide area networks. As well as
carrying out the basic function of locating a host, IP addresses will also impact on the
workload of routers, network design, security and management.
This topic is covered thoroughly in the CCNA curriculum, and is further tested in the
practical session at the day school. However, determining network and host
addresses (subnetting) is a topic that needs practice.
This is the first part of two additional teaching texts that aim to give you an opportunity
to develop your understanding of IP addressing and sub-networking.

Aims
This text is in harmony with the Cisco Networking Academy™ online curriculum,
enabling you to develop your understanding and application of IP addressing and sub-
networking. Throughout this workbook is a selection of exercises that will improve
your skills for the Cisco certification exam and the commercial skills covered by the
CCNA™.

Learning outcomes
The content of this text meets the standards delivered in CCNA 1, 2 and 3, as well as
extending your knowledge base with CIDR and IPv6. The specific learning outcomes
addressed in this text are:
• an introduction to how IP addresses are used in networks
• an understanding of how IP addresses fit into the TCP/IP layered model
• an understanding of different IP address classes
• an understanding of how IP addresses can be subnetted to provide the required
number of sub-networks or hosts.

Abbreviations
IP internet protocol
TCP transmission control protocol
UDP user datagram protocol
MAC media access control
WAN wide area network
LAN local area network
OSI open systems interconnection
DEC digital equipment corporation
NIC network interface card
IEEE Institute of Electrical and Electronic Engineers
DHCP dynamic host configuration protocol
ISP internet service provider
VoIP voice over internet protocol
WAP wireless application protocol (please be aware that WAP also
denotes wireless access point)
MODEM modulator demodulator
FTP file transfer protocol

Subnet 1 | 2
T216 Cisco networking (CCNA)

TFTP trivial file transfer protocol


HTTP hyper text transfer (or transport) protocol
POP3 post office protocol version 3
SMTP simple mail transfer protocol
HTTPs hyper text transfer (or transport) protocol secure
DNS domain name server (or services)
LDAP lightweight data application protocol
ICMP internet control messaging protocol
EIGRP extended interior gateway routing protocol
OSPF open shortest path first
BGP border gateway protocol
RIP router information protocol
HSRP hot standby routing (or router) protocol
ARP address resolution protocol
RARP reverse address resolution protocol
NAT network address translation

1 Introduction to IP addressing
Whilst reading this text you may find some unfamiliar terms. That is because the
course team has assumed you have read the online curriculum.
Terms used in this text have already been introduced in the online curriculum. You
can also find them in the glossary in the online curriculum.

1.1 Why do addresses exist on networks?


As computer systems became more complex there was a need to ensure that each
unique device had an identity that was not repeated elsewhere on the system. One
solution was to use addresses physically coded into the circuitry of the connection.
This was commonplace for WAN as well as LAN connections.
Ethernet, a ‘best effort’ system devised by Xerox with DEC and Intel, used a system
that was to become known as layer 2 of the OSI model. The MAC address is
physically coded into the NIC, which resides on all computer equipment connecting to
a network.
The MAC address of your computer’s NIC is controlled by the IEEE. Each
manufacturer, such as Cisco, 3COM or LinkSys, will be issued a block of addresses
that are never to be used on more than one network device. Such addresses are ‘hard
coded’ into the various devices on manufacture.
The MAC address is a physical 48-bit address (which equates to a total of 6 bytes),
having a structure as seen in Figure 1.

Subnet 1 | 3
T216 Cisco networking (CCNA)

The MAC address is always displayed as a hexadecimal value,


so to see your computer’s MAC address open the command
prompt and type ‘ipconfig /all’

C 1 5 C 0 9 9 C 1 5 C 0

1100 0001 0101 1100 0000 1001 1001 1100 0001 0101 1100 0000

The first three bytes are the Organisational Unique The last three bytes are the unique code that is managed
Identifier, which is issued by the IEEE to the and issued to the NIC (or other networking device) by
manufacturer the manufacturer

Figure 1 MAC address structure


Note: See Cisco CCNA online curriculum, Network fundamentals, Chapter 6 for binary
to hexadecimal conversion.
Whilst effective, the MAC address system contains many drawbacks that include:
• no method of allocating addresses to devices on a LAN in a logical and meaningful
order
• no mechanism for a hierarchical structure; therefore LANs are unable to reflect the
nature of the corporation using the equipment
• a 6-byte addressing scheme, which for normal human beings was nearly
impossible to remember, therefore making management of the network more
difficult.
MAC addresses are in common use; it is likely your PDA, mobile phone and digital
set-top box, as well as your computers, all have one. MAC addressing is a powerful
tool, but a higher-level address system is needed to support the work a network does.

Exercise 1.1
First, start the command prompt on your computer (Figure 2).

If you are using Windows 2000, 2003 or XP type CMD;


otherwise you will need to enter ‘command’

Figure 2 Running the command prompt


Then, enter the command ‘ipconfig /all’ (Figure 3). You will find the MAC address, also
referred to as the physical address, which in this case is 00–11–09–7F–99–60. On the
internet, visit http://standards.ieee.org/regauth/oui/index.shtml and enter the first
six digits of your MAC address as directed by the web page to find who manufactured
your NIC. The IEEE also allows you the full list, if you wish to download it.

Subnet 1 | 4
T216 Cisco networking (CCNA)

Figure 3 Finding the MAC address

1.2 The advent and application of IP addressing


To provide a logical addressing system was the next step. Many different systems
have been tried with IP addressing, with the rapid succession of versions 1, 2 and 3
during the 1970s and early 1980s. IPv4 is the current standard, but IPv6 has been
developed and is being introduced (see Section 6 in Subnet 2).
IP addressing operates at layer 3 of the OSI model; its role is to provide a logical
addressing structure, which may be implemented by any network management. Unlike
MAC addresses, which are hard coded, the IP address is dynamic, which means:
• An IP address can be automatically assigned to a network device, when that
device accesses a system. This dynamic addressing is managed by the DHCP
protocol/server partnership.
• The address can be statically assigned, which is a permanent (but also
changeable) address, and is directly assigned to each networking device on the
system by the network management.
IPv4 is a 32-bit addressing protocol, which means that for any given LAN or WAN
infrastructure, 232 or 4 294 967 296 IP addresses are available for allocation to the
various network devices.
Naturally, for a corporate LAN or your little network at home, 4 294 967 296 addresses
are more than enough for the quantity of devices you may use. However, there are
areas where the IPv4 address range is problematic:
• ISPs need to issue a unique IP address to every user. This is limiting when you
have to consider all the servers, routers and computers accessing the internet.
This has become especially acute with the explosion in numbers of broadband and
modem users since 1995.
• Modern telecommunications and media communications companies need IP
addresses for each device accessing the system. This means that you need an IP
address for:
• each cable or satellite television outlet
• all mobile phones that are WAP-enabled
• systems that use VoIP.
• The internet is a complex WAN structure, and all networking devices directly facing
the internet require an IP address. This is the area where unused IP addresses are
rapidly diminishing, even with the allocation of addresses being tightly managed.

Subnet 1 | 5
T216 Cisco networking (CCNA)

Compared to MAC addresses, IP addresses are easier for humans to relate to. The
32-bit address structure is subdivided into four 8-bit portions called octets (an octet
being a byte of information). Figure 4 shows this structure.

Octet 1 Octet 2 Octet 3 Octet 4


1 0 1 1 1 0 1 0 1 1 0 1 0 1 1 1 1 0 1 1 1 0 0 1 1 1 1 0 1 0 0 1
186 215 185 233

Figure 4 Address structure


As the 32-bit address is separated into four octets, each with 8 bits, the range of the
octet is from 0 to 255 (28), as seen in Figure 5.

binary value

128 64 32 16 8 4 2 1

result = 0 0 0 0 0 0 0 0 0
result = 255 1 1 1 1 1 1 1 1

Figure 5 Octet range


The resulting address is in a dotted decimal notation, with each of the four numbers
being no greater than 255. This is designed to be easily understandable for humans
and, with a little practice and experience, makes IP addresses easy to remember.

Exercise 1.2
If you are on a ‘dial-up’ MODEM connection, please ensure that you are online; with a
broadband or LAN system, the connection is permanent. Turn back and repeat
Exercise 1.1, and observe how many IP addresses your connection needs in order to
operate.

2 The IP address classes


As you read in Section 1, IPv4 is a 32-bit address, which is divided into four octets.
This provides the basis for the five different classes of IP address.

2.1 How the TCP/IP protocol identifies a class


On each networking device, the TCP/IP protocol suite performs a variety of tasks,
providing resources for:
1 addressing
2 sub-networking
3 the support of routing decisions based on the network address (please do not
confuse this with actual routing)
4 connection to the upper layers of the OSI model
5 connection to the physical transmission medium via layer 2 and the MAC address
6 provision of higher-level protocols such as HTTP and FTP.
The suite itself is extensive and can be summarised in relation to the layers of the OSI
model, with IP and TCP central to the operation of the protocol suite. Figure 6 and
Figure 7 show how TCP and IP relate to other protocols within the suite.

Subnet 1 | 6
T216 Cisco networking (CCNA)

OSI layers Some TCP/IP protocols

7 Application FTP Telnet HTTP POP3 SMTP HTTPs TFTP

6 Presentation

5 Session DNS LDAP

4 Transport TCP UDP

3 Network IP ICMP EIGRP OSPF BGP RIP HSRP DHCP

2 Data link ARP RARP

1 Physical

Figure 6 Summary of the TCP/IP protocol suite


Note: you will find the names of each of these protocols in the abbreviations section at
the start of this resource.

OSI Protocol

7 FTP Telnet HTTP POP3 SMTP HTTPs TFTP

5 LDAP
DNS

4 TCP UDP

HSRP

DHCP

3 IP RIP
BGP

OSPF

EIGRP

ICMP

2 ARP RARP

Figure 7 The position of TCP and IP in the protocol suite


IP addresses operate at the core of the TCP/IP protocol suite, linking to MAC
addresses using ARP, as well as to TCP or UDP (which manage the connection from
one networked device to another).
TCP is connection-oriented, which means that during the period of data communication
the stream of packets is normally sent via one route between two connections. In
contrast, UDP is connectionless, with each device being able to send data via many
different routes and cope with data packets being received out of sequence.
Any data sent in a packet from one system to another is encapsulated (wrapped) with
header information. The header precedes the data, which enables any device using
the TCP/IP protocol suite to recognise:
• if the data is intended for the device in question
• if the device is a router, where the packet needs directing.
The term for a data packet, in TCP/IP terminology, is a datagram. Figure 8 shows the
header in a datagram.

Subnet 1 | 7
T216 Cisco networking (CCNA)

direction of data flow


Bits

00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Version IHL TOS Total length


Identification Flags Fragment offset
IP header

TTL Protocol Header checksum


Source IP address
Destination IP address
Options and padding

Source port Destination port


Sequence number
TCP header

Acknowledgement
Data offset Reserved ECN Control bits Window
Checksum Urgent pointer
Options and padding
Data

Version Whether the packet is IPv4 or IPv6


IHL Internet header length: the size of the header being received
TOS Type of service: allows prioritisation of datagrams
Total length Size of the datagram
Identification To ensure that fragments of one datagram are not confused with
those of another
Flags Can be used to prevent fragmentation; a datagram can be 65 536
bytes in length, but on a medium like Ethernet a frame must be
no more than 1514 bytes so the datagram must be fragmented
Fragment offset Used in the reassembly of fragments
TTL Time to live for the datagram: starts at 8 and if decreased to 0,
the datagram is discarded
Protocol Identifies protocol in transit, such as OSPF
Header checksum A 1’s complement checksum
Source IP address From where the datagram was sent
Destination IP address To whom it is being sent
Options and padding To ensure the header finishes in a round 32-bit pattern
Source port Originating data channel
Destination port Intended destination data channel
Sequence number The order of this datagram in the whole transmission: the first is the SYN,
and each one after it is incremented by 1; this is used for recognising if
any datagrams or fragments are lost
Acknowledgement Has the number of the next datagram in the sequence
Data offset The number of 32-bit sequences in the TCP header, to indicate where
the data begins
ECN Explicit congestion notification: for the management of data flow
Control bits All given various tasks in the management of the data transmission
Window The size of transmission the sender is willing to accept before
there is an acknowledgement packet
Checksum Another 1’s complement data check
Urgent pointer If the required control bit is set, the point locates the last byte in an urgent
datagram sequence
Figure 8 The header in a datagram

Subnet 1 | 8
T216 Cisco networking (CCNA)

When the networked device reads the incoming data, it will find near the front of the
data sequence the source IP address. Based on the class information (see Section 2.2),
the device will make one of two decisions:
1 Accept incoming packet based on class and/or sub-network mask (see Section 3).
2 Reject incoming packet based on class and/or sub-network mask.

Exercise 2.1
• Open the Start/Settings/Control Panel/Network Connections window.
• Depending on the resources you may have on your computer, right-click on your
active local area connection and select Properties.
• Double-click on the TCP/IP option.
• Ensure you take a note of the current settings, as this is your insurance that you
will be able to read your mail in five minutes’ time. It is also worth taking the time
to familiarise yourself with this dialogue and the IP address options.
These steps are shown in Figure 9.

Figure 9 Steps for Exercise 2.1

Subnet 1 | 9
T216 Cisco networking (CCNA)

Exercise 2.2
You need to be online for this exercise.
• Open the command prompt, as in Exercise 1.1.
• Enter the following command: ‘ping www.teraknor.co.uk’.
• The ping command will send an ICMP echo to the web server in question, which
will send an ICMP reply (Figure 10).

Figure 10 Window for Exercise 2.2


To check that an ARP entry has been created, enter the command ‘arp –a’. (Warning:
you must do this within 3 minutes of ping, otherwise the ARP cache will be purged by
the operating system.)
The ‘arp –a’ command will give you the MAC address of the default gateway, which is
the router/switch/proxy/firewall via which your computer has access to the internet.

2.2 How the classes of IP addresses are organised


With 32 bits for the address, the range of opportunities for address classification is
extensive. The IPv4 standard is that there are five specified classes, each based on
the most significant bit(s) in the IP address.
The definition of each class of IP address ensures that there is a specification for:
• the number of hosts per network

• the number of networks available for each class

• the method of identification for each IP address.

Figure 11 provides a comprehensive classification of all IPv4 classes.

Subnet 1 | 10
T216 Cisco networking (CCNA)

Most Number Total Total available


Class significant range for Octet 1 Octet 2 Octet 3 Octet 4 available hosts on each
bit(s) octet 1 networks network

A 0 0–127 Network Host Host Host 128 16 777 214

B 10 128–191 Network Network Host Host 16 384 65 534

C 110 192–223 Network Network Network Host 2 097 152 254

D 1110 224–239 There is no host or network portion


Class D is for multicast and unicast addresses
E 1111 240–255 Class E is experimental and therefore is not useable

Figure 11 IP address classes


The first octet is the most important in the identification of the class of address. Taking
on the information given in the ‘number range for octet 1’ column, the examples in
Figure 12 show different IP addresses for the first four classes.

Class
A B C D
1.0.2.1 128.14.21.19 192.168.0.1 224.0.0.5
10.5.45.99 172.16.12.14 195.100.0.0
69.0.224.255 191.90.254.2 223.255.255.254
126.4.0.0 160.10.0.4
99.1.1.2
100.100.100.100
Figure 12 IP address examples

SAQ 1
What is the class of each of these addresses?
1 101.0.0.0
2 129.0.0.0
3 123.0.0.0
4 191.0.0.0
5 193.0.0.0
6 1.0.0.0

The meaning of the numbers in each octet of the IP address depends on the class, as
shown in Figure 13.

Subnet 1 | 11
T216 Cisco networking (CCNA)

Class A example
provides the identity provides the identity
of the network of the host

10 5 5 1

Class B example
provides the identity provides the identity
of the network of the host

172 16 5 1

Class C example
provides the identity provides the identity
of the network of the host

192 168 5 1

Figure 13 Description of address structure

2.3 Types of IP addresses


If it seems that life is beginning to get complicated with IP addresses, now an
additional factor becomes apparent. Because of the internet, which is effectively a
public WAN, there is a need to ensure that some addresses are reserved for private
(as opposed to public) use for corporate LANs.
Each class of IP address has a range of private addresses for use within the network
by the network management of any corporate LAN (Figure 14).

Class Range Addresses

A from 10 0 0 0

to 10 255 255 255

B from 172 16 0 0

to 172 31 255 255

C from 192 168 0 0

to 192 168 255 255

Figure 14 Private IP addresses

As well as private addresses there are two other definitions of addresses for all types

of network:

1 the address for the network as a whole (network address)

2 the address that broadcasts information to the whole network (broadcast address).

The network address is a unique IP address and cannot be issued to any device on

the system. This is used:

• in the management and direction of traffic by routers in relation to the information


obtained through a routing protocol
• to identify the system to which all hosts belong.

Subnet 1 | 12
T216 Cisco networking (CCNA)

The network address always has a sequence of binary 0s in the host portion of the IP
address (Figure 15).

N H H H
A
10 0 0 0

N N H H
B
172 16 0 0

N N N H
C
192 168 1 0

Figure 15 Network addresses


The broadcast address, again unique, is used in the transmission of various
messages to all devices on the network. Instead of having to keep a list of all IP
addresses, the broadcast address is a ‘shortcut’ to which all computers with TCP/IP
are programmed to respond.
The broadcast address always has a sequence of binary 1s in the host portion of the
IP address and, like the network address, cannot be assigned to any device on the
network (Figure 16).

N H H H
A
10 255 255 255

N N H H
B
172 16 255 255

N N N H
C
192 168 1 255

Figure 16 Broadcast addresses

Exercise 2.3
As for Exercise 1.1, enter the command prompt and type ‘ipconfig /all’. Based on the
IP address you have and the information in Figure 16, ping the broadcast address of
your network (e.g. ping 192.168.0.255). If all is well (as some systems are suitably
configured to prevent this) you should get a reply. Then enter ‘arp –a’ to see all the
devices that responded to the first five echoes.
Note: you will have to be connected to a network.
Looking back at Figure 11, you may have realised there is also an anomaly with the
class A address range.
The range is from 0 to 127, but addresses 0 and 127 are reserved. In simple terms,
0.0.0.0 is the network address of the entire inter-network, or the internet. Sending a
message to this address is the same as communicating with everyone on the planet
simultaneously. Therefore this feature is blocked, for the sanity of network managers
everywhere. Figure 17 demonstrates the result of trying to ping 0.0.0.0.

Subnet 1 | 13
T216 Cisco networking (CCNA)

Figure 17 Pinging 0.0.0.0


As well as 0.0.0.0, 127.0.0.1 to 127.255.255.254 are reserved. When you ping
127.0.0.1, you are connecting with the loopback circuit on your computer (Figure 18).
This simple test enables you to confirm if the TCP/IP protocol stack is working on your
system (often in spite of network problems).

Figure 18 Pinging 127.0.0.1

Exercise 2.4
Looking back to Exercise 2.1, try to change the IP address of your computer to
0.0.0.0. If all is well you should get an error similar to that shown in Figure 19.

Figure 19 An erroneous IP address

Subnet 1 | 14
T216 Cisco networking (CCNA)

2.4 Uses of each IP address class


The size and scope of each class of address implies different uses for each class.
Whilst there is no predetermined rule, simple common sense applies.
Class A is suited to large-scale systems: ISPs, telecommunications companies,
national governments, national defence and international corporations. Whilst it seems
pointless, it is valid to apply a class A address to a smaller network, especially if you
are looking to subdivide the system using sub-networking (see Section 3). The scope
of class A ensures a comprehensive hierarchical network structure.
Class B is more suited to medium-sized enterprises and some academic institutions.
With addresses for 65 534 devices, the scope for a hierarchical structure is available
but is more limited.
Class C, the smallest still, has the scope for 254 hosts; people tend to forget that
many large organisations do not extensively employ information and communications
technology in the delivery of their product or service. A multi-million corporation can
successfully operate with fewer than 20 computers.

3 Sub-networking
This section will explore the principle of sub-networking, with the intention that it will
support the Cisco Academy curriculum. A subnet calculator is available as an
additional resource. You can find this on the course website. Do not depend on the
calculator as you will be required to do subnet calculations in the Cisco exam. Doing it
the long way now will help you understand.

3.1 The purpose of sub-networking


Having a network that has 16 777 214 (or 65 534 or even 254) potential hosts is
problematic, as:
• The broadcast domain is extensive and can cause a broadcast storm in the event
of a device attempting to communicate with the rest of the network.
• It is physically unmanageable due to the scale.

• Logically it is unmanageable with the scale involved.

• Data may be lost due to delays in data transmission and receipt.

To this end, sub-networking is employed as a technique to subdivide the network into

manageable sections, namely subnets. Sub-networking is simple in its logic, as the

subnet mask (see Section 3.2) acts as a division rule, where in theory you may have
2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, etc. subnets on your network.
Sub-networking provides a simple hierarchy, suitable for the management of any
network system (Figure 20).

Major network
172.16.0.0

Subnet 0 Subnet 1 Subnet 2 Subnet 3 Subnet 4 Subnet 5 Subnet 6


Accounts Sales Marketing Supplies ICT Facilities Production

Figure 20 Sub-networking hierarchy

Subnet 1 | 15
T216 Cisco networking (CCNA)

3.2 How subnetting is achieved


The art of sub-networking seems to be shrouded in much mystery, like ancient
alchemists seeking the magic elixir or the formula for turning lead to gold, and generates
fear amongst network professionals. Fortunately it is very simple, but like most good
things, knowledge comes with practice and patience. Before you start on creating sub-
networks, it is important that you understand the role and purpose of the subnet mask.
To move traffic between networks requires decision making, for which routers are
aptly designed, but if you have one network with many sub-networks then the router
must have a mechanism to aid the decision-making process. The subnet mask in its
simplest form is a 32-bit binary filter, which the router logically ANDs against an
incoming packet’s destination IP address to discover which network it is intended for.
Looking at Figure 21 you can see an example of the ANDing process.

Destination IP address
172 16 20 17
1 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1

Subnet mask
255 255 240 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0

The route will AND the subnet mask with the destination IP address
1 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0

Result
1 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
172 16 16 0

172.16.20.17 belongs to sub-network 172.16.16.0

Tip: ANDing is where 1 and 1 returns 1 but 0 and 0, 0 and 1, 1 and 0 all return 0
Figure 21 ANDing the subnet mask for routing decisions
To design a subnet mask is similar and as simple; all you need to do is remember
some straightforward rules:
1 You can borrow (subdivide) only from the host portion of the class of address in
question (look back to Section 2.2 if in doubt).
2 You can have only even numbers of sub-networks, all based on powers of 2, i.e. you
can have 2, 4, 8, 16, …, 1024, 2048, etc. Therefore round up to the nearest power
of 2. If you need 600 sub-networks don’t round down to 512, round up to 1024.
3 Binary 1s are always to the left – there are no exceptions for sub-networking.

4 Binary 0s are always to the right – again there are no exceptions.

5 Binary 1s always represent the number of sub-networks.

6 Binary 0s always represent the number of hosts in each sub-network.

7 Borrowing is done with a 1: each 1 means that you double the number of sub-

networks. The subnet mask is 32 bits; remember the dotted notation is only to
make the information human friendly.

Subnet 1 | 16
T216 Cisco networking (CCNA)

With the preceding rules in mind, work through the three examples in Figure 22.

You must go from left to right with the binary 1s as shown:

You have a Class A network address and you want 1500 sub-networks
(tip: you must have 2048 sub-networks)

10 0 0 0
Network Host Host Host

1024
2048
128
256
512
16
32
64
2
4

1 1 1 1 1 1 1 1 1 1 81 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
128

128

128

128
64
32
16

64
32
16

64
32
16

64
32
16
8
4
2
1

8
4
2
1

8
4
2
1

8
4
2
1
255 255 224 0

These are already


borrowed and to the left
These are the bits borrowed from the host portion
as this is the network
portion

Example 1

You have a Class B network address and you want 450 sub-networks
(tip: you must have 512 sub-networks)

172 16 0 0
Network Network Host Host
128
256
512
16
32
64
2
4
8

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0
128

128

128

128
64
32
16

64
32
16

64
32
16

64
32
16
8
4
2
1

8
4
2
1

8
4
2
1

8
4
2
255 255 255 128 1

These are already borrowed and to the left as These are the bits borrowed
this is the network portion from the host portion

Example 2

You have a Class C network address and you want 12 sub-networks


(tip: you must have 16 sub-networks)

192 168 100 0


Network Network Network Host
16
2
4
8

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
128

128

128

128
64
32
16

64
32
16

64
32
16

64
32
16
8
4
2
1

8
4
2
1

8
4
2
1

8
4
2
1

255 255 255 240


These are the bits
These are already borrowed and to the left borrowed from the host
as this is the network portion portion

Example 3
Figure 22 Simple sub-networking

Subnet 1 | 17
T216 Cisco networking (CCNA)

SAQ 2
Based on the preceding examples and guidance, provide solutions for the following
problems.
1 For 10.0.0.0 create a subnet mask for 10 000 sub-networks.
2 For 192.168.0.0 create a subnet mask for 7 sub-networks.
3 For 172.30.0.0 create a subnet mask for 99 sub-networks.

Now you may already have begun to appreciate that you can also work from the bits
to the right, the 0s giving the number of hosts per sub-network. Follow exactly the
same rules in reverse:
• If creating the number of sub-networks you go from left to right with 1s.
• Then creating or calculating the number of hosts you go from right to left with 0s.
• And yes, round up.
Figure 23 takes the solutions from Examples 1–3 in Figure 22 and provides you with
information on the number of hosts per subnet.

8192
4096
2048
1024
2048

1024
512
256
128
128
256
512

64
32
16
16
32
64

8
4
2
2
4
8

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
128

128

128

128
64
32
16

64
32
16

64
32
16

64
32
16
8
4
2
1

8
4
2
1

8
4
2
1

8
4
2
1
255 255 224 0

Example 1 had 2048 sub-networks, each has 8192 hosts

128
128
256
512

64
32
16
16
32
64

8
4
2
2
4
8

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0
128

128

128

128
64
32
16

64
32
16

64
32
16

64
32
16
8
4
2
1

8
4
2
1

8
4
2
1

8
4
2
1
255 255 255 128

Example 2 had 512 sub-networks, each has 128 hosts


16
16

8
4
2
2
4
8

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
128

128

128

128
64
32
16

64
32
16

64
32
16

64
32
16
8
4
2
1

8
4
2
1

8
4
2
1

8
4
2
1

255 255 255 240

Example 3 had 16 sub-networks, each has 16 hosts


Figure 23 Hosts per subnet
In effect a subnet mask, whilst a binary filter, is like a slide – the more you move it to
the right the more sub-networks you obtain from the class of address, whereas the
more you move it to the left the more hosts you gain per subnet (Figure 24).

Subnet 1 | 18
T216 Cisco networking (CCNA)

10 0 0 0
255 255 240 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0

more sub-networks more hosts per sub-network


with fewer hosts with fewer sub-networks
Figure 24 The sliding subnet mask
Appreciating that the subnet mask acts like a sliding scale is important, as the subnet
mask is totally independent of the class of address being applied. There are ‘default’
subnet masks that are suitable for classes A, B and C, but one subnet mask can
obtain radically different results depending on the class of address to which it is being
applied.
Consider Figure 25, which shows that the subnet mask 255.255.255.224 has three
different results on the three classes of address to which it is applied.

255 255 255 224


128

128

128

128
64
32
16

64
32
16

64
32
16

64
32
16
8
4
2
1

8
4
2
1

8
4
2
1

8
4
2
1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0

10 0 0 0
Network Host Host Host

131 072
262 144
524 288
16 384
32 768
65 536
1024
2048
4096
8192
128
256
512
16
32
64

32
16
2
4
8

8
4
2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0
Class A has 524 288 sub-networks, each with 32 hosts

172 16 0 0
Network Network Host Host
1024
2048
128
256
512
16
32
64

32
16
2
4
8

8
4
2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0
Class B has 2048 sub-networks, each with 32 hosts

192 168 1 0
Network Network Network Host
32
16
2
4
8

8
4
2

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0
Class C has 8 sub-networks, each with 32 hosts

Note: the number of sub-networks is different, but the number of hosts remains the same.
Figure 25 One mask having differing results

Subnet 1 | 19
T216 Cisco networking (CCNA)

Figure 26 shows the default subnet masks for each class of address. These are the
masks used when there is no ‘sub-networking’ to be done.

99 0 0 0
A
255 0 0 0

150 30 0 0
B
255 255 0 0

200 100 50 0
C
255 255 255 0

Figure 26 ‘Default’ subnet masks

3.3 Identifying a sub-network address and related


addresses
Now that you have subdivided the network into sub-networks, you will have to be able
to identify each sub-network so that you can:
1 find the range of host addresses that will be issued to the devices on the given
sub-network
2 identify the sub-network address so that you can configure routing equipment
3 find the broadcast address, as this is not usable in the direct administration of your
network.
Each sub-network is in a logical order based on the subnet mask, which as originally
stated acts as a filter. But to avoid confusion you must learn a new counting
technique: 0 is a number and is always the first subnet, which means if you count from
0 to 7, you have covered eight numbers (or in this case subnets).
As discussed in Section 2.3, there are two types of special address: network and
broadcast. Because of this, when the network is subdivided into sub-networks, the
network and broadcast addresses remain. This means that the same address is being
used twice, which is not allowable. So normally the first and last subnets are wasted.
The first subnet (0) can be used if you have a router that is programmable to manage
the conflict. With Cisco™ routing equipment, the command ‘ip subnet-zero’ will
resolve and manage the conflict. But alas, this is not true for the last subnet, which is
wasted (until you read Subnet 2).
Figure 27 provides an example of a class C network with the subnet mask of
255.255.255.224 and the identification of the eight sub-networks, with hosts and
broadcast addresses. This figure provides a comprehensive breakdown of each
address and the binary pattern used to generate the address. This method works
adequately for class C networks, but when you get to class A or B the process
becomes time-consuming, especially if you wish to identify the 200th subnet from a
range of 1024 subnets.

Subnet 1 | 20
T216 Cisco networking (CCNA)

Sub-network portion,
contains the sub­
network identity
major network
address as well as
192.168.100.0 Host portion
subnet 0 address
255.255.255.224

128
64
32
16
8
4
2
1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0
Sub-network address 192.168.100.0 0 0 0 0 0 0 0 0
First host address 192.168.100.1 0 0 0 0 0 0 0 1
Subnet 0
Last host address 192.168.100.30 0 0 0 1 1 1 1 0
Sub-network broadcast address 192.168.100.31 0 0 0 1 1 1 1 1
Sub-network address 192.168.100.32 0 0 1 0 0 0 0 0
First host address 192.168.100.33 0 0 1 0 0 0 0 1
Subnet 1
Last host address 192.168.100.62 0 0 1 1 1 1 1 0
Sub-network broadcast address 192.168.100.63 0 0 1 1 1 1 1 1
Sub-network address 192.168.100.64 0 1 0 0 0 0 0 0
First host address 192.168.100.65 0 1 0 0 0 0 0 1
Subnet 2
Last host address 192.168.100.94 0 1 0 1 1 1 1 0
Sub-network broadcast address 192.168.100.95 0 1 0 1 1 1 1 1
Sub-network address 192.168.100.96 0 1 1 0 0 0 0 0
First host address 192.168.100.97 0 1 1 0 0 0 0 1
Subnet 3
Last host address 192.168.100.126 0 1 1 1 1 1 1 0
Sub-network broadcast address 192.168.100.127 0 1 1 1 1 1 1 1
Sub-network address 192.168.100.128 1 0 0 0 0 0 0 0
First host address 192.168.100.129 1 0 0 0 0 0 0 1
Subnet 4
Last host address 192.168.100.158 1 0 0 1 1 1 1 0
Sub-network broadcast address 192.168.100.159 1 0 1 1 1 1 1 1
Sub-network address 192.168.100.160 1 0 1 0 0 0 0 0
First host address 192.168.100.161 1 0 1 0 0 0 0 1
Subnet 5
Last host address 192.168.100.190 1 0 1 1 1 1 1 0
Sub-network broadcast address 192.168.100.191 1 0 1 1 1 1 1 1
Sub-network address 192.168.100.192 1 1 0 0 0 0 0 0
First host address 192.168.100.193 1 1 0 0 0 0 0 1
Subnet 6
Last host address 192.168.100.222 1 1 0 1 1 1 1 0
Sub-network broadcast address 192.168.100.223 1 1 0 1 1 1 1 1
Sub-network address 192.168.100.224 1 1 1 0 0 0 0 0
First host address 192.168.100.225 1 1 1 0 0 0 0 1
Subnet 7
Last host address 192.168.100.254 1 1 1 1 1 1 1 0
Sub-network broadcast address 192.168.100.255 1 1 1 1 1 1 1 1

major network broadcast address as well as subnet-7 broadcast address,


which means all 32 addresses are LOST
Figure 27 Identification of sub-networks, with hosts and broadcast addresses

Subnet 1 | 21
T216 Cisco networking (CCNA)

Naturally there is a quicker way, based on the simple fact that the borrowed sub-
network portion contains the sub-network identity you will be looking for.
Using this knowledge you can:
1 Subtract 1 from the network number (remember you are counting from 0, so for
example the 200th subnet is number 199).
2 Convert the new number of the network to binary.
3 Place the binary address to the right-hand side of the subnet masked portion.
4 Fill the gaps (if any) on the left with 0s back to the network portion of the class of
address (as well as the right host portion, which must be 0).
5 Now calculate the result, which is the nth subnet.
Figure 28 provides an example of how you can find the 200th subnet from a mask that
has 1024 sub-networks for a class B network of 150.150.0.0. (Hint: the mask is
255.255.255.192, which helps us to see which bits are allocated to the network
portion.)

Step Task
1 You want the 200th, therefore subtract 1
2 Convert 199 to binary, which is 11000111
128 64 32 16 8 4 2 1
1 1 0 0 0 1 1 1
3 Place the binary address to the right-hand side of the subnet masked portion
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0
1 1 0 0 0 1 1 1
4 Fill gaps with 0s
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0
network portion 0 0 1 1 0 0 0 1 1 1 0 0 0 0 0 0
5 Calculate the result
128

128
64
32
16

64
32
16
8
4
2
1

8
4
2
1
150 150 0 0 1 1 0 0 0 1 1 1 0 0 0 0 0 0
150 150 49 192

Note: it is worth considering that with a subnet mask of 255.255.255.192,


there are 64 hosts, which means that the network addresses always
increment in steps based on the number of hosts.
Figure 28 Finding one subnet

SAQ 3
1 For 10.0.0.0, with 255.255.128.0, identify the 10th subnet.
2 For 172.16.0.0, with 255.255.254.0, identify the 29th subnet.
3 For 126.0.0.0, with 255.255.255.224, identify the 1000th subnet.

Subnet 1 | 22
T216 Cisco networking (CCNA)

Answers to SAQs
SAQ 1
1 A
2 B
3 A
4 B
5 C
6 A
Ranges for each class are defined. You can either remember them or work them out
from the most significant bits, as shown in Figure 11.

SAQ 2
1 2
55.255.252.0
10 000 subnets requires 14 bits. Starting from the left, bits are taken from each
octet; that is 8 from octet 2 and 6 from octet 3. Mask for octet 3 can be found:
128 64 32 16 8 4 2 1
1 1 1 1 1 1 0 0 = 252
2 2
55.255.255.224
7 subnets requires 3 bits. Looking at the 8 bits in the fourth octet:

128 64 32 16 8 4 2 1

1 1 1 0 0 0 0 0 = 224

3 2
55.255.254.0
99 subnets requires 7 bits. Looking at the 8 bits in the third octet:

128 64 32 16 8 4 2 1

1 1 1 1 1 1 1 0 = 254

SAQ 3
The layout in this answer is different from above. Try to develop a method that works
for you.
1 0.4.128.0
1
The subnet mask tells us how many bits are allocated to the network part. In this
example 1 bit of the third octet is available for subnetting. Subnets start at 0, so we
are looking for the 9th. In this case the boundary between the 2nd and 3rd octet
has to be considered:
2nd octet 3rd octet
N N N N N N N N N H H H H H H H
256 128 64 32 16 8 4 2 1 count from the least significant bit
0 0 0 0 0 1 0 0 1 =9
128 64 32 16 8 4 2 1 128 64 32 16 8 4 2 1
get the address from the bit that equals 1 in each octet
Try your own approach to 2 and 3.
2 172.16.56.0
3 1
26.0.124.224

Subnet 1 | 23

Вам также может понравиться