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

Network Addressing

Structure
CCNA Discovery2: Chapter 4

Version 4.1

Contents
4.1: IP Addressing & Subnetting Review
4.2: VLSM & CIDR
4.3: NAT and PAT

IP Addresses
IP addresses identify hosts and network devices
To send and receive messages on an IP network,
every host must be assigned a unique 32-bit IP
address
IP address are displayed in dotted-decimal
notation
192.168.1.1

Each of the 4 octets represents 8 bits


IP addresses are hierarchical
The network portion identifies the network that
a host belongs to
The host portion identifies an individual host on
a network

Network Addresses
The network portion of the address, is used to
represent the entire network

It represents a group of IP addresses that can be


used on that network

The network address consists of the network


field plus all 0s in the host portion of the
address
192.168.18.00000000
192.168.18.0

The Network address is not a usable host IP

address
Network addresses are only used by routers to
decide how to get packets to their destination

Host vs. Network Portion

Network Number
Host Number

Broadcast Address
A Broadcast Address is the address used to
send messages to every host on the same
network
A Broadcast Address consists of the
Network address, plus all 1s in the host
field
The Broadcast address is NOT a USABLE
host address and can not be assigned to a
host

Broadcast Addresses
Network Address
120.0.0.0
170.50.0.0.
192.168.10

Broadcast Address
120.255.255.255
170.5.255.255
192.168.10.255

Usable Host Addresses


As we just saw, the Network address and the
Broadcast address are NOT usable host
addresses
A usable host IP address is an IP address that:

Is not a Network Address (all 0s in host field)


Is not a Broadcast Address (all 1s in host field)
Is not a reserved Address (127 addresses)
Is a Class A, B or C address

Only a usable host IP address can be assigned


to a host device

Determining Usable Host


Addresses
Network
Usable Hosts
Broadcast
10.0.0.0
10.0.0.1 10.255.255.254
10.255.255.255
172.16.0.0
172.16.0.1-172.16.255.254
172.16.255.255
192.168.1.0
192.168.1.1-192.168.1.1254
192.168.1.255

Available Host Addresses


The number of available host addresses on a network
can be calculated with the formula:

2 ^ host bits 2
Network type

Available Hosts

255.0.0.0
2 ^ 24 -2 =
16, 277, 214
255.255.0.0
2 ^ 16- 2 =
65, 534
255.255.255.0 2 ^ 8 2 =
254
The reason we always subtract 2 from the total host
addresses to determine the available host addresses,
is because the network address and broadcast address
are NOT usable host address
Therefore, every network has 2 addresses that can not
be assigned to hosts, the very 1st address (all 0s in the
host portion) and the very last address (all 1s in the
host portion)

IP Address Classes
To create more possible network designations,
the 32-bit address space was organized into five
classes.
Class A, B, and C: Commercial networks
Class D and E: multicast and experimental

The class of a network is indicated by the


values of the first few bits of the IP address,
called the high-order bits.

IP Address Classes
Early Networks were only identified with an 8 bit
network address
To create more possible network designations,
the 32-bit address space was organized into five
classes.
Class A, B, and C: Commercial networks
Class D and E: multicast and experimental

Routers needed to be programmed to look


beyond the first 8 bits to identify class B and
C networks.
Networks were divided in a way that makes
it easy for routers and hosts to determine
the correct number of network ID bits

Commercial IP Address Classes


Class C addresses are usually assigned to small
networks

Use 3 octets for the network and 1 for the hosts


N.N.N.H
The default subnet mask is 24 bits: 255.255.255.0
2, 097, 150 (2 ^ 21 2) possible networks
254 (2 ^ 8 2) available host addresses per network

Class B addresses are typically used for medium-sized


networks

Use 2 octets for the network and 2 for the hosts


N.N.H.H
The default subnet mask is 16 bits: 255.255.0.0
16, 382 (2 ^ 14 2) possible networks
65, 534 (2 ^ 16 2) available host addresses per network

Class A addresses are typically assigned to large


organizations.

Use 1 octet for the network and 3 for the hosts


N.H.H.H
The default subnet mask is 8 bits: 255.0.0.0
126 (2 ^ 7 2) possible networks
16, 777, 214 (2 ^ 24 2) available host addresses per network

Class A
The first bit is always 0
Addresses start with 0 to 126

Class B
First two bits are always 1 and 0
Addresses start with 128 to 191

Class C
First three bits are always 1, 1 and 0
Addresses start with 192 to 223

Class D

Class E

1 to 126

Private IP Addresses
Reserved address space for private networks
Private IPs are not routable on the Internet
Many networking devices give out private IPs
through DHCP

