Download Network Addressing - Cisco Networking Academy

Document related concepts

Net bias wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

AppleTalk wikipedia , lookup

Computer network wikipedia , lookup

Network tap wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Airborne Networking wikipedia , lookup

Distributed firewall wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

I²C wikipedia , lookup

List of wireless community networks by region wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Dynamic Host Configuration Protocol wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Transcript
CCNA Discovery 1
Chapter 5:
Network Addressing
Contents

5.1: IP Addresses & Subnet Masks

5.2:Types of IP Addresses

5.3: Obtaining IP Addresses

5.4: Address Management

5.5: Booleans and Anding
◦
◦
◦
◦
5.1.1- Purpose of an IP Address
5.1.2 – Address Structure
5.1.3 – Parts of an Address
5.1.4 – IP Addresses & Subnet Masks
◦ 5.2.1 – Address Classes
◦ 5.2.2 – Public vs. Private Addresses
◦ 5.2.3 – Unicast, Broadcast and Multicast
◦ 5.3.1 – Static vs Dynamic Addresses
◦ 5.3.2 – DHCP Servers
◦ 5.3.3 – Configuring DHCP
◦ 5.4.1 – Address Space
◦ 5.4.2 – Address Assignment
◦ 5.4 3. – NAT
5.1.1: Purpose of the IP Address
An IP address is a logical network address that identifies a
particular host on a network
 The IP address is assigned to the Network interface connection
for a host.
 All hosts need a unique IP address to participate and
communicate with other devices on the Internet.

◦ This includes workstations, servers, network printers and IP phones
◦ Some servers can have more than one NIC and each of these has its
own IP address.
◦ Router interfaces that provide connections to an IP network will also
have an IP address.
Every packet sent across the Internet has a source and
destination IP address.
 This information is required by networking devices to insure the
information gets to the destination and that any replies are
returned to the source.

5.1.2: IP Address Structure

IP Addresses are 32 bit addresses written in dotted
decimal notation
◦ The address is represented by 32 bits (zeros and ones)
◦ The 32 bits are grouped into four 8-bit bytes called
octets.
◦ Each octet is represented by its decimal value, separated
by a decimal point or period.

Example: 192.168.1.5
◦ This represents the address:
11000000101010000000000100000101
◦ The dotted decimal format is much easier to use
The 32-bit IP address is called IP version 4 (IPv4)
addressing and is currently the most common form of
IP address on the Internet.
 There are over 4 billion possible IP v4 addresses

Converting IP Addresses
When a host receives an IP address, it reads
it as bits as they are received on the NIC.
 Humans, on the other hand, need to convert
those 32 bits into their four octet decimal
equivalent.
 Each octet can be converted just like any
other 8 bit binary number
 The maximum values for each octet are:

◦ Binary :
◦ Decimal:
11111111
255
Conversion of an IP Address
5.1.3: Parts of an IP Address

IP addresses are hierarchical and re made up of two
parts.:
◦ The Network Portion: identifies the network
◦ The Host Portion: identifies a host on that network

IP Addressing is considered hierarchical addressing
because the network portion indicates the network
on which each unique host address is located.
◦ Telephone numbers are also hierarchical : the country
code, area code and exchange represent the network
address and the remaining digits represent a local phone
number

Example: The IP host address192.168.18.57
◦ The 1st 3 octets are the Network portion: 192.168.18
◦ The last octet is the Host portion: 57
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 is created by taking the
Network portion of the address and putting all
0’s 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
Usable Host Addresses
As we just saw, the Network address is not a
usable host address
 A usable host IP address is an IP address that
does not have all 0’s or 1’s in the host
portion of the address
 Only a usable host IP address can be assigned
to a host device
 Example: on the network 192.168.18.0, the
usable host IP addresses are:

◦ 192.168.18.1 to 192.168.18.254
Host vs. Network Portion
Network Number
Host Number
Network vs. Host Portion
Network Addresses
Host IP Addresses
5.1.4: Subnet Masks
Since there are two parts to every IP address, how
do hosts and routers know which portion is the
network and which is the host?
 This is the job of the subnet mask

◦ A subnet mask is a 32 bit address, like an IP address, which is
written in dotted decimal notation

The subnet mask is a special address that tells devices
which part of the IP address is network and which
part is host
◦ A subnet mask is assigned to devices at the same time as
the IP address

Example Subnet Masks:
◦
◦
◦
◦
255.255.255.0
255.255.0.0
255.255.255.128
255.254.0.0
How is the Subnet Mask Used?

When a host sends a packet, it uses the Subnet mask
to decide if the packet is destined for a host on the
local network or on a different network:
◦ It compares its own subnet mask to its own IP address,
from left to right, bit for bit.
◦ The 1s in the subnet mask represent the network portion;
the 0s represent the host portion
◦ Once it knows what network it belongs to, it compares its
own subnet mask to the destination IP address
◦ If the network bits in its own address and the destination
address match, it knows that the destination host is on the
same network
◦ This means the packet can be delivered locally
◦ If the network bits do not match, the sending host
forwards the packet to the local router interface to be
forwarded to the other network.
Using the Subnet Mask
Network vs. Host Bits

The subnet masks we see most often with home and
small business networking are:
◦ 255.0.0.0 (8-bit network)
{11111111.00000000.00000000.00000000}
◦ 255.255.0.0 (16 bit network) {11111111. 11111111.00000000.00000000}
◦ 255.255.255.0 (24 bit network) {11111111.11111111.1111111.00000000}
A subnet mask of 255.0. 0.0 uses 8 bits to identify the
network number, which leaves 24 bits to create host
addresses for the network
 A subnet mask of 255.255. 0.0 uses 16 bits to identify
the network number, which leaves 16 bits to create
host addresses for the network
 A subnet mask of 255.255.255.0 uses 24 bits to identify
the network number which leaves 8 bits to number the
hosts on that network.

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 = 16, 777, 216 – 2 = 16, 277, 214
◦ 255.255.0.0
2 ^ 16 = 65, 536
– 2 = 65, 534
◦ 255.255.255.0 2 ^ 8 = 256
– 2 = 254
The reason we always subtract 2 from the total host
addresses to determine the available host addresses, is
because a valid host address can not have all 0’s or all 1’s in
the host portion of the address
Therefore, every network has 2 addresses that can not be
assigned to hosts, the very 1st address (all 0’s in the host
portion) and the very last address (all 1’s in the host
portion)
Network and Broadcast Addresses

Example Networks:
◦ 120.
◦ 170.5
◦ 192.168.10

All 0’s in the host portion of an IP address, represents the
Network Address for that network, and can not be
assigned to a host
 120.0.0.0
 170.5.0.0
 192.168.10.0

All 1s in the host portion of an IP address, represents the
broadcast address for that network, and can not be
assigned to a host
◦ 120.255.255.255
◦ 170.5.255.255
◦ 192.168.10.255
5.2.1: IP v. 4 Address Classes
As we have seen, the IP address and subnet
mask work together to determine which
portion of the IP address represents the
network address and which portion
represents the host address.
 IP v. 4 addresses are grouped into 5 classes:

◦ Classes A, B and C are commercial addresses and
are assigned to business, organizations and
individuals to be used for hosts on the Internet
◦ Class D is reserved for multicast use
◦ Class E is for experimental use
Commercial IP Address Classes

Class C addresses are usually assigned to small networks
◦
◦
◦
◦

N.N.N.H
Class B addresses are typically used for medium-sized networks
◦
◦
◦
◦

Use 3 octets for the network and 1 for the hosts
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
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
The value of the 1st Octet
The class of an address can be determined by the
value of the first octet
 Each Class of IP Address can only begin with a
certain value
 Also notice, that there is a leading bit pattern that
never changes for each class of addresses

Class
Decimal Value of 1st Octet
◦
◦
◦
◦
◦
1 - 126
128 – 191
192 – 223
224 – 239
240 – 255
Class A
Class B
Class C
Class D
Class E
Leading Bit value
0
10
110
1110
1111
1 to 126
5.2.2: Public vs. Private Addresses





All hosts that connect directly to the Internet
require a unique public IP address.
Because there are a limited number of 32-bit
addresses available, there is a risk of running out of
IP addresses.
One solution to this problem was to reserve some
private addresses for use exclusively inside an
organization.
Private IP Addresses allow hosts within an
organization to communicate with one another
without needing a unique public IP address.
The RFC 1918 standard reserves 3 ranges of
Private IP Addresses, for classes A, B and C.
Private Network Addresses
Private Network
Addresses
Private IP Addresses

Private addresses can be used internally by hosts in
an organization as long as the hosts do not connect
directly to the Internet.
◦ Private addresses are not routed on the Internet and are
blocked by ISP routers.
◦ Hosts that are using private addresses, must use the
services a computer or network device with a public IP
address to access the Internet.
This allows multiple organizations to use the same
set of private addresses internally.
 The use of private addresses can also provide a
measure of security since they are only visible on
the local network, and outsiders cannot gain direct
access to the private IP addresses.

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.

Private IP Addresses
5.2.3: Unicast, Broadcast, Multicast
 In
addition to address classes, we
also categorize IP addresses as :
◦ Unicast - one-to-one
◦ Broadcast - one-to-many
◦ Multicast- one-to-all
Unicast Addresses
A unicast address is the most common type on
an IP network.
 A packet with a unicast destination address is
intended for a specific host.

◦ Example: a host with IP address 192.168.1.5 (source)
requests a web page from a server at IP address
192.168.1.200 (destination)
For a unicast packet to be sent and received, a
destination IP address must be in the IP packet
header.
 A corresponding destination MAC address must
also be present in the Ethernet frame header.
 The IP address and MAC address combine to
deliver data to one specific destination host.

Unicast Addresses
Multicast IP Address






Multicast IP addresses allow a source device to
send a packet to a group of devices.
Devices that belong to a multicast group are
assigned a multicast group IP address.
The range of multicast addresses is:
◦ 224.0.0.0 to 239.255.255.255
Since multicast addresses represent a group of
addresses (sometimes called a host group), they can
only be used as the destination of a packet.
The source will always have a unicast address.
Examples:
◦ Remote gaming, with many players connected remotely to
the same server
◦ Distance learning through video conferencing, with many
students connected
Multicast MAC Addresses
A packet with a destination multicast IP address
needs a corresponding multicast MAC address to
actually deliver the packet on the local network.
 The multicast MAC address is a special value
that begins with 01-00-5E in hexadecimal.
 The rest of the address is a result of converting the
lower 23 bits of the IP multicast group address into
the remaining 6 hexadecimal characters of the
Ethernet address.
 Example:

◦ Multicast IP Address: 224. 15.100.197
◦ Multicast MAC Address: 01-00-5E-0F-64-C5
Multicast MAC Address Example
Multicast IP Address: 224.15.100.197
 Multicast MAC Address: 01-00-5E-0F-64-C5

◦ 01-00-5E - Standard Multicast MAC prefix
◦ 0F-64-C5 = The last 23 bits of the Multicast IP
address in HEX
 Conversion:
◦
◦
◦
◦
The last 23 bits of the IP address are:
0001111.01100010.11000101
Those bits in Hex are:
000 = 0
1111= F (15)
0110 = 6
0010 = 4
1100 = C (12)
0101 = 5
Multicast Addresses
Broadcast IP Address
A Broadcast IP Address has all ones (1s) in the
host portion.
 A Broadcast packet will be received and looked at
by every host in the local network, or in the
broadcast domain
 Many network protocols, such as ARP and DHCP
use broadcasts.
 Examples:

◦ The Class C network 192.168.1.0 uses the Broadcast
address 192.168.1.255
◦ The Class B network 172.16.0.0 uses the broadcast
address 172.16.255.255
◦ The Class A network 10.0.0.0 uses the broadcast address
10.255.255.255.
Broadcast MAC Address
A
packet with a broadcast IP address
needs a corresponding broadcast MAC
address in the Ethernet frame.
 On Ethernet networks, the broadcast
MAC address is FF-FF-FF-FF-FF-FF
Broadcast Addresses
5.3.1: Static IP Addresses



With static IP assignment, the network administrator must
manually configure the network information for a host.
At a minimum, this includes the host IP address, subnet mask
and default gateway.
Static addresses have some advantages:
◦ Useful for printers, servers and other networking devices that need
to be accessible to clients on the network.
◦ Can provide increased control of network resources,

Static Addresses have some disadvantages:
◦ Time Consuming
◦ The host only performs basic error checks on the IP address. So
errors are more likely to occur.

When using static IP addressing, it is important to maintain
an accurate list of which IP addresses are assigned to which
devices.
Static IP Addressing
Dynamic IP Addresses
Dynamic Assignment of IP Addresses is achieved
using a protocol known as Dynamic Host
Configuration Protocol (DHCP).
 DHCP can provide the automatic assignment of
addressing information such as IP address, subnet
mask, default gateway, and other configuration
information.
 Advantages:

◦
◦
◦
◦
On local networks the user population changes frequently
It reduces the burden on network support staff
It virtually eliminates IP Address entry errors
Addresses are not permanently assigned to a host but are
only leased for a period of time. If the host is powered
down or taken off the network, the address is returned to
the pool for reuse.
Dynamic IP Addressing
5.3.2: DHCP Server

How does a Host receive an IP Address with DHCP?
◦ The host acts as a DHCP client and contacts the local DHCP
server
◦ The DHCP server assigns an IP address to your laptop.

A DHCP Server is a device that is running the DHCP
service software.
◦ A dedicated PC or server (medium to large networks)
◦ An Integrated Router (home networks)
◦ A dedicated Router (an ISP)

Many home networks and small businesses use an
integrated router to connect to the ISP modem.
◦ In this case, the integrated router is both a DHCP client and a server.
◦ The integrated router acts as a client to receive its IP configuration
from the ISP and
◦ It then acts a DHCP server for internal hosts on the local network.
DHCP Services
5.3.3 DHCP Negotiation


When a host is first configured as a DHCP client, it does not
have an addressing information
It obtains this information from a DHCP server, either on
the local network or one located at the ISP.
◦ The DHCP server is configured with a range, or pool, of IP addresses
that can be assigned to DHCP clients.

1.
These are the 4 steps in the DHCP Negotiation Process:
When a client configured with DHCP boots, it sends out a
DHCP Discover message
◦
◦
2.
3.
4.
Using the broadcast destination IP 255.255.255.255 and the
broadcast destination MAC FF-FF-FF-FF-FF-FF
All hosts on the network will receive this broadcast DHCP frame,
but only a DHCP server will reply.
The DHCP server will respond with a DHCP Offer,
suggesting an IP address for the client.
The host then sends a DHCP Request to that server
asking to use the suggested IP address.
The server responds with a DHCP Acknowledgment.
Configuring DHCP on an ISR


For most home and small business networks, a multi-function
device provides DHCP services to the local network clients.
To configure a Linksys wireless router, you access its graphical
web interface by opening the browser and entering the in the
router’s default IP address: 192.168.1.1
◦ Other brands of wireless routers might use the default address
192.168.1.254 or 192.168.2.1
◦ The IP address 192.168.1.1 and subnet mask 255.255.255.0 are the
defaults for the internal router interface.
◦ This is the default gateway for all hosts on the local network and also
the internal DHCP server IP address.

DHCP configuration:
◦ Most ISR have DHCP Server enabled by default
◦ Use the default DHCP range or specify your own (do not use
192.168.1.1)
◦ Specify the lease time (default is 24 hours).

Verify DHCP Configuration:
◦ The DHCP Client Table shows the client name and whether it is
ISR DHCP Configuration
5.4.1: Default Gateway






A router provides a gateway through which hosts on one
network can communicate with hosts on different networks.
Each interface on a router is connected to a separate
network.
The IP address assigned to the router interface identifies
which local network is connected directly to it.
Every host on a network must use the router as a gateway
to other networks.
Therefore, each host must know the IP address of the
router interface connected to the network where the host
is attached.
This address is known as the default gateway address.
◦ It can be either statically configured on the host, or received
dynamically by DHCP.
Default Gateway with an ISR
When an integrated router is configured to be a
DHCP server for the local network, it automatically
sends the correct interface IP address to the hosts
as the default gateway address.
 All hosts on the network can use that IP address to
forward messages to hosts located at the ISP and
get access to hosts on the Internet.
 The IP address of that local router interface
becomes the default gateway address for all hosts
on the network

Default Gateway
5.4.2: Address Assignment
When hosts on a local network use the services of
a DHCP server, they are referred to as being
located on an internal, or inside, network.
 Most DHCP servers are configured to assign
private addresses to the hosts on the internal
network

◦ This secures the internal network because it is not
directly accessible from the Internet
Many ISPs also use DHCP servers to provide IP
addresses to the Internet side of home or small
business routers installed at their customer sites.
 The network address assigned to the Internet side
of the integrated router is referred to as the
external, or outside, network.

ISR Address Assignment
The default IP address configured on an ISR router interface
is usually a private Class C address.
 The Internal hosts must also be assigned addresses within
the same network as the integrated router, either statically
configured, or through DHCP.
 When configured as a DHCP server, the integrated router
provides host addresses in this range.
 It also provides the subnet mask information and its own
interface IP address as the default gateway.
 When an integrated router is connected to the ISP, it acts
like a DHCP client to receive the correct external
network IP address for the Internet interface.
 When using an ISR on a home network, all hosts use the
same PUBLIC Internet-routable address to connect to
the internet

IP Address Assignment
Internal Network
External Network
Address Management
There are several ways hosts can be connected to an ISP and the Internet.
 Whether or not an individual host is assigned a public or private address depends on how
it is connected.


Direct Connection
◦ A single host with a direct connection from the ISP through a modem
◦ A public address from the ISP’s DHCP server is assigned to the host

Connection Through an Integrated Router
◦
◦
◦
◦

More than one host that needs access to the Internet
The ISP modem and hosts are attached directly to an ISR
The ISR receives a public address from the ISP
Internal hosts receive private addresses from the ISR
Connection Through a Gateway Device
◦ Gateway devices combine an integrated router and a modem in one
unit
◦ The Gateway is directly connected to the ISP service
◦ The gateway device receives a public address from the ISP
◦ Internal hosts receive private addresses from the gateway device
Address Management
5.4.3: NAT

When a network is using one or a few Public IP address and
Private IP addresses internally, a process is needed to
translate private addresses into unique public addresses
◦ The hosts on the internal network must share the single Public
Internet routable addressed assigned to the network or household

The process used to convert private addresses to Internetroutable addresses is called Network Address
Translation (NAT).
◦ Internal private source IP addresses are translated to one or more
public IP address.
◦ Only packets destined for other networks need to be translated.

NAT Servers provide this translation process
◦ A NAT server is a device like an ISR or a dedicated PC server
configured with NAT software
◦ NAT servers are able to translate many internal IP addresses to the
same public address
NAT Translation





So how do NAT servers keep track of which private IP
addresses sent or should receive a packet?
The NAT server adds a port number to the IP Packet, in
order to keep track of which internal private IP address sent
the message
Each internal Private IP Address is assigned a different port
number, to keep track of which packets go to which address
The internal Private IP addresses are called Inside Local
Addresses
The public IP address that all hosts must use to connect to
the internet is called the Inside Global Address
NAT
Inside Global Address
(Public IP Address)
Inside Local Addresses
(Private IP Address)
5.5: Booleans and Anding
Computers operate based on electronic circuits
 The circuits in a computer depend on logic
gates, which are like little decision makers that
receive binary input and produce an output in
binary
 The logic gates are used to make decisions and
to make comparisons between data
 A logic gate accepts 1’s and 0’s as input,
compares the bits and then produces a binary
output of 1 or 0

Logic Gates
The 3 primary logic gates are:
 AND
◦ if either input is off (0), the result is off (0)
◦ And is like multiplication (0 x anything is 0)

OR
◦ if either input is on (1), the result is on (1)
◦ Or is like adding (think of it like adding 1 to something)

NOT
◦ if the input is on (1), the result is off (0)
◦ if the input is off (0), the result is on (1)
◦ NOT is the exact reverse of the input
There is also 1 additional Gate:
 NOR
◦ if either input is on (1), the result is off (0)
◦ A combination of NOT and OR
Boolean Operations
AND 0
1
NOT
0
0
0
0
1
1
0
1
1
0
OR
0
1
NOR 0
1
0
0
1
0
1
0
1
1
1
1
0
0
ANDING
Earlier we saw how a host uses its Subnet Mask
to make comparisons against its own IP address
and the IP address of a destination packet, to
see if they are on the same network.
 The process that is used to compare a Subnet
Mask against an IP address, is called ANDING
 When ANDING, each bit in the IP Address is
compared with each bit in the Subnet Mask,
using the AND boolean operation
 The result is the network address that the host
address belongs to

ANDING

Example: a host compares its subnet mask
with its IP address to see which Network it
belongs to
IP Address: 192.100.10.33
 Mask:
255.255.255.0
Anding Process:

Network Address = 192.100.10.0
5.1 Summary
5.2 Summary
5.3 Summary
5.4 Summary