nat and subnetting

41
Subnetting & NAT

Upload: saad-tanvir

Post on 23-Jan-2018

811 views

Category:

Education


3 download

TRANSCRIPT

Page 1: NAT and Subnetting

Subnetting & NAT

Page 2: NAT and Subnetting

Names ID’s

Maria Ahmed 14005065-083

Saad Tanvir 14005065-045

Talha Imdad 14005065-084

Hina Ilyas 14005065-068

Group Members

SE332 – Computer Networking

Presentation no. 1

Presented to: Sir Mustahsan Hammad Naqvi

Page 3: NAT and Subnetting

Subnetting is a process of dividing large network into the smaller

networks .

OR

Subnetting means we borrow some bits from the Host part to add to

the Network part.

Every computer on network has an IP address that represent its

location on network.

Subnetting

Page 4: NAT and Subnetting

• The version of IP address used is IPv4(Internet Protocol version

4).

• Each number of an IP address is made from eight individual bits

known as octet.

• Each octet can create number value from 0 to 255.

• An IP address would be 32 bits long in binary divided into

the two components, network component and host

component.

Subnetting – Classful Networks

Page 5: NAT and Subnetting

• IP addresses are broken into the two components:

• Network component :- Defines network segment of device.

• Host component :- Defines the specific device on a particular

network segment.

IP Classes in decimal notation

Subnetting – Classful Network

Class A addresses range from 1-126

Class B addresses range from 128-191

Class C addresses range from 192-223

Class D addresses range from 224-239

Class E addresses range from 240-254

Page 6: NAT and Subnetting

• 0 [Zero] is reserved and represents all IP addresses.

• 127 is a reserved address and is used for testing, like a loop back

on an interface.

• 255 is a reserved address and is used for broadcasting purposes.

Subnet Mask

Subnet mask is always used with IP address. Subnet mask has only

one purpose, to identify which part of an IP address is network

address and which part is host address.

Subnetting – Classful Network

Page 7: NAT and Subnetting

• In decimal notation subnet mask value 1 to 255 represent network

address and value 0 [Zero] represent host address.

• In binary notation subnet mask ON bit [1] represent network

address while OFF bit[0] represent host address.

• Example: IP address is: 192.168.1.10 and subnet mask is

255.255.255.0

Subnetting – Classful Network

192 168 1 10

255 255 255 0

IP Address

Subnet Mask

Network Address Host Address

Page 8: NAT and Subnetting

Subnetting – Classful Network

Class name Default

subnet mask

Networks

bits

Host bits CIDR

Class A 255.0.0.0 First 8 bits Last 24 bits /8

Class B 255.255.0.0 First 16 bits Last 16 bits /16

Class C 255.255.255.0 First 24 bits Last 8 bits /24

Page 9: NAT and Subnetting

Subnetting – Classful Network

Notations

There are two notations to represent IP address and Subnet Mask.

• Decimal notation.

• Binary notation.

Each octet has eight individual bits which has following pattern:

192 168 1 10

255 255 255 0

IP Address

Subnet Mask

Page 10: NAT and Subnetting

Subnetting – Classful Network

A network has following things to be calculated:

Followings are calculated using IP address and Subnet Mask

Network ID of each network

Host ID of each network

Broadcast ID of each network

Hosts per Network

Page 11: NAT and Subnetting

Subnetting – Classful Network

A network has following things to be calculated:

Followings are calculated using IP address and Subnet Mask

First valid IP address of each network

Last valid IP address of each network

Total Subnet

Page 12: NAT and Subnetting

Subnetting – Classful Network

Total Subnets/Number of the networks

Calculation Methodology: In order to calculate the total subnet of a network,

we need the subnet masks of the IP address class. As we know that the

classful networks uses default subnet mask according to the IP address class.

General Formula: 2^N where

N= Number of the host bits added to the network bits of a given subnet mask

as compared to the default subnet mask of given IP address class.

Considerable things while calculating total Subnets:

• Default subnet mask of the given IP address class.

• Given subnet mask.

Page 13: NAT and Subnetting

Subnetting – Classful Network

Total Subnets/Number of the networks

Example: Given: IP address: 192.168.1.20 and we have to calculate

total subnet available.

Solution:

Step 1:

Analyze the IP address class as it is Class C (ranges 192-223). So its

default subnet mask is 255.255.255.0 and convert the default subnet

mask into doted binary notation.

. . .

As the no number of network bits added to the host bits as compared to the default

subnet mask of the IP address class. So here N will be zero . (Because no other subnet

mask is given and we uses the default subnet Mask). So Total Subnet = 2^0 = 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 0

Page 14: NAT and Subnetting

Subnetting – Classful Network

Network ID of each network

Calculation Methodology: we need the subnet masks of given IP address

class and IP address.

General Formula: Change the host bits of the IP address to 0’s while

keeping the network bits unchanged . The subnet mask successive 1’s will

tell the no. of networks bits.

Considerable things while calculating:

• Default subnet mask of the given IP address class.

• IP address.

Page 15: NAT and Subnetting

Subnetting – Classful Network

Network ID of each network

Example: Given: IP address: 192.168.1.20 and we have to calculate

Network ID.

Solution: Step 1:

Analyze the IP address class as it is Class C (ranges 192-223). So its

default subnet mask is 255.255.255.0 and convert the IP address &

default subnet mask into doted binary notation.

. . .

. . .

Here the number of 1’s in the subnet mask tells the network bits in the IP address is 24 bits

and remaining 8 bits is host bits.

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0

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 0

IP Address

Subnet Mask

Page 16: NAT and Subnetting

Subnetting – Classful Network

Network ID of each network

Step 2: Now by changing the host bits of the IP address to 0’s we will get the

Network ID.

. . .

. . .

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0IP Address

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0Network ID

Decimal Network ID 192.168.1.0 /24No. of network bits

Page 17: NAT and Subnetting

Subnetting – Classful Network

Host ID of each network

Calculation Methodology: we need the subnet masks of given IP address

class and IP address.

General Formula: Change the network bits of the IP address to 0’s while

keeping the host bits unchanged. The subnet mask successive 1’s will tell

the no. of networks bits.

Considerable things while calculating:

• Default subnet mask of the given IP address class.

• IP address.

Page 18: NAT and Subnetting

Subnetting – Classful Network

Host ID of each network

Example: Given: IP address: 192.168.1.20 and we have to calculate

Host ID.

Solution: Step 1:

Analyze the IP address class as it is Class C (ranges 192-223). So its

default subnet mask is 255.255.255.0 and convert the IP address &

default subnet mask into doted binary notation.

. . .

. . .

Here the number of 1’s in the subnet mask tells the network bits in the IP address is 24 bits

and remaining 8 bits is host bits.

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0

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 0

IP Address

Subnet Mask

Page 19: NAT and Subnetting

Subnetting – Classful Network

Host ID of each network

Step 2: Now by changing the network bits of the IP address to 0’s we will get

the Network ID.

. . .

. . .

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0IP Address

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0Host ID

Decimal Host ID 0.0.0.20

Page 20: NAT and Subnetting

Subnetting – Classful Network

Broadcast ID of each network

Calculation Methodology: we need the subnet masks of given IP address

class and IP address.

General Formula: Change the Host bits of the IP address to 1’s while

keeping the network bits unchanged. The subnet mask successive 1’s will

tell the no. of networks bits.

Considerable things while calculating:

• Default subnet mask of the given IP address class.

• IP address.

Page 21: NAT and Subnetting

Subnetting – Classful Network

Broadcast ID of each network

Example: Given: IP address: 192.168.1.20 and we have to calculate

Broadcast ID.

Solution: Step 1:

Analyze the IP address class as it is Class C (ranges 192-223). So its

default subnet mask is 255.255.255.0 and convert the IP address &

default subnet mask into doted binary notation.

. . .

. . .

Here the number of 1’s in the subnet mask tells the network bits in the IP address is 24 bits

and remaining 8 bits is host bits.

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0

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 0

IP Address

Subnet Mask

Page 22: NAT and Subnetting

Subnetting – Classful Network

Broadcast ID of each network

Step 2: Now by changing the host bits of the IP address to 1’s we will get the

Broadcast ID.

. . .

. . .

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0IP Address

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1Broadcast ID

Decimal Broadcast ID 192.168.1.255/24No. of network bits

Page 23: NAT and Subnetting

Subnetting – Classful Network

First Valid host address of each network

Calculation Methodology: we need to calculate the Network ID first

(already mentioned details in slide 14-16) then we will easily calculate the

first valid IP address.

General Formula: Find the Decimal Notation of Network Id and add

1(integer) to the address of the Network ID.

Considerable things while calculating:

• Network ID

Page 24: NAT and Subnetting

Subnetting – Classful Network

First Valid Host Address ID of each network

Example: Given: IP address: 192.168.1.20 and we have to calculate

First valid host address.

Solution: Step 1:

Step 2:

Decimal Network ID 192.168.1.0 /24 (Already Calculated)

192.168.1.0

+ 1

192.168.1.1

Decimal Network ID

First Valid Address

Page 25: NAT and Subnetting

Subnetting – Classful Network

Last Valid host address of each network

Calculation Methodology: we need to calculate the Broadcast ID first

(already mentioned details in slide 20-22) then we will easily calculate the

last valid IP address.

General Formula: Find the Decimal Notation of Broadcast Id and subtract

1(integer) to the address of the Broadcast ID.

Considerable things while calculating:

• Broadcast ID

Page 26: NAT and Subnetting

Subnetting – Classful Network

First Valid Host Address ID of each network

Example: Given: IP address: 192.168.1.20 and we have to calculate

First valid host address.

Solution: Step 1:

Step 2:

Decimal Broadcast ID 192.168.1.255/24 (Already Calculated)

192.168.1.255

- 1

192.168.1.254

Decimal Broadcast ID

Last Valid Address

Page 27: NAT and Subnetting

Subnetting – Classful Network

Hosts per network

Calculation Methodology: To calculate the hosts per network we need to

find the no. of network bits in the subnet mask.

General Formula: ((2^32-N )-2) where N = number of the network bits in

the subnet marks which is calculated by the no. of successive 1’s in the

subnet mask.

We subtract two address which is Network ID and Broadcast ID which

cannot assigned to any host.

Considerable things while calculating:

• Network bits of subnet mask.

Page 28: NAT and Subnetting

Subnetting – Classful Network

Host per network

Example: Given: IP address: 192.168.1.20 and we have to calculate

host per network.

Solution: Step 1:

Analyze the IP address class as it is Class C (ranges 192-223). So its

default subnet mask is 255.255.255.0 and convert the default subnet

mask into doted binary notation.

. . .

Step 2:

Here N = 24 . So, Applying the formula : ((2^32-24)-2) = 2^8 – 2 = 254

hosts per network.

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 0 Subnet Mask

Page 29: NAT and Subnetting

Subnetting – Classless Network

CIDR [ Classless Inter Domain Routing]:

CIDR is a slash notation of subnet mask. CIDR tells us number of on bits

in a network address.

•Class A has default subnet mask 255.0.0.0. that means first octet of the

subnet mask has all on bits. In slash notation it would be written as /8,

means address has 8 bits on.

•Class B has default subnet mask 255.255.0.0. that means first two octets

of the subnet mask have all on bits. In slash notation it would be written

as /16, means address has 16 bits on.

•Class C has default subnet mask 255.255.255.0. that means first three

octets of the subnet mask have all on bits. In slash notation it would be

written as /24, means address has 24 bits on.

Page 30: NAT and Subnetting

Subnetting – Classless Network

Consider 200.113.20.16/28

a.Calculate

i. How many networks are possible?

ii. How many hosts per network are possible?

iii.What is the first valid IP of the first network?

iv.What is the last valid IP of the first network?

v. What is the broadcast ID of first network?

Page 31: NAT and Subnetting

Subnetting – Classless Network

Solution:

In this question, /28 means that 28 bits are the network bits

i. How many networks are possible?

Answer:

. . .

. . .

As the number of network bits is 28 (as given) and IP address class is C.

So, Here N = 4 because 4 bits are extra used as compared to Default

subnet mask(255.255.255.0) of the class C.

Applying formula(Slide 10), we get no. of possible networks = 2^4 = 16

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 Given Subnet Mask 0 0 0 0

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 0 Default Subnet Mask

Page 32: NAT and Subnetting

Subnetting – Classless Network

Solution:

In this question, /28 means that 28 bits are the network bits

ii. How many hosts per network are possible?Answer:

. . .

. . .

As the number of network bits is 28 (as given) and IP address class is C.

So, Using (Slide-27) formula, Number of host = ((2^32-28)-2) = 2^4 – 2 = 16 – 2

= 14

1 1 0 0 1 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1 0 1 0 0

0 0 0 0

Given IP Address

1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1Given Subnet Mask

0 0 0 1 0 0 0 0

Page 33: NAT and Subnetting

Subnetting – Classless Network

Solution:

In this question, /28 means that 28 bits are the network bits

iii. What is the first valid IP of the first network?Answer:

. . .

. . .

To calculate the first valid IP we have to calculate Network ID and add one to

It as already mentioned.

1 1 0 0 1 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1 0 1 0 0

0 0 0 0

Given IP Address

1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1Given Subnet Mask

0 0 0 1 0 0 0 0

1 1 0 0 1 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1 0 1 0 0Network ID 0 0 0 1 0 0 0 0

200.113.20.16 / 28Decimal Network ID

200.113.20.17 / 28First Valid IP

Page 34: NAT and Subnetting

Subnetting – Classless Network

Solution:

In this question, /28 means that 28 bits are the network bits

iv. What is the Last valid IP of the first network?Answer:

. . .

. . .

To calculate the last valid IP we have to calculate Broadcast ID and subtract one to

It as already mentioned.

1 1 0 0 1 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1 0 1 0 0

0 0 0 0

Given IP Address

1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1Given Subnet Mask

0 0 0 1 0 0 0 0

1 1 0 0 1 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1 0 1 0 0Broadcast ID 0 0 0 1 1 1 1 1

200.113.20.31/ 28Decimal Network ID

200.113.20.30 / 28Last Valid IP

Page 35: NAT and Subnetting

NAT(Network address translation)

Definition:

NAT is short for Network Address Translation. NAT is an Internet standard

that enables a local-area network (LAN) to use one set of IP addresses for

internal traffic and a second set of addresses for external traffic.

Purpose:

NAT serves three main purposes:

•Provides a type of firewall by hiding internal IP addresses

•Enables a company to use more internal IP addresses. Since they're used

internally only, there's no possibility of conflict with IP addresses used by

other companies and organizations.

•Allows a company to combine multiple ISDN connections into a single

Internet connection

Page 36: NAT and Subnetting

NAT(Network address translation)

Basic Operation Of NAT

• NAT device has address translation table

• One to one address translation

Page 37: NAT and Subnetting

NAT(Network address translation)

Types of NAT

• Static NAT:

A pool of public IP addresses are assigned to the NAT device. A private IP

address can then be statically mapped to anyone of these public addresses.

Page 38: NAT and Subnetting

NAT(Network address translation)

Types of NAT

•Dynamic NAT:

The NAT device will consist of a pool of IP addresses. This time though the

pool of IP addresses will be used when needed and then given back to the

pool. So if computer A needed a public address, it would take one from the

pool, then hand it back when done. The next time the same computer

wanted an IP address it may be assigned a different public address from the

pool, because the one used previously may be in use by another computer,

hence the name "dynamic".

Page 39: NAT and Subnetting

NAT(Network address translation)

Types of NAT

• NAT overload or Port Address translation:

During PAT, each computer on LAN is translated to the same IP address, but

with a different port number assignment.

Page 40: NAT and Subnetting

NAT(Network address translation)

Terminology of NAT:

Specific terms are used to identify the various NAT addresses:

• Inside Local:

the specific IP address assigned to an inside host behind a NAT-enabled device

(usually a private address).

• Inside Global:

the address that identifies an inside host to the outside world (usually a public

address). Essentially, this is the dynamically or statically-assigned public address

assigned to a private host.

• Outside Global:

the address assigned to an outside host (usually a public address).

• Outside Local :

the address that identifies an outside host to the inside network. Often, this is the

same address as the Outside Global. However, it is occasionally necessary to translate

an outside (usually public) address to an inside (usually private) address.

Page 41: NAT and Subnetting

Thank You

You can download this presentation from

Slideshare.