IP Addressing and subnetting

cursefarmΔίκτυα και Επικοινωνίες

24 Οκτ 2013 (πριν από 3 χρόνια και 8 μήνες)

91 εμφανίσεις

IP Addressing


An IP address is 32
-
bit long.



It is usually written as four decimal numbers separated by


dots (periods) (dotted decimal notation)



In hex, each of the four hexadecimal numbers is

called an


octet.



Example: 137.207.192.003 or 89 CF C0 03



An IP address contains a network part and a host part.



The number of address bits used to identify the network, and


the number to identify the host, vary according to the class of


the address.



Routers or gateways have one or more addresses


(depending on the no. of links they have) The three main


address classes are class A, class B, and class C.



By examining the first few bits of an address, IP software can


quickly determine the address class, and therefore its structure
.

IP Addressing

Note:


For Class A: Have a first dotted decimal number in the range 1
-
126

For Class B: Have a first dotted decimal number in the range 128
-
191

For Class C: Have a first dotted decimal number in the range 192
-
223

IP Addressing


There are five forms of IP addresses:


Class A :126 networks, each can have up to (16M
-
2) nodes.

(1.0.0.0
-

126.0.0.0)


Class B: (16K
-
2) networks, each can have up to (64K
-
2)
nodes

(127.0.0.0
-

191.255.0.0)


Class C: (2M
-
2) networks, each can have up to 254 nodes.

(192.0.0.0
-

223.255.255.0)


Class D: a multicast address.

(224.0.0.0
-

240.0.0.0)


Class E: reserved for future use.

(241.0.0.0
-

248.0.0.0)




IP address format

IP address

For example:

The address (binary)
-

10000000 00000111 00001111 00000001

has the DECIMAL DOT NOTATION: 128.7.15.1

It belongs to Class B addresses.

Its Network
-
id is: 128.7

Its Host
-
id is: 15.1


IP Addresses assignment example

Class A


If the first bit of an IP address is 0, it is the address of a
class A network.

The first bit of a class A address identifies the address
class.

The next seven bits identify the network, and

the last 24 bits identify the host.



There are fewer than 128 class A network numbers, but
each class A network can have millions of hosts.


Class A


|_| first one bit is used to determine the class to which an address
belongs to for Class A address.


|_______| 7 bits are used for Network address.Therefore, the number
of class A networks can be 2
7

= 128. Number 0 is

not used, and
number 127 is used for testing loopback for each host. There are 126
potential Class A network numbers, which have a first dotted decimal
number in the range 1 to 126.

|________________________| 24 bits are used for host address.
Therefore, each Class A network can have 2
24
= 16,777,216 hosts.


Class A is not available to the general public, and it is restricted to
special uses.



Class A final format:



|_|_______| |________________________|


7 bits
















24 bits

Network








Host






Part


















Part



Class A


Summary:





If the the first decimal number in IP address is 1 to


126, then it is a class A address.



The first byte is for the network number, and the next three



bytes are for the host addresses.


Class B




If the first two bits of the address are 1and 0, it is a class B


network address.



The first two bits identify class; the next fourteen


bits


identify the network, and the last sixteen bits


identify the host.



There are thousands of class B network numbers.



Each class B network can have thousands of hosts.


Class B


|__| first two bits are used to determine the class to
which an address belongs to for class B address.


|______________| 14 (6 + 8) bits are used for network
address. Therefore, the number of class B networks can
be 2
14

= 16,384. There are 16,384 potential Class B
network numbers, which have a first dotted decimal
number in the range 128 to 191.




|________________| 16 bits are used for host address.
Therefore, each Class B network can have 2
16
= 65,536
hosts.



Class B


Class B final format



|__|______|________| |________________|

14 bits Network part





16 bits Host part

Summary:





If the the first decimal number in IP address is 128 to


191, then it is a class B address.



The first two bytes identify the network.



The last two bytes identify the host.


Class C




If the first three bits of the address are 1 1 0, it is a


class C network address.



The first three bits are class identifiers.



The next 21 bits are for the network address.



The last eight bits


identify the host.



There are millions of class C network numbers.



However, each class C network can have 254 hosts.


Class C


|___| first three bits are used to determine the class to
which an address belongs to for class C address.


|_____|________|________| 21 (5 + 16) bits are used
for network address. Therefore, the number of class
C networks can be 2
21

= 2, 097,152. There are
2,097,152 potential Class C network numbers, which
have a first dotted decimal number in the range 192
to 223.


|________| 8 bits are used for host address.
Therefore, each Class C network can have 2
8
= 256
hosts.



Class C


Class C final format



|___|_____| |________| |________| |________|

21 bits Network part




























8 bits host part


Summary:





If the the first decimal number in IP address is 192 to


223, then it is a class C address.



The first three bytes are for the network address.



The last byte is for the host number.


Summary


Class A:Few networks, each with many
hosts.


Class B: Medium number of networks, each
with a medium number of hosts


Class C: Many networks, each with a few
hosts.

Loopback Address


IP defines a loopback address used to test network applications.


Programmers often use loopback testing for preliminary
debugging after a network application has been created.


To perform a loopback test, a programmer must have two
application programs that are intended to communicate across a
network.


Each application includes the code needed to interact with
TCP/IP protocol software.


Instead of executing each program on a separate computer, the
programmer runs both programs on a single computer and
instructs them to use a loopback IP address when
communicating.

Loopback Address


When one application sends data to another, data travels
down the protocol stack to the IP software and then IP
software forwards it up through the protocol stack to the
second program.


Thus programmer can test the program logic quickly
without using two computers and without sending packets
across the network.


During loopback testing, packets do not leave a computer
and the Ip sofware forwards the packets from one
application to another application.


The loopback address never appears in a packet travelling
across a network.

Limited Broadcast Address


Refers to a broadcast on a local physical network.


Informally, the broadcast is limited to a “single
wire”.


Limited broadcast is used during startup by a
computer that does not yet know the network
number.


IP reserves the address consisting of all 1 bits to refer
to limited broadcast.


IP will broadcast any packet sent to the all
-
ones
address across the local network.

Use of different Class addresses


In some environment, it may be best to use
addresses all from one class.


For example, a corporate internet that consists of a
large number of departmental LANs may need to
use Class C addresses exclusively.


However, the format of the addresses allow us to
mix all three classes of the addresses on the same
internet. Example: Internet.


We will prefer a mixture of classes for an internet
consisting of a few large networks, many small
networks, plus some medium
-
sized networks.

Address Depletion



The
TCP/IP
designers did not think about the enormous scale of


today's network.



When TCP/IP was being designed, networking was limited to


large organizations that could afford substantial computer


systems.



The idea of a powerful UNIX system on every desktop, or X
-


terminal or a PC with X
-
Ware (PC software to emulate X
-


terminal) did not exist.




At That time, a 32
-
bit address seemed so large that it was


divided into classes to reduce the processing load on routers.

Address Depletion



For example, assigning a large network a single class B address,


instead of few class C

addresses, reduces the load on the router,


because the router only needs to keep one route for that entire


organization.



However, the organization that was given the class B address


probably does not have 64,000 computers, so most of the host


addresses available to the organization will never be assigned.



The current design, which favors routers over growth, is under


critical strain from the rapid growth of the Internet. At the present


rate of growth, all class B addresses could be exhausted soon!.



To prevent this, blocks of class C addresses are being assigned to


organizations, but each class C address requires its own entry


within the routing table.



This solution could cause the routing table to grow so rapidly that


the routers will soon be overwhelmed.

Address Depletion

These problems are being addressed by the ROAD (Routing
and Addressing) working group of the
Internet Engineering
Task Force (IETF).

They are looking for a scheme that:



It will improve the problem of address depletion,


perhaps by moving to a larger address, 160
-
bit address!



Classless addresses.



Implementation of new routers, without requiring


changes to the end
-
systems (the hosts).

We don't know what technique will be adopted by the
IETF

to
overcome the problems of address depletion. However,
according to them, whatever happens, the changes should not
have any near
-
term effect on your hosts, and IP addressing
will be same at least for some time.

Why subnetting?


Preservation of address space


Control network traffic, avoid collisions


Reduce the routing complexity


Improve network performance


Security

Subnetting

Subnetting is a method for getting the most out of the limited 32
-
bit IP addressing space. With any address class, subnetting
provides a mean of allocating a part of the host address space to
network addresses, which will let you have more networks. The
part of the host address space allocated to new network addresses
is known as the subnet number.


The
InterNIC
assigned the University of Windsor one class B
Network address, which is 137.207.0.0 with network number part
137.207. The Host number part is left to be assigned by the local
management
-

The Computing Services)

Subnetting

Subnetting



In class B IP address, the 2 right
-
hand bytes assigned for the host


number, can be subdivided into 254 subnetworks and 254 hosts to


each subnetwork number.



Which bits in the host address bytes will be applied to subnet


addresses and which to host addresses is determined by a subnet


mask, or netmask.(/etc/netmasks)



The netmask can be applied to an IP address using the bitwise


logical AND operator.



If a netmask 255.255.255.0 (or FF.FF.FF.00) is applied to the


address 137.207.192.003 (or 89 CF C0 03), the result is a network


number 137.207.192.0


i.e.:




137.207.192.003 & 255.255.255.000


= 137.207.192.000

or,



89 CF C0 03 & FF FF FF 00


= 89 CF C0 00.

Subnetting

In binary form, the operation is:

10001001 11001111 11000000 00000011 (IP address )

AND

11111111 11111111 11111111 00000000 (netmask)

------------------------------------------------------------------------

10001001 11001111 11000000 00000000 (masked number)


Now the system (router or server) will look for a network number
of 137.207.192.000 instead of a network number of 137.207., then
the router (or the server) will locate the host (workstation) from its
table, and adds the corresponding machine number to get
137.207.192.003.

To increase the host number from 254, a
different mask number could be used for less subnetworks and
more hosts.

Default subnet masks:


Class A

-

255.0.0.0
-

11111111.00000000.00000000.00000000

Class B

-

255.255.0.0
-

11111111.11111111.00000000.00000000

Class C

-

255.255.255.0
-

11111111.11111111.11111111.00000000


Subnetting

IP Subnetting


Subnetting is a technique used to allow a single IP
network address to span multiple physical networks.

IP hosts should support subnetting.


Subnetting is done by using some of the bits of the
host
-
id part of the IP address as a physical network
identifier.


The subnet mask is used to determine the bits of the
network identifier.


All hosts on the same network should have the same
subnet mask.

IP
-

The Next Generation (IPng
-

IPv6)


The growing number of INTERNET hosts causes a shortage in
IP addresses and will eventually consume the entire address
space.


The theoretical address space size (2^32 nodes) is largely wasted

due to assignment inefficiencies.


Dividing the address space into classes (A, B and C) had its own

contribution to the inefficiency of addresses assignment.


Changing the IP addressing scheme is a matter concerning all

INTERNET users and is an opportunity for providing additional

functionality to the IP.


The new version of IP is often referred to as IPng:

"INTERNET Protocol: The Next Generation".

Most INTERNET users agreed IPng should have a hierarchical

address structure. This new address structure should be large

enough to meet the needs of the INTERNET community for a
very long time.



IP
-

The Next Generation (IPng
-

IPv6)


There were several proposals for IPng. The most likely to
become a standard were: "Common Architecture for the
INTERNET" (CATNIP) "Simple INTERNET Protocol Plus"
(SIPP), and "The TCP/UDP Over CLNP
-
Addressed Networks
(TUBA) proposals.


The guidelines for choosing one proposals over the others were:



Current address assignment policies should not be changed.



There is no need to reclaim assigned network numbers



There is no need to renumber most of the INTERNET


Eventually the "Simple INTERNET Protocol Plus (SIPP) Spec.

(128 bit ver)" was adopted as the basis for IPng.


IPng was assigned the name IPv6.


IPng
-

IPv6 addressing


IPng offers a larger address space for the INTERNET
users.


The IP address size will be increased from 32 bits to
128 bits.


This change will allow a much bigger number of nodes
than is available today, with more levels of addressing
hierarchy, and simpler auto
-
configuration of addresses.


An address size of 128 bits is large enough to support a
huge number of nodes even with the inefficiency of
address assignment.



IPv6 addressing: IP header


The IP header will be changed.


Some fields will be removed in order to keep the
overhead low (in spite of increasing the number of
address bits).


Thus, even though the IPv6 addresses are

four times longer than the IPv4 addresses, the IPv6
header is only twice the size of the IPv4 header.


A new function in IPv6 is source routing, which
together with Cluster addresses will allow nodes to
control their routing in a more precise way.




Upgrading IPv4 to IPng
-

IPv6


The transition from IPv4 to IPv6 will be simple and
flexible.


The upgrade will be Incremental: existing IPv4 hosts
and routers may be upgraded to IPv6 and new hosts and
routers can be installed independently.


When existing IPv4 hosts or routers are upgraded, they
can continue to use their current address.


The start
-
up costs are low and little work is needed to
upgrade existing systems to IPv6.