Chapter No.- 1 Network Layer & Protocols

74
Chapter No.- 1 Network Layer & Protocols Weightage 08 Marks

Transcript of Chapter No.- 1 Network Layer & Protocols

Page 1: Chapter No.- 1 Network Layer & Protocols

Chapter No.- 1

Network Layer & Protocols Weightage 08 Marks

Page 2: Chapter No.- 1 Network Layer & Protocols

The OSI Model and The TCP/IP Protocol Suite

Page 3: Chapter No.- 1 Network Layer & Protocols

The OSI Model and The TCP/IP Protocol Suite

OSI Model TCP/IP Model

It is developed by ISO (International Standard Organization)

It is developed by ARPANET (Advanced Research Project Agency Network).

OSI model provides a clear distinction between interfaces, services, and protocols.

TCP/IP doesn't have any clear distinguishing points between services, interfaces, and protocols.

OSI refers to Open Systems Interconnection. TCP refers to Transmission Control Protocol.

OSI uses the network layer to define routing standards and protocols.

TCP/IP uses only the Internet layer.

OSI layers have seven layers. TCP/IP has four layers.

In the OSI model, the transport layer is only connection-oriented.

A layer of the TCP/IP model is both connection-oriented and connectionless.

It is defined after the advent of the Internet. It is defined before the advent of the internet.

Page 4: Chapter No.- 1 Network Layer & Protocols

Introduction of Network Layer

4

Network layer is the third layer of the Open Systems Interconnection Model

(OSI Model) and the layer that provides data routing paths for network

communication.

In network layer data is transferred in the form of packets via logical network

paths.

Network addressing logical connection setup, data forwarding, routing and

delivery error reporting are the network layer’s primary responsibilities or

functions.

The network layer uses protocols such as Internet Protocol (IP), Internet Protocol

Version 4(IPV4), Internet Protocols Version 6(IPV6), Internet Control Message

Protocol (ICMP), Internet Group Management Protocol (IGMP), Internet

Protocol Security (IPSec), Routing Information Protocol (RIP) etc.

Page 5: Chapter No.- 1 Network Layer & Protocols

1.1 IP Addressing: Overview

An IP address is an address used to uniquely identify a device on an IP network.

In Layer 3 logical address assigned by an administrator.

Every device on internet has a unique IP address.

10.1.1.1 10.1.1.1

Page 6: Chapter No.- 1 Network Layer & Protocols

1.1 IP Addressing:- IPv4

The address is made up of 32 binary bits which can be divisible into a network portion and host portion with the help of a subnet mask. (Hierarchical addressing structure.)

Layer 3 or Network layer protocol.

Packet treated independently.

Best effort delivery-there is No guarantee for packet delivery. Packet may be Mis or Lost.

No data recovery features.

No built in session

No retransmission.

Page 7: Chapter No.- 1 Network Layer & Protocols

IPv4 Format:-

IP address 32 binary bits are broken into four octets(1 octet = 8 bits)

X. X. X. X

It has hierarchical structure to enable routing.

-Network Portion:- Identifies a specific network.

-Host Portion:- identifies a specific endpoint on a network.

Each X 8 bitsOctets

OR 192.168.1.1

Page 8: Chapter No.- 1 Network Layer & Protocols

Example of IP Address

Page 9: Chapter No.- 1 Network Layer & Protocols

Binary

Page 10: Chapter No.- 1 Network Layer & Protocols

IP Address Classes?

• Class A• Class B• Class C

Unicast Traffic

• Class D• Class E

Multicast Reserved for future or experimental purposes.

IPv6- does not use address classes.IPv4- address classes was replaced by CIDR(Classless

inter- domain routing) ex. 192.168.1.1 /26

Classful Addressing

Page 11: Chapter No.- 1 Network Layer & Protocols

Which IP belongs to Which Class?

Class Start with a binary

Range First Octet Binary Start First Octet BinaryEnd

Class A 0 0.0.0.0 to 127*.255.255.255 0000 0000 =0 0111 1111 =127*