The Loopback Address


There are also private addresses that can
be used for the diagnostic testing of
devices.
This type of private address is known as
a loopback address.
The class A, 127.0.0.0 network address,
is reserved for loopback testing.
The loopback IP address, 127.0.0.1 is
used to test a NIC card to verify that it is
sending and receiving signals.

Subnet Masks
A subnet mask is a 32 bit address which tells

devices which part of the IP address is network


and which part is host
Let routers & hosts figure out which network or
subnet an IP address belongs to

Subnet Masks contain:

all 1s in the network field


all 0s in the host field

Example Subnet Masks:

255.255.255.0
255.255.0.0
255.255.255.128
255.254.0.0

Subnet Mask Formats


Subnet Masks can be written in 2 different
formats:

1. Dotted Decimal format


192.168.1.1 255.255.255.0

2. Bit-Mask Format
192.168.1.1 /24
This indicates that there are 24 bits ( 24 1s) in
the network and subnetwork portion of the
address (255.255.255.0)

4.2: Types of Subnetting

The Need for Subnetting


Networks continued to grow and connect to
the Internet throughout the 80s and 90s,
with many organizations adding hundreds,
and thousands of hosts to their network.
This created 3 needs or problems:
The need to create separate LANS within a
company for security or management purposes.
Increased hosts increased the broadcast traffic
which decreased network performance
There are a limited number of Class B and C
addresses available

Example Scenario
An ISP customer has outgrown its initial network
installation - the original integrated wireless router
is overloaded with traffic from both wired and
wireless users
They have a Class C network address
Solution:
Add a 2nd networking device (larger integrated service
router)
When adding a device, it is a good practice to place the
wired and wireless users on separate local subnetworks
to increase security
The new network configuration requires that the
existing Class C network be divided into at least three
subnetworks

Example Scenario

Subnet 3
Subnet 2

Subnet 1

Subnets Defined
RFC 917 defines Internet Subnets
The Subnet mask is the method routers use to
isolate the network portion from an IP address.

Routers read subnet masks left to right, bit


for bit
Bits set to 1 are read as part of the network ID
Bits set to 0 are read as part of the host ID

Altering the Address Hierarchy


In the original IP address hierarchy, there
are 2 levels:
Network field (network bits)
Host field (host bits)

Subdividing a classful network adds a new


level to the network hierarchy
It creates 3 levels of Hierarchy in a IP
Address:
Network (network bits)
Subnetwork (subnet bits)
Host (host bits)

Classful Subnetting
Traditional classful subnetting has these
characteristics:
1.
2.
3.
4.

Uses a fixed number of subnets


Has a fixed number of hosts per subnet
All subnets must be the same size
Each subnet must use the same subnet mask

Also known as fixed-length subnetting


All subnets must be the same size, which means
that the maximum number of hosts that each
subnet can support is the same for all subnets
created

The more bits that are taken for the subnet ID, the
fewer bits left for host IDs

Limits of Classful Subnetting


The original classful subnetting method required

that all subnets of a single classed network be the


same size.
This was because routers did not include subnet
mask information in their routing updates
A router programmed with 1 subnet address and
mask on an interface automatically applied that
same mask to the other network subnets in its
routing table.
This limitation required the use of fixed-length
subnets and subnet masks
This technique wastes a significant number of IP
addresses.

Example: Classful Subnetting


Network: 192.168.1.0 /24

Subnet 3: 2 hosts
172.16.1.96 /27
Subnet 2: 10 hosts
172.16.1.64 /27

Subnet 1: 30 hosts
192.168.1.32 /27

Example: Classful Subnetting


Original Network address: 192.168.1.0 /24
Subnet 1 needs 30 hosts so subnets will have to
be created that support at least 30 hosts

3 bits are borrowed = 255.255.255.224 mask


5 host bits are left unborrowed
This provides 30 addresses per subnet
Subnet Addresses are:
192.168.1.32
192.168.1.64
192.168.1.96

This wastes many addresses in Subnet 2 and 3

VLSM
Variable length subnet masking (VLSM) helps
solve the limits of classful subnettting
VLSM allows an address space to be divided into
subnets of various sizes
This is done by subnetting subnets

Characteristics of VLSM
Each subnet can be a different size
Each subnet can be designed to support the
number of hosts needed
Each subnet can have a different subnet mask

How does it work


In order for VLSM to work, Routers must be
aware of how the network was subnetted.
With classful subnetting, we know that the
Subnet Mask information was not shared
with other routers
With VLSM, routers must share subnet
mask information, so routers will know how
many bits have been used for the network
portion of each subnet address
VLSM saves thousands of IP addresses
that would be wasted with traditional
classfull subnetting

Example: VLSM
Network: 192.168.1.0 /24

Subnet 3: 2 hosts
192.168.1.80 /30
Subnet 2: 10 hosts
192.168.1.64 /28

Subnet 1: 30 hosts
192.168.1.32 /27

Example: VLSM
Original Network Address: 192.168.1.0 /24
Subnet 1 needs 30 hosts:

Need 30 hosts, so 5 bits must be left in the host portion


Borrow 3 bits = 255.255.255.224 mask
Subnet Address: 192.168.1.32 /27
This provides 30 addresses per subnet

Subnet 2 needs 10 hosts

Take the next available Subnet : 192.168.1.64


Need 10 hosts, so 4 host bits must be left over
Borrow 4 bits
Subnet mask = 255.255.255.240
Subnet Address: 192.168.1.64 /28

Subnet 3 needs 2 hosts

Take the next available subnet: 192.168.1.80


Need 2 hosts, so 2 host bits must be left over
Borrow 6 bits
Subnet mask = 255.255.255.252
Subnet Address: 192.168.1.80 /30

CIDR
CIDR = Classless Inter-Domain Routing
CIDR is a type of network addressing that ignores
the traditional network classes (Class A, B and C)
CIDR Assigns Blocks of Addresses, based on the
number of hosts needed
Can be though of as assigning a Subnet of a Class A or
Class B address to a company as a block of Addresses

It identifies networks based solely on the number


of bits in the network prefix
Example: 172.16.64.0 / 18
/18 bits in the network portion of the address
This block contains the Addresses: 172.16.64.1 to
172.16.127.255

CIDR
CIDR protocols freed routers from using only the highorder bits to determine the network prefix
registered IP addresses do NOT need to be assigned by class

Before CIDR, an ISP requiring 3,000 host addresses could


request either a full Class B address space or multiple
Class C network addresses to meet its requirements.
With a Class B address space, the ISP would waste thousands of
registered addresses.
With multiple Class C addresses, it could be difficult to design the
ISP network so that no single section required more than 254 host
addresses.

By ignoring the traditional address classes, CIDR enables


ISPs to request a block of addresses based on the number
of host addresses it requires.
CIDR is defined in RFC 1519

Supernets
Supernets are created by combining a group of
Class C addresses into one large block
This enables addresses to be assigned more
efficiently
Example: 192.168.0.0/19
19 bits are used for the network prefix
This block contains the addresses 192.168.32.1 to
192.168.63.255
This allows 8,190 possible host addresses (213)

An ISP can use the supernet as one large network


or divide it into as many smaller networks as
needed to meet its requirements.

Why learn classed addressing?


Although classed addressing and fixedlength subnet masking are becoming less
common, it is important to understand how
these addressing methods work.
Many networking devices still use the
default subnet mask if no custom subnet
mask is specified.

Router Interface Addressing

Each subnet is a separate network and a Router is


needed to communicate between Subnets
Every Router Interface must have a valid host IP
Address: this includes both WAN and LAN interfaces
WAN Interfaces: when 2 routers are connected,
there must be a separate network, or subnet
assigned to the connection between them

LAN Interfaces: Each router interface connected to


a LAN must have an IP address in the same subnet
as the LAN

The interfaces on both routers must be assigned host IP


addresses in that network or subnet

Each router interface is the default gateway for its subnet

Usually, router interfaces are assigned either the first


or last host address available in the subnet. This
assures consistency.

Communicate between Subnets

Subnet 3

WAN Interfaces
LAN Interfaces
Subnet 1

Subnet 2

4.3: NAT
Network Address Translation
NAT allows a group of private users to
access the Internet by sharing one or more
public IP addresses
NAT translates private IP addresses into 1
or more public IP addresses for routing on
the Internet

NAT Advantages
NAT has several advantages:
1. Saves registered IP addresses
IP addresses can be re-used and many hosts on a
single LAN can share globally unique IP addresses

2. Increased security by
Withholds hosts actual IP host addresses from
direct Internet access

3. Transparent to end users


4. Adds Scalability to LAN

NAT Disadvantages
1. Incompatible with certain applications
2. Prevents legitimate remote access to
network
3. Requires increased processing by router
which negatively affects network
performance

NAT Analogy
As a company adds employees, at some point,
they no longer run a public phone line directly to
each employee desk.
Instead, they use a system that allows the
company to assign each employee an extension
number.
The company can do this because not all
employees use the phone at the same time.
Using private extension numbers enables the
company to purchase a smaller number of
external phone lines from the phone company.

NAT at Work

Inside vs. Outside Network


Inside local network
A network that is part of
the privately addressed
LAN

Outside global network


A network that is
external to the LAN and
does not recognize the
private addresses
assigned to hosts on
the LAN

Inside & Outside Addresses


Inside local address
A Private IP address configured on a host on an inside
network
Must be translated before it can travel outside the local
network addressing structure

Inside global address

The NAT translated IP address


The IP address of an inside host as it appears to the
outside network

Outside local address

The Destination address of the packet while it is on the


local network
Usually, this is the same as the outside global address.

Outside global address

The Public IP address of an external host

Inside & Outside Addresses

Inside Global Address = NAT


Translated Public IP Address

Dynamic NAT
Dynamic NAT dynamically translates each
inside local addresses to an inside global
address by using 1 public IP address, or a
pool of addresses

Static NAT
What if one or more of the hosts within a network
are running services that need to be accessed
from the Internet?
Static NAT translates a permanent registered
global address to particular hosts
Static NAT is used for Servers that need a consistent IP
address
Static translations ensure that an individual host private
IP address is always translated to the same registered
global IP address
Static NAT allows hosts on the public network to access
selected hosts on a private network

PAT
PAT (Port Address Translation) translates
multiple inside local addresses to a single global
address using Port numbers
PAT is also called NAT overload
PAT translates every inside local address to the
same inside global address, by using PORT
NUMBERS to represent the different private
internal addresses
When a source host sends a message to a
destination host, it uses an IP address and port
number combination to keep track of each individual
conversation with the destination host

How PAT works


PAT translates the local source address
and port combination in an outgoing packet
to a single global IP address and a unique
port number above 1024
Each host is translated into the same global IP
address, but the port number associated with
the conversation is unique.

Responding traffic is addressed to the

translated IP address and port number used


by the host.
A table in the router contains a list of the
inside Local addresses and port numbers

PAT

PAT Security
PAT conversations use a unique and combination
of the private IP address and port number
Example: 192.168.1.106: 7000

Uses Port numbers above 1024

PAT Maximizes security


Each private IP address/port number translation is ONLY
created when a host on the inside network initiates
communication
The translation is only in place for the duration of the
connection, so a given user does not keep the same
global IP address and port number combination after the
conversation ends.

Users on the outside network cannot reliably initiate


a connection to a host on a network that uses PAT.

IP Nat issues
1. Requires additional network workload to
support IP addresses and port translations

Some applications embed an IP address as part of


the encapsulated data
The router must replace the source IP addresses
and port in the data, and the source addresses in
the IP header.

2. Requires careful network design and


equipment selection

Routers must support PAT

3. Requires accurate configuration

IPv.6
3 Solutions were developed to provide
to temporarily alleviate the problem of
IPv4 address depletion:
1. Subnetting
2. Private IP addressing
3. NAT / PAT

IPv6 was proposed as a permanent


solution to the problem of IPv4 address
depletion
Outlined in 1998 in RFC 2460
The transition to IPv6 is ongoing

IPv6
Uses a 128 bit Address
Represented as 32 hexadecimal digits
separated by colons (
8 groups of 4

Ex: 2001:0db8:3c55:0015:0000:0000:abcd:ff13
Uses a 3-part hierarchy:
Global Prefix: assigned to an organization by an
Internet names registry
12 Hex digits
Subnet: identifies the Subnet
4 Hex digits
Interface Identifier: identifies the host
16 Hex digits

IPv6 Address

IPv6 Improvements
IPv6 offers many improvement over IPv4:
1.
2.
3.
4.
5.

Allows for more address space


Creates better space management
Allows easier TCP/IP administration
Incorporates modern Routing capabilities
Provides support for advanced network
capabilities

Summary
Devices that want to communicate over a network need a unique IP

address
IP addressing can be tailored to the needs of the network design
through the use of custom subnet masks.
A network can be divided into subnets to provide security and
preserve addresses
Subnets and custom subnet masks can be created by extending the
number of bits used for the network portion of the address
Communication between subnets requires a router
Classful subnetting uses the same subnet mask for each subnet
Classless subnetting gives classful IP addressing schemes more
flexibility through the use of variable length subnet masks.
Network Address Translation (NAT) allows a group of private IP
addresses to share a small pool of public IP addresses
Port Address Translation (PAT) translates multiple local addresses to
a single global IP address, maximizing the use of both private and
public IP addresses.
IPv6 offers improvements over IPv4

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