Sunteți pe pagina 1din 46

Lecture-1

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

Some of the graphics used in this lecture are courtesy of Wendell Odom

Layered architecture (OSI and TCP/IP)

When we communicate on networks, there is a multitude of tasks that have to be


performed: for instance:
Representing the data (voice, video, text) in the required format, presentable
over the networks
Creating rules of engagement with other entities
Ensuring reliable delivery to the other end
Finding the right entity on a network of millions of entities
Reaching the right entity thousands of miles away within given delay
constraints
Network access heterogeneity
End to end security - data encryption
Access security authentication rules

There are separate rules in place for performing these tasks (in the form of
network protocols).
These set of rules change when either the access network, the backbone
network or the form of application data changes.
So do we have to change everything altogether to accommodate an
update/change?

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

10

Consider the simple process of requesting a home-page from a web server:


1.
2.
3.
4.
5.

6. Mapping IP to MAC address (ARP and then RARP at


the other end)
7. Forming MAC/Data Link frames, specific to access
network and then ripping them apart
8. Physical transmission
9. Authentication at various levels, security of
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.
11
transmission, etc, etc.

HTTP
HTML, SQL scripts, PHP
TCP connection
IP address from domain name (DNS)
Routing from source to destination

Simplifying the mess


The idea of grouping the long list of tasks into different layers was
coined for:
Simplicity
Layer to layer abstraction
Providing independence to developers at various layers (Modular
engineering)

So, now we can group the tasks into independent layers:

Network application design, data representation and formatting


End to end delivery of data between peers
Addressing, finding end to end peers
Local (first hop) dealing, addressing, error detection, framing/grouping
Physical transmission
However, grouping tasks into layers without a standard was not a viable
option and the result is:
Vendor interoperability issues
Conflicts in developments
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

12

The Open Systems Interconnections


(OSI)networking model
The International Standardization Organization (ISO)
developed the OSI model to standardize the protocol
development.
7
6
5
4
3
2
1
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

13

OSI layers and their functions

Application Layer: serves as an interface between the rest of the protocol


stack and network applications.
Presentation Layer: defines and negotiates presentation format of data
exchanged over the network, e.g. HTML. Compression and encryption is
also defined by the OSI as a presentation layer service.
Session Layer: Its job is to facilitate in starting, controlling and ending
communication sessions over a network.
Transport Layer: provides several significant services mainly related with
end to end transport to data across a network, error recovery and flow
control.
Network Layer: defines three main features: (1) Logical addressing of
nodes in a network, routing (forwarding function) and route discovery.
Logical (Internet Protocol IP) address identifies a device in an IP based
network, route discovery function selects best routes out of multiple
available routes which is used by a forwarding function.
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

14

OSI layers and their functions

Data link Layer: serves for controlling, monitoring the exchange of data
(frames) over a medium. Error detection, framing (dividing into right sized
chunks) and medium access regulation are some of the key functions
assigned to protocols that reside at this layer.
Physical Layer: defines the characteristics that a transmitter and receiver
should have to communicate on a physical/wireless medium. Modulation
schemes, connectors, multiplexing etc, are dealt at this layer.

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

15

OSI encapsulation concepts

As we will see that TCP/IP gives a separate name to data according to the
level (layer) for instance it is called segment, packet and frame at
Transport, Network and Data link layers respectively.
OSI naming is different, rather more generic; called protocol data unit
(PDU).
A layer x PDU consists of encapsulated data, header and trailer attached
at layer x.
For instance, an MSDU received at MAC sublayer of IEEE 802.11, becomes
a MAC PDU (MPDU) after MAC headers are attached and later on
becomes a PHY PDU (PPDU) at the PHY.

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

16

TCP/IP Networking model a touch of


history
Like many successful projects, the roots of TCP/IP networking
model trace back to U.S. DoD project.
It was backed by a number of researchers (free lance) from a
number of universities.
Around the late 80s there were several proprietary
networking models, the OSI and TCP/IP to compete.
The slow standardization process of OSI, idealistic approaches
slowed down its success compared to the very prolific TCP/IP
model.
OSI is used a reference model, TCP/IP as a practical model.

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

17

TCP/IP Networking model

Segment
Packet
Frame

The protocols in the TCP/IP suite are defined in documents called Requests
for Comments (RFCs).
By implementing a protocol x defined in a certain RFC, a network-station
can confidently communicate with a peer on a network without considering
interoperability issues.
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

18

The Encapsulation and Headers story


Segment
Packet
Frame

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

19

Logical Network addressing


Every communicating station on a TCP/IP network needs a
unique network address.
A logical network (IP) addressing scheme is used for this
purpose.
An IP (v4) address consists of 32 bit numbers, usually
written in dotted decimal.
For instance, 11000000 10101000 00000100 00000001 is
written in dotted decimal as 192.168.4.1 (in 8-bits, the total
range in each octet is from 0-255).
An IP address consists of a network part and a host part.
The length of each of these two parts depends on the class
of IP address.

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

20

Logical Network addressing


Every interface of a router connects to a different network.
Dividing the IP address makes it easy for the routers to take
the routing decision based on the network part of the IP.
It shows that:
All addresses in the same network (with same network prefix) should
not be separated by a router.
IP addresses separated by a router should be in different networks.

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

21

Classes of IP-addresses

The IP addresses are divided into 5 classes, A to E.


The IP address-class would indicate the size of a network.
Class

IP Address

Network ID

Host ID

a.b.c.d

b.c.d

a.b.c.d

a.b

c.d

a.b.c.d

a.b.c

Class-A address has a large number of hosts, assigned to large networks: 126
Networks, with approximately 17 million hosts per network.
Class-B address is assigned to medium to large size networks. Class B allows for
16,384 networks, and 65,000 hosts per network.
Class-C address is assigned to small sized networks. This class has approx. 2
million networks, with 254 hosts per network.
Classes D and E are not allocated to hosts.
Class D addresses are used for multicasting
Shahbaz Khan,for
N.W.F.P.
U.E.T, 2009.
22
Class E addresses areDr.reserved
future
purposes.

Classes of IP-addresses

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

23

IP Network Masks
IP address masks are used to distinguish the Network and
Host part of an IP address
Network masks are usually written in dotted decimal format
The first part of a network mask contains binary 1s to
represent the Network part
The second part contains binary 0s to represent the Host
part, in case of no subnetting, or it represents Network and
host part, in case of subnetting

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

24

Private IP addresses
Every station connected to the internet should have a unique
address.
With expansion of internet, IP address scarcity became a
problem.
A logical solution to tackle such a problem is not to assign a
unique address to stations which are not connected to the
internet.
Such addresses which are not routable over the internet* are
called private IP address.
IP addresses from each of the three classes are reserved as
private IP addresses.
* Organizations are not allowed to advertise these addresses using routing
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.
protocols over the internet

25

Private, Static and Dynamic IP addresses

IP addresses configured manually are called static addresses.


Normally, routers, servers etc use statically configured IP
addresses (for very obvious reason)
IP addresses which are assigned randomly (on the fly) by a
server (program, e.g. DHCP) are called Dynamic IP addresses.

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

26

Dynamic Host Configuration Protocol


(DHCP)
DHCP defines the mechanism of loaning an IP address to IP
hosts dynamically
Clients request an IP address from a DHCP server.
The server is aware of a list of addresses that it can assign
(belonging to a particular subnet)
The clients request is responded with an IP address and the
server marks that IP as assigned to avoid duplicate
assignment
DHCP also supplies further information to its client, for
instance:
The subnet mask
The default gateway
The IP address of a DNS server
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

27

DHCP

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

28

Domain Name System (DNS)


What happens when you type www.google.com ?
How does your computer find a web sever, which can be
identified only through an IP address while you know only its
name?

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

29

Network Address Translation (NAT) and


Port Address Translation (PAT)

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

30

Network Address Translation (NAT) and


Port Address Translation (PAT)

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

31

NAT and PAT


NAT translates the Network layer (layer-3) addresses with no
translation of port numbers.
PAT translates the Network layer addresses along with
translation of transport layer port numbers.
In general, the terms are used carelessly with NAT implying
PATs functionality.

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

32

Number Conversions: Binary, Decimal (A


refresher!!)
To convert a decimal to binary, repeatedly divide the decimal
with 2 (which is the base) and collect the remainders, which is
the binary equivalent
For example 23 decimal is:
23 2  11 R 1 (LSB)
11 2  5 R 1
52 2 R1
22 1 R0
1 2  0 R 1 (MSB)

Therefore, 23 decimal is 10111 binary

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

33

IP subnetting

In the given scenario:


1.
2.
3.
4.
5.

The organization (for instance the UET) is assigned a class C address: 216.21.5.0
The aim is address the whole network using this allocated address
5 Subnets are required
Determine the subnet masks
Determine the address range of each of the 5 subnets
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

34
Subnetting examples courtesy of Jeremy Cioara

IP subnetting rules and example (1)


The three famous rules of subnetting:

Objective:
Class C IP: 216.21.5.0
Default subnet mask: 255.255.255.0
Networks= 5

Determine the number of networks and write it in Binary form


5 decimal is 00000101 binary
It takes 3 bits to make the number 5 (which is the number of
networks)
Reserve the MSBs in the subnet mask according to the number in
step 1
Default mask is:
1111 1111. 1111 1111. 1111 1111.0000 0000
Reserve 3 bits in the MSB of the host part so that the new mask looks
like:
1111 1111. 1111 1111. 1111 1111.1110 0000 or 255.255.255.224 (d. d)
Find the increment and use it to calculate the subnet range
The increment is the lower Network bit in the New subnet mask:
1111 1111. 1111 1111. 1111 1111.1110 0000, with a decimal value of 32
(in this case)
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

35

IP subnetting example (1)


Objective:
Class C IP: 216.21.5.0
Default subnet mask: 255.255.255.0
Networks= 5

With an increment of 32, the subnet ranges are:


First subnet:

216.21.5.0

to

216.21.5.31

Second subnet:

216.21.5.32

to

216.21.5.63

Third subnet:

216.21.5.64

to

216.21.5.95

Fourth subnet:

216.21.5.96

to

216.21.5.127

Fifth subnet:

216.21.5.128

to

216.21.5.159

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

36

IP subnetting rules and example (2)


The three famous rules of subnetting:

Objective:
Class C IP: 195.5.20.0
Default subnet mask: 255.255.255.0
Networks= 50

Determine the number of networks and write it in Binary form


50 decimal is 0011 0010 binary
It takes 6 bits to make the number 50 (which is the number of
networks)
Reserve the MSBs in the subnet mask according to the number in
step 1
Default mask is:
1111 1111. 1111 1111. 1111 1111.0000 0000
Reserve 6 bits in the MSB of the host part so that the new mask looks
like:
1111 1111. 1111 1111. 1111 1111.1111 1100 or 255.255.255.252 (d. d)
Find the increment and use it to calculate the subnet range
The increment is the lower Network bit in the New subnet mask:
1111 1111. 1111 1111. 1111 1111.1111 1100, with a decimal value of 4
(in this case)
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

37

IP subnetting example (2)


Objective:
Class C IP: 195.5.20.0
Default subnet mask: 255.255.255.0
Networks= 50

With an increment of 4, the subnet ranges are:


First subnet:

195.5.20.0

to

195.5.20.3

Second subnet:

195.5.20.4

to

195.5.20.7

Third subnet:

195.5.20.8

to

195.5.20.11

Fourth subnet:

195.5.20.12

to

195.5.20.15

Fifth subnet:
..

195.5.20.16

to

195.5.20.19

50th subnet:

195.5.20.200

to

195.5.20.203

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

38

IP subnetting comes at a price


Benefits of subnetting are very clear however, it comes at
certain price.
Consider the IP address in previous example (slide): Class C IP:
195.5.20.0
It has a range of 195.5.20.0 to 195.5.20.255
However, the address 195.5.20.0 identifies the Network and
cannot be assigned to a network host
Likewise, the last address: 195.5.20.255 represents the
broadcast address for this range and cannot be assigned to a
host.
Same rules applies to the first and last addresses in subnets.
Consider the example in the previous slide, with 50 subnets;
the scale of wastage is quite high!
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

39

IP subnetting rules and example (3)


The three famous rules of subnetting:

Objective:
Class B IP: 150.5.0.0
Default subnet mask: 255.255.0.0
Networks= 100

Determine the number of networks and write it in Binary form


100 decimal is 0110 0100 binary
It takes 7 bits to make the number 100 (which is the number of
networks)
Reserve the MSBs in the subnet mask according to the number in
step 1
Default mask is:
1111 1111. 1111 1111. 0000 0000.0000 0000
Reserve 7 bits in the MSB of the host part so that the new mask looks
like:
1111 1111. 1111 1111. 1111 1110. 0000 0000 or 255.255.254.0 (d. d)
Find the increment and use it to calculate the subnet range
The increment is the lower Network bit in the New subnet mask:
1111 1111. 1111 1111.1111 1110. 0000 0000, with a decimal value of 2
(in this case)
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

40

IP subnetting example (3)


Objective:
Class B IP: 150.5.0.0
Default subnet mask: 255.255.0.0
Networks= 100

With an increment of 2, the subnet ranges are:


First subnet:

150.5.0.0

to

150.5.1.255

Second subnet:

150.5.2.0

to

150.5.3.255

Third subnet:

150.5.4.0

to

150.5.5.255

Fourth subnet:

150.5.6.0

to

150.5.7.255

Fifth subnet:
..

150.5.8.0

to

150.5.9.255

100th subnet:

150.5.200.0

to

195.5.201.255

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

41

IP subnetting rules and example (4)


The three famous rules of subnetting:

Objective:
Class A IP: 10.0.0.0
Default subnet mask: 255.0.0.0
Networks= 500

Determine the number of networks and write it in Binary form


500 decimal is 0110 0100 binary
It takes 9 bits to make the number 500 (which is the number of
networks)
Reserve the MSBs in the subnet mask according to the number in
step 1
Default mask is:
1111 1111. 0000 0000. 0000 0000.0000 0000
Reserve 9 bits in the MSB of the host part so that the new mask looks
like:
1111 1111. 1111 1111. 1000 0000. 0000 0000 or 255.255.128.0 (d. d)
Find the increment and use it to calculate the subnet range
The increment is the lower Network bit in the New subnet mask:
1111 1111. 1111 1111. 1000 0000. 0000 0000, with a decimal value of
128 (in this case)
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

42

IP subnetting example (4)


Objective:
Class A IP: 10.0.0.0
Default subnet mask: 255.0.0.0
Networks= 500

With an increment of 128, the subnet ranges are:


First subnet:

10.0.0.0

to

10.0.127.255

Second subnet:

10.0.128.0

to

10.0.255.255

Third subnet:

10.1.0.0

to

10.1.127.255

Fourth subnet:

10.1.128.0

to

10.1.255.255

Fifth subnet:
..

10.2.0.0

to

10.2.127.255

500th subnet:

10.250.0.0

to

10.250.127.255

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

43

IP subnetting Based on number of hosts


example (5) Objective:
Class C IP: 216.21.5.0
The three famous rules of subnetting:

Default subnet mask: 255.255.255.0


Hosts= 30

Determine the number of hosts and write it in Binary form


30 decimal is 0001 1100 binary
It takes 5 bits to make the number 30 (which is the number of hosts)
Reserve the MSBs in the subnet mask according to the number in
step 1
Default mask is:
1111 1111. 1111 1111. 1111 1111.0000 0000
Reserve 5 bits in the LSB of the host part so that the new mask looks like:
1111 1111. 1111 1111. 1111 1111.1110 0000 or 255.255.255.224 (d. d)
Find the increment and use it to calculate the subnet range
The increment is the lower Network bit in the New subnet mask:
1111 1111. 1111 1111. 1111 1111.1110 0000, with a decimal value of 32
(in this case)
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

44

IP subnetting Based on number of hosts


example (5) Objective:
Class C IP: 216.21.5.0
Default subnet mask: 255.255.255.0
Hosts= 30

With an increment of 32, the subnet ranges are:


First subnet:

216.21.5.0

to

216.21.5.31

Second subnet:

216.21.5.32

to

216.21.5.63

Third subnet:

216.21.5.64

to

216.21.5.95

Fourth subnet:

216.21.5.96

to

216.21.5.127

Fifth subnet:
..

216.21.5.128

to

216.21.5.153

Last subnet:

216.21.5.224

to

216.21.5.255

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

45

Reverse Engineering IP subnets


Objective:
IP: 192.168.1.127
Subnet mask: 255.255.255.224
Is the IP address valid? (Reverse Engineer)

Examine the subnet mask, find the increment


1111 1111. 1111 1111. 1111 1111.1110 0000, therefore, the
increment used here is 32 (decimal)
Now check the validity of the IP address 192.168.1.127 by
checking through the range of subnets
First subnet:

192.168.1.0

to

192.168.1.31

Second subnet:
.
4th subnet:

192.168.1.32

to

192.168.1.95

192.168.1.96

to

192.168.1.127

5th subnet:

192.168.1.128

to

192.168.1.159

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

Broadcast
address

46

Reverse Engineering IP subnets


Objective:
IP: 172.16.68.65
Subnet mask: 255.255.255.240, Gateway: 172.16.68.62
Is the IP address valid? (Reverse Engineer)

Examine the subnet mask, find the increment


1111 1111. 1111 1111. 1111 1111.1111 0000, therefore, the
increment used here is 16 (decimal)
Now check the validity of the IP address 172.16.68.65 by
checking through the range of subnets
First subnet:

172.16.68.0

to

172.16.68.15

Second subnet:
.
4th subnet:

172.16.68.16

to

172.16.68.31

172.16.68.48

to

172.16.68.63

5th subnet:

172.16.68.64

to

172.16.68.79

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

GW address
is in 4th
subnet

172.16.68.65
is the first
valid address
in this subnet
47

IP subnetting; a word of caution!

Values like, 2, 4, 8, 16, . can cause confusion while calculating the


number of networks
For instance, to subnet 4 networks, the number of bits required are: 128
64 32 16 8 4 2 1
0 0 0 0 001 1
Because 0 to 3 are four numbers (networks)
The same is not true while calculating the number of bits for hosts
(because of the first and last IP addresses in every network)
Values like, 3, 7, 15, 31, . can cause confusion while calculating the
number of hosts
For example the number of bits used to get 3 hosts in a network should be
3 (bits).

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

48

Variable Length Subnet Masks (VLSMs)


Objective: Use the most efficient addressing possible for the following network scenarios
IP: 192.168.1.0
Default Subnet mask: 255.255.255.0

20 users

20 users

60 users

Determining the VLSM is not different than the subnetting we


practiced in the previous slides
It involves solving multiple problems in one
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

49

Variable Length Subnet Masks (VLSMs)


Objective: Use the most efficient addressing possible for the following network scenarios
IP: 192.168.1.0
Default Subnet mask: 255.255.255.0, Networks with: 20, 20 and 60 hosts

Start with the largest subnet (which in this case is 60 hosts)


So, it requires 6 bits to represent 60
Increment is 64
Therefore, the subnet mask is 255.255.255.192
Therefore, the address range with this subnet mask for 60
user network is:
192.168.1.0
to
192.168.1.63
For the next subnet, 20 hosts need 5 bits, the increment is 32
Already assigned
Subnet mask is 255.255.255.224 or /27
Network ranges: 192.168.1.0 31, 192.168.1.32 63
192.168.1.64- 95, 192.168.1.96- 127

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

50

Variable Length Subnet Masks (VLSMs)


Objective: Use the most efficient addressing possible for the following network scenarios
IP: 192.168.1.0
Default Subnet mask: 255.255.255.0

192.168.1.64-95/27

192.168.1.96-127/27

20 users

20 users

192.168.1.0-63/26

60 users

For a two host network, the subnet mask is a /30


With network ranges from:
192.168.1.128-131/30
192.168.1.132-135/30
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

What about
these p-to-p
interfaces?

51

IPv6
Address scarcity is an issue with IPv4
Address depletion How long have we got?*
Different estimates, 2019, 2021, 2026.

Diversity in Access Networks and new mobile terminals means


more terminals would need globally routable addresses
Techniques like NAT which is an effort to conserve IPv4
addresses causes problems with some network applications
Mobility management techniques for new mobile networks
can work better in IPv6 addresses
Likewise, the current allocation of IPv4 addresses is unfair:
It is sometimes said that: IP addresses are hoarded by "developed
nations" - if only "underdeveloped" nations were given more IP
addresses, the Internet would grow more/better...
*http://www.potaroo.net/ispcol/2003-08/ale.html
http://www.circleid.com/posts/ip_address_allocation_vs_internet_production_i_understanding_the_relationsh
Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.
52

IPv6 addressing
IPv6 is a 128 bit address
A huge address space of 2128
The format to write an IPv6 address is to write it in 8 groups of
4 Hexadecimal numbers in each group
For instance: 3203:A39C:0000:0000:0000:0000:03A1:AA14
Simplifying the long addresses:
Groups of consecutive zeros can be eliminated, for instance:
3203:A39C::03A1:AA14
Leading zeros can be eliminated, for instance:
3203:A39C::3A1:AA14

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

53

IPv6 Simplified headers

Dr. Shahbaz Khan, N.W.F.P. U.E.T, 2009.

54

S-ar putea să vă placă și