Class B 10 128.0.0.0 to 191.255.255.255 1000 0000 =128 1011 1111 =191

Class C 110 192.0.0.0 to 223.255.255.255 1100 0000 =192 1101 1111 =223

Class D 1110 224.0.0.0 to 239.255.255.255 1110 0000 =224 1110 1111 =239

Class E 1111 240.0.0.0 to 255.255.255.255 1111 0000 =240 1111 1111 =255

Note:- Exception 127* is reserved for loopback address (127.0.0.1)

Page 12: Chapter No.- 1 Network Layer & Protocols

Quiz 1 ?

Find the error, if any in the following IPv4 address.

a. 111.56.045.78

b. 221.32.7.8.20

c. 75.45.301.14

d. 11100010.23.14.67

Page 13: Chapter No.- 1 Network Layer & Protocols

Quiz 1 ?

Find the error, if any in the following IPv4 address.

a. 111.56.045.78

b. 221.32.7.8.20

c. 75.45.301.14

d. 11100010.23.14.67

a. Error at 045.

b. Only 4 Octets. c. Decimal no not allow more than 255d. Do not allow a combination of binary and decimal.

Page 14: Chapter No.- 1 Network Layer & Protocols

Quiz 2 ?

Q. Change the following IPv4 addresses from binary

notation to dotted decimal notation.

a. 10000001 00001011 00001011 11101111

b. 11000001 10000011 10001011 01101111

c. 11100111 11011011 10011011 01101111

d. 11111001 10011011 11111011 00001111

Page 15: Chapter No.- 1 Network Layer & Protocols

Quiz 2 ?

Solutions:-

a. 129.11.11.239

b. 193.131.139.111

c. 231.219.155.111

d. 249.155.251.15

Page 16: Chapter No.- 1 Network Layer & Protocols

Quiz 3 ?

Q. Find the class of each address.a. 227.12.14.87b. 193.14.56.22c. 14.23.120.8d. 1.2.3.4

Page 17: Chapter No.- 1 Network Layer & Protocols

How many Host's and Network are available in Each

Class?

Name

Of Class

Network

& Host

Nos. of Network Nos. of Hosts

class A N.H.H.H N=8 H=24 2*8-1=2*7=128 2*24=16777216

Class B N.N.H.H N=16 H=16 2*16-2=2*14=16384 2*16= 65536

Class C N.N.N.H N=24 H=8 2*24-3=2*21=2097152 2*8 =256

Page 18: Chapter No.- 1 Network Layer & Protocols

Example of Network & Host Address:-

Class A Network Address

Network Address

• 10.0.0.0 = Network Address

• 10.1.2.3 = Host Address

Class A Networks Range 1 to 126

Class A :

First 8 Bits = Network

ID or Address

Page 19: Chapter No.- 1 Network Layer & Protocols

Example of Network & Host Address:-

Class B Network Address

Network Address

• 172.16.0.0 = Network Address

• 172.16.1.2 = Host Address

Class A Networks Range 128 to 191

Class B :

First 16 Bits = Network

ID or Address

Page 20: Chapter No.- 1 Network Layer & Protocols

Example of Network & Host Address:-

Class C Network Address

Network Address

• 192.168.1.0 = Network Address

• 19.168.1.1 = Host Address

Class A Networks Range 192 to 223

Class C :

First 24 Bits = Network

ID or Address

Page 21: Chapter No.- 1 Network Layer & Protocols

Private Address Range

21

Address Class Reserved Address Space

Class A 10.0.0.0 - 10.255.255.255

Class B 172.16.0.0 - 172.31.255.255

Class C 192.168.0.0 - 192.168.255.255

Loopback 127.0.0.0-127.255.255.255

APIPA(auto pvt. IP address) 169.254.0.0-169.254.255.255

Page 22: Chapter No.- 1 Network Layer & Protocols

Address Space

• An IPv4 address has a size of 32 bits, which limits the address space to 4,294,967,296 (4 billion addresses) (or 232) addresses.

• Of this number, some addresses are reserved for special purposes such as private networks (~18 million addresses) and multicast addressing (~270 million addresses).

• In Classful addressing the addressing space is divided into five classes as shown in below fig.

Page 23: Chapter No.- 1 Network Layer & Protocols

Address Space

Address Space

A

B

C

D

E

25

%

50%

12.5%

Sr. No. Class Number of Addresses

1 A 231 =2,147,483,648

2 B 230 =1,073,741,824

3 C 229 =536,870,912

4 D 228 =268,435,456

5 E 228 =268,435,456

Page 24: Chapter No.- 1 Network Layer & Protocols

Network or Subnet Masks

• It used to determine network portion and host portion.• Is a device remote or local?

If in the same

subnet /16

IP 10.1.1.1 /16 IP 10.1.2.3 /16

Local Network

Remote Network

Page 25: Chapter No.- 1 Network Layer & Protocols

Default Masks

Page 26: Chapter No.- 1 Network Layer & Protocols

Network or Subnet Masks

• The subnet mask follow two rules:1. If a binary bit is set to a 1 (or on) in a subnet mask,

the corresponding bit in the address identifies the network.

2. If a binary bit is set to a 0 (or off) in a subnet mask, the corresponding bit in the address identifies the host.

1- Networks

0- Hosts

Binary Rules:Network / subnet address Fill the host portion of an address with binary 0’s

Page 27: Chapter No.- 1 Network Layer & Protocols

Network or Subnet Masks

10.1.1.1 = 0000 1010.0000 0001.0000 0001.0000 0001255.0.0.0 = 1111 1111.0000 0000.0000 0000.0000 0000

10.0.0.0= 0000 1010.0000 0000.0000 0000.0000 0000

1- Networks

0- Hosts

10.0.0.0

10 =Network Portion0.0.0 = Host Portion

Example 1:- Class A network

10.1.1.1 /8 Or 255.0.0.0Convert the address and mask to binary numbers

AND

AND Rules0*0=00*1=01*0=01*1=1

Page 28: Chapter No.- 1 Network Layer & Protocols

Network or Subnet Masks

Example 2:- Class A network

172.16.1.1 /16 Or 255.255.0.0Convert the address and mask to binary numbers

172.16.1.1= 1010 1100.0001 0000.0000 0001.0000 0001255.255.0.0 = 1111 1111.1111 1111.0000 0000.0000 0000

Network Portion = 00000001.00000001 = 1.1Host Portion = 00000001.00000001 = 1.1

172.16.0.0 = 1010 1100.0001 0000.0000 0000.0000 0000AND

Page 29: Chapter No.- 1 Network Layer & Protocols

Network Address

The network address is an address that defines the network itself.

115.0.0.0 115.90.121.4

115.50.15.90 115.63.1.4

Network Address Note that 115 is common in the

address of all machines in class A networkFig. Class A network

address

Page 30: Chapter No.- 1 Network Layer & Protocols

Network Address

30

190.21.0.0 190.21.121.4

190.21.15.90 190.21.1.4

Network AddressNote that 190.21 is common

in the address of all machines in Class B network

Fig. Class B network address

Page 31: Chapter No.- 1 Network Layer & Protocols

Network Address

31

200.100.50.0 200.100.50.1

200.100.50.11 200.100.50.100

Network Address

Note that 200.100.50 is common in

the address of all machines in Class C network

Fig. Class C network address

Page 32: Chapter No.- 1 Network Layer & Protocols

Example 1:-For the address 120.46.50.95 identify the type of network and find the network address. (default mask)

120. 46. 50. 95

120. 0. 0. 0

Replace host id by 0’ s

Network Address

Solution 1:-Examine the first byte. Its value is 120 i.e. it is between 0 to 126. so it is a Class A network.So only the first byte defines the Net Id. So we can find the network address by replacing the Host Id with 0s

Page 33: Chapter No.- 1 Network Layer & Protocols

Example 1:- (Finding network address using Default Mask)For the address 120.46.50.95 identify the type of network and find the network address.

Solution 2:-

Examine the first byte. Its value is 120 i.e. it is between 0 to 126. so it is a Class A network & subnet mask is 255.0.0.0

120. 46. 50. 95

120. 0. 0. 0Network Address

255. 0. 0. 0

AND

Page 34: Chapter No.- 1 Network Layer & Protocols

Example 2:- For the address 192.168.1.18/24 identify the type of network and find the network address.

Solution :-

Examine the first byte. Its value is 192 i.e. it is between 191 to 223. so it is a Class C network & subnet mask is 255.255.255.0

Binary Rules:Network / subnet address Fill the host portion of an address with binary 0’s

IP Address= 192.168.1. 0000 0000 =192.168.1.0

/24 it means network portion is first 3 octets i.e. 192.168.1 & 18 is host portion

Network Portion Host Portion

Page 35: Chapter No.- 1 Network Layer & Protocols

Example 3:- IP address 172.16.35.123/20 OR 172.16.35.123 255.255.240.0

/20 it means 20 bits of 32 bit IP address are used for network / subnet & the remaining 12

bits are used as the Host Portion

172.16.3 5.123 /20

Network Portion Host Portion

Solution 1: Step1:-

Step 2:- Convert octet 3 & 4 into binary (because they both have host bits)

IP Address= 172.16.0010 0011. 0111 1011 =172.16.35.123

Step 3:-Binary Rules:Fill the host portion of an address with binary 0’s

Network Address= 172.16.0010 0000.0000 0000 =172.16.32.0

Page 36: Chapter No.- 1 Network Layer & Protocols

Example 3:- IP address 172.16.35.123/20 OR 172.16.35.123 255.255.240.0

172.16.3 5.123 /20

Network Portion Host PortionSolution2:-

IP Address= 172.16.35.123 = 1010 1100.0001 0000.0010 0011. 0111 1011

Network or Subnet Address = 1010 1100.0001 0000.0010 0000.0000 0000=172.16.32.0

Subnet = 255.255.240.0 = 1111 1111.1111 1111. 1111 0000. 0000 0000

Page 37: Chapter No.- 1 Network Layer & Protocols

IP Addressing-

37

Classification of IP Addresses

Classful Addressing System

Classless Addressing System

OrClassless Interdomain

Routing(CIDR)

Page 38: Chapter No.- 1 Network Layer & Protocols

Classless Addressing- /CIDR

• It is also known as Classless Inter Domain Routing (CIDR).

• Introduced in 1993.

• Replace classful IP addressing.

• Variable length subnet mask(VLSM).

• Classless Addressing is an improved IP Addressing system.

• It makes the allocation of IP Addresses more efficient.

• It replaces the older classful addressing system based on classes.

• Improve address space utilization

• Routing scalability in the Internet

/X CIDR notationEx. 10.0.0.0 /8

Page 39: Chapter No.- 1 Network Layer & Protocols

Before CIDR • Class A

16777214 host addresses (16 million)Mask of 255.0.0.0

• Class B

It support 65534 host addresses.Mask of 255.255.0.0

• Class C

it support 254 host addresses

Mask of 255.255.255.0

Replaced with CIDR subnetting. How to subnet a network? maximum host

Page 40: Chapter No.- 1 Network Layer & Protocols

Before CIDR ? Company? Needs to support 5000 host

If company want to support 5000 host for example which of these 3 address classes with company get,

They could get class B address, but also waste of lot of address about 65534 host address available in Class B.

But in this example company only need 5000 host address.

They could get multiple class C, but that means it can be allocated many C address which has negative effect on internet routing table.

Rather than doing this we move subnet mask. Replaced with CIDR subnetting.

Page 41: Chapter No.- 1 Network Layer & Protocols

Before CIDR ?

Subnet mask –In decimal

Example255.224.0.0

1111 1111.111 0 0000.0000 0000.0000 0000

Network Portion Host Portion

11 binary 1’s or /11255.224.0.0/11

VLSM

Left hand side is network portion & right hand side is host portion

Convert In Binary

Page 42: Chapter No.- 1 Network Layer & Protocols

Quiz?

Q. A subnet mask of 255.255.255.240

It would be represented as follows in binary:11111111.11111111.11111111.11110000

The first 28 bits of the above subnet mask are set to 1. The CIDR notation for this subnet mask would thus be /28.

Solution:-

Page 43: Chapter No.- 1 Network Layer & Protocols

Subnetting- Subnetting is the process of creating new networks. Subnetting is the practice of dividing a network into two or

more smaller networks. It increases routing efficiency, enhances the security of the

network and reduces the size of the broadcast domain. Example

• In this picture we have one huge network: 10.0.0.0/24.

• All hosts on the network are in the same subnet, which has following disadvantages:

Page 44: Chapter No.- 1 Network Layer & Protocols

Subnetting- A single broadcast domain – all hosts are in the same broadcast

domain. Network security – each device can reach any other device on the

network, which can present security problems. Organizational problems – in a large networks, different

departments are usually grouped into different subnets. For example, you can group all devices from

the Accounting department in the same subnet and then give access to sensitive financial data only to hosts from that subnet.

Page 45: Chapter No.- 1 Network Layer & Protocols

Subnetting- The network above could be subnetted like this:

• Now, two subnets were created for different departments: 10.0.0.0/24 for Accounting and 10.1.0.0/24 for Marketing.

• Devices in each subnet are now in a different broadcast domain.

• This will reduce the amount of traffic flowing on the network and allow us to implement packet filtering on the router.

Page 46: Chapter No.- 1 Network Layer & Protocols

Benefits of Subnetting-

1) Reduced network traffic.2) Optimized network performance.3) Simplified management.4) Facilitated spanning of large geographical

distances.

Page 47: Chapter No.- 1 Network Layer & Protocols

Create Subnets or subnetting calculation-

Before we start subnetting, we have to ask ourselves these two questions:1. How many subnets do we need?(Formula)Number of subnets= 2n (n is the number of 1s in the subnet mask) With 1 subnet bit, we can have 21 or 2 subnets. With 2 bits, 22 or 4 subnets, with 3 bits, 23 or 8 subnets, etc.

2. How many hosts per subnet do we need?Number of hosts per subnet = 2n – 2 (n is the number of 0s in the subnet mask.)Block Size or Magic Number= 256-(Decimal number at host portion of the subnet mask)

Page 48: Chapter No.- 1 Network Layer & Protocols

Decimal 192 168 1 1

Binary 1100 0000 1010 1000 0000 0001 0 000 0001

Network Bits Host bits

Example:-1 IP address of 192.168.1.1Subnet Mask 255.255.255.128 or /25

Solution:- As it is a Class C IP address, the first three octets will remain

unchanged for subnet calculation.Now, we shall convert the subnet mask in binary it will be,

In this case, 25 bits are used as network bits not 24 bits as used by default in Class C. this means one host bit is borrowed to be used for subnetting purpose.

Block Size or Magic Number is 256-128=128.

Therefore, the number of subnets will be = 2 ^1 =2.The number of hosts per subnet will be=2^7-2=126.

Page 49: Chapter No.- 1 Network Layer & Protocols

49

Binary Rules:- There are 4 rules

1. Network /Subnet address:-Fill the host portion of an address with binary 0’s.

2. Broadcast address:-Fill the host portion of an address with binary 1’s.

3. First Address:-Fill the host portion of an address with binary 0’s

except for last bit which is set to binary 1

4. Last Address:-Fill the host portion of an address with binary 1’s.

except for last bit which is set to binary 0

Page 50: Chapter No.- 1 Network Layer & Protocols

Number of subnets will be = 2 ^1 =2.Number of hosts per subnet will be=2^7-2=126.

50

Network/ Subnet 192.168.1. 0 0000000 192.168.1.0/25

1st Address 192.168.1. 0 0000001 192.168.1.1/25

Last Address 192.168.1. 0 1111110 192.168.1.126/25

Broadcast Address 192.168.1. 0 1111111 192.168.1.127/25

First Subnet Address

192.168.1. 1 /25

Network Portion Host Portion

Subnet Portion

Network Portion Host Portion

Page 51: Chapter No.- 1 Network Layer & Protocols

Number of subnets will be = 2 ^1 =2.Number of hosts per subnet will be=2^7-2=126.

51

Network/ Subnet 192.168.1. 1 0000000 192.168.1.128/25

1st Address 192.168.1. 1 0000001 192.168.1.129/25

Last Address 192.168.1. 1 1111110 192.168.1.254/25

Broadcast Address 192.168.1. 1 1111111 192.168.1.255/25

Second Subnet Address

192.168.1. 128/25

Network Portion Host Portion

Subnet Portion

Network Portion Host Portion

Page 52: Chapter No.- 1 Network Layer & Protocols

Example:- 2 IP address of 172.16.35.123 /20 OR172.16.35.123 255.255.240.0

Solution:- /20 it means 20 bits of 32 bit IP address are used for network /

subnet & the remaining 12 bits are used as the Host Portion

172.16.3 5.123 /20

Network Portion Host Portion

Step1:-

Step 2:- Convert octet 3 & 4 into binary (because they both have host bits)

IP Address= 172.16.0010 0011. 0111 1011 =172.16.35.123

Decimal 172 16 3 5 123

Binary 1010 1100 0001 0000 0010 0011 0111 1011

Network Bits Host bits

Network Portion Host Portion

Page 53: Chapter No.- 1 Network Layer & Protocols

Example:- 2 IP address of 172.16.35.123 /20 OR172.16.35.123 255.255.240.0

Step3:- Apply 4 binary rules

Number of subnets will be = 2 ^ 4 = 16.Number of hosts per subnet will be=2^12-2 = 4096.

Network/ Subnet 172.16. 0010 0000.0000 0000 172.16.32.0/20

1st Address 172.16. 0010 0000.0000 0001 172.16.32.1/20

Last Address 172.16. 0010 1111.1111 1110 172.16.47.254/20

Broadcast Address 172.16. 0010 1111.1111 1111 172.16.47.255/20

Subnet Portion

Network Portion Host Portion

Page 54: Chapter No.- 1 Network Layer & Protocols

Example 3: PC with IP address of 172.16.129.1/17 or 255.255.128.0

54

Page 55: Chapter No.- 1 Network Layer & Protocols

Quiz?

Q.1 What is the network address for host 172.16.1.1 with

network mask 255.255.192.0?

a.172.16.0.0/16

b.172.16.0.1/16

c.172.16.0.0/18

d.172.16.1.1/18

Correct Ans. C

Page 56: Chapter No.- 1 Network Layer & Protocols

Quiz?

Q.2 What is the broadcast address for host 172.16.1.1 with network mask 255.255.192.0?

a.172.16.1.255

b.172.16.255.255

c.172.16.63.255

d.172.16.0.255

Correct Ans. C

Page 57: Chapter No.- 1 Network Layer & Protocols

Question : iTech info solution has been allocated subnet 10.1.1.0/24 for a

small office in Pune, the network administrator needs to splits this subnet into smaller subnets each subnets need to support 14 machines or host.

57

Solution:-Step 1: Decide which formula to use

Networks = 2^nHost = 2^n-2

Page 58: Chapter No.- 1 Network Layer & Protocols

58

Step 2: To work out how many bits are required to cover the number to host.To required 14 hostHosts = 2^n-2

= 2^4-2=14

To Remember2^1=22^2=42^3=82^4=162^5=322^6=642^7=1282^8=2562^9=5122^10=1024

We need to steal 4 bits from the host portion.

Step 3: To convert the host portion of the original network into binary.

Original network =10.1.1.1/24 or 255.255.255.0

Network address Host

10.1.1. 0 (as per rule host in binary)

0000 0000

Page 59: Chapter No.- 1 Network Layer & Protocols

59

Step 4: Host portion is 8 bits only 4 bits are now required to support 14 Host.

Step 5: √ Work out the new subnet mask √ Count the number of bits that are network or subnet (Do not count host portion)

Network address subnet Host

10.1.1. 0000 00004 bits given to host portion

Network address subnet Host

10.1.1. 0000 0000

8 bits8 bits 8 bits

Total no. of bits in network / subnet portion = 8 + 8 + 8 + 4=28

4 bits Or working backwards, there are 4 bits in the host portion so,32-4=28

Page 60: Chapter No.- 1 Network Layer & Protocols

Step 6: Work out the various subnets.

Network address subnet Host IP address

1st Subnet 10.1.1. 0000 0000 10.1.1.0/28

2nd Subnet 10.1.1. 0001 0000 10.1.1.16/28

3rd Subnet 10.1.1. 0010 0000 10.1.1.32/28

4th Subnet 10.1.1. 0011 0000 10.1.1.48/28

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

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

Last subnet 10.1.1. 1111 0000 10.1.1.240/28

Page 61: Chapter No.- 1 Network Layer & Protocols

Question : IP address 192.168.1.0/24 Create 4 subnets

61

Solution:-Step 1: Decide which formula to use

Networks = 2^n =2^2=4

Step 2: IP Address: 192.168.1.0subnet mask: 255.255.255.0

Step 3: Subnet mask: 1111 1111.1111 1111.1111 1111.00 00 0000

8 bits 8 bits8 bits 2 bits

Total no. of bits in network / subnet portion = 8 + 8 + 8 + 2=26

Page 62: Chapter No.- 1 Network Layer & Protocols

Question : IP address 192.168.1.0/24 Create 4 subnets

62

Solution:-Step 4:

1st Subnet: 192.168.1. 00 00 0000 =192.168.1.0/26

Subnet Portion

Network Portion Host Portion

2ndSubnet: 192.168.1. 01 00 0000 =192.168.1.0/26

4th Subnet: 192.168.1. 11 00 0000 =192.168.1.0/26

3rd Subnet: 192.168.1. 10 00 0000 =192.168.1.0/26

Page 63: Chapter No.- 1 Network Layer & Protocols

Question : IP address 192.168.1.0/24 Create 4 subnets

63

1st SubnetNetwork address =192.168.1. 00 00 0000 = 192.168.1.0/261st address = 192.168.1. 00 00 0001 =192.168.1.1/26

2nd Subnet: 192.168.1. 01 00 0000 =192.168.1.0/26

Last address= 192.168.1. 00 11 1110 =192.168.1.62/26

Broadcast = 192.168.1. 00 11 1111 =192.168.1.63/26 Address

Last address= 192.168.1. 01 11 1110 =192.168.1.62/261st address = 192.168.1. 01 00 0001 =192.168.1.1/26

Broadcast = 192.168.1. 01 11 1111 =192.168.1.63/26 Address

Page 64: Chapter No.- 1 Network Layer & Protocols

Question : IP address 192.168.1.0/24 Create 4 subnets

64

3rd SubnetNetwork address =192.168.1. 10 00 0000 = 192.168.1.128/261st address = 192.168.1. 10 00 0001 =192.168.1.129/26

2nd Subnet: 192.168.1. 11 00 0000 =192.168.1.192/26

Last address= 192.168.1. 10 11 1110 =192.168.1.190/26

Broadcast = 192.168.1. 10 11 1111 =192.168.1.191/26 Address

Last address= 192.168.1. 11 11 1110 =192.168.1.254/261st address = 192.168.1. 11 00 0001 =192.168.1.193/26

Broadcast = 192.168.1. 11 11 1111 =192.168.1.255/26 Address

Page 65: Chapter No.- 1 Network Layer & Protocols

65

Private Network

• Private IP network is an IP network that is not directly connected to the Internet.

• Three address ranges are reserved for private usage (non-routable addresses): Class A : 10.0.0.0/8Class B : 172.16.0.0/16 to 172.31.0.0/16 Class C : 192.168.0.0/24 to 192.168.255.0/24

• A private IP is mapped to a Public IP, when the machine has to access the Internet.

Page 66: Chapter No.- 1 Network Layer & Protocols

66

NAT(Network Address Translation)

Page 67: Chapter No.- 1 Network Layer & Protocols

67

NAT(Network Address Translation)

• NAT is a process in which one or more local IP address is translated into one more global or public IP address.

• NAT translates the IP addresses of computers in local network to a single public IP address. This address often used by the router that connects the computers to the internet.

• NAT provides an additional benefit –hiding the specific addresses and addressing structure of the internal (or private) network.

Page 68: Chapter No.- 1 Network Layer & Protocols

68

NAT(Network Address Translation)

• NAT is not restricted to private-to-public address translation, though that is the most common application.

• NAT can also perform public-to-public address translation, as well as private-to-private address translation.

• NAT is only a temporarily solution to the address shortage problem. • IPv4 will eventually be replaced with IPv6, which supports a vast address

space.

Page 69: Chapter No.- 1 Network Layer & Protocols

69

NAT(Network Address Translation)

• NAT TerminologySpecific 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). • 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.

Page 70: Chapter No.- 1 Network Layer & Protocols

70

NAT(Network Address Translation)

Internet

Host A10.1.1.11

Server B82.6.4.2

Inside Vs Outside- Physical location of HostLocal Vs Global-Perspective you are viewing host from

Inside Outside

SRC: 10.1.1.11 :3333DST: 82.6.4.2 : 80

SRC: 73.8.2.11 :3333DST: 82.6.4.2 : 80

Inside Local Inside Global

10.1.1.11:3333 73.8.2.11:3333

Outside Local Outside Global82.6.4.2:80 82.6.4.2:80

SRC: 82.6.4.2 :80DST:73.8.2.11 : 3333

SRC: 82.6.4.2: 80DST: 10.1.1.11: 3333

Page 71: Chapter No.- 1 Network Layer & Protocols

71

Types of NAT

1. Static NAT – Private IPv4 address to Public IPv4 address. Performs a static one-to-one translation between two addresses (One to One

Mapping) Useful- accessible from outside the network.

1. Static NAT2. Dynamic NAT3. PAT

Page 72: Chapter No.- 1 Network Layer & Protocols

72

Types of NAT

2. Dynamic NAT – Private IPv4 address to group of Public IPv4 addresses. Utilizes a pool of global addresses to dynamically translate the outbound traffic of

clients behind a NAT-enabled device. Example:- Two companies merge and using same IP address space using IP

address 10.1.1.0 and devices of two companies are talk to each other rather than renumbering addresses they are used Dynamic NAT.

Not very efficient. Used when necessary.

1. Static NAT2. Dynamic NAT3. PAT

Page 73: Chapter No.- 1 Network Layer & Protocols

73

NAT(Network Address Translation)

3. NAT Overload or Port Address Translation (PAT)o Multiple private IP address Single public IP addresso Translates the outbound traffic of clients to unique port numbers off of a single

global address. o PAT is necessary when the number of internal clients exceeds the available global

addresses.

Page 74: Chapter No.- 1 Network Layer & Protocols

74

NAT(Network Address Translation)

Advantages of NAT:-1. NAT solves IP overlapping issue.2. NAT hides internal IP structure from external world.3. NAT allows to connect with any network without changing IP address.4. NAT allows to connect multiple computers with internet through the single the

public IP address.

Disadvantages of NAT:-1.NAT adds additional delay in network2.Several applications are not compatible with NAT.3.End to End IP traceability will not work with NAT.4. NAT hide actual end device.