Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 64

Network layer

Addressing the Network IP Routing

1
From last class
Data link layer:

node-to-node delivery
Network layer:

host-to-host delivery
Transport layer:

process-to-process delivery

Several processes may be running on the source as well as the destination; an


addressing mechanism is required.


Network Layer

 Function:
 Route packets end-to-end on a network,
Application through multiple hops
Presentation  Key challenge:
 How to represent addresses
Session  How to route packets
Transport  Scalability

Network Convergence

Data Link
Physical
3
Routers, Revisited

 How to connect multiple


LANs?
 LANs may be incompatible
 Ethernet, Wifi, etc… Routers
 Connected networks form
an internetwork
 The Internet is the best
known example

4
5
Network layer TCP UDP Transport
Layer

 This layer deals with


Packets (Data Bundles) ICMP IP IGMP Network
Layer

 Responsible for logical


addressing and routing ARP
Network
Access Data Link Layer

 Devices
 Routers, Layer 3 Switches, Media

Firewalls.. Etc.  IP – Internet Protocol (Provide packet


 Network Layer Protocols delivery)
 ICMP, IGMP, ARP, IP,  ARP – Address Resolution Protocol
RIP, IGRP.. Etc. (Defined the procedure of network address / mac
address translation)
 ICMP – Internet Control Message Protocol
(Defined the procedure of error message
transfer)
6
Network layer
 Routes the information in the network
 E.g. IP is a network layer implementation which defines
addresses in such a way that route selection can be
determined.
 Single address space for the entire internetwork
 adds an additional layer of addressing, e.g. IP address,
which is different from MAC address.

7
Network layer
 Unreliable (best effort)
 If packet gets lost, network layer doesn’t care for higher layers can resend lost
packets
 Forwards packets hop by hop
 Encapsulates network layer packet inside data link layer frame
 Different framing on different underlying network types
 Receive from one link, forward to another link
 There can be many hops from source to destination
 Makes routing decisions
 How can the packet be sent closer to its destination?
 Forwarding and routing tables embody “knowledge” of network topology
 Routers can talk to each other to exchange information about network topology

8
Addressing the Network IPv4

9
IP Address
 What is an IP address?
 An IP address is a unique global address for a network interface
 E.g. IPv4, IPv6

 IPV6 provides a platform on new internet functionality


that will be needed in the immediate future and provide

flexibility for future growth and expansion.
An IPv4 address is 32 bits long
 The IPv4 addresses are unique and universal.
 The address space of IPv4 is 232 or 4,294,967,296.

10
IP Addresses

11
IP Addressing

32 bits
Dotted
Decimal Network Host

Maximum 255 255 255 255


IP Addressing
32 bits
Dotted
Decimal Network Host

Maximum 255 255 255 255


1 8 9 16 17 24 25 32

Binary 11111111111111111111111111111111

128

8
4
2
1
64
32
16
128

8
4
2
1
64
32
16
128

8
4
2
1
128

8
4
2
1

64
32
64
32

16
16
IP Addressing
32 bits
Dotted
Decimal Network Host

Maximum 255 255 255 255


1 8 9 16 17 24 25 32

Binary 11111111111111111111111111111111

128

8
4
2
1
64
32
16
128

8
4
2
1
64
32
16
128

8
4
2
1
64
32

128

8
4
2
1
64
32
16

16

Example
Decimal 172 16 122 204
Example10101100000100000111101011001100
Binary
IP Address Classes

8 bits 8 bits 8 bits 8 bits

 Class A: Network Host Host Host

 Class B: NetworkNetwork Host Host

 Class NetworkNetworkNetwork Host


C:
 Class D: Multicast
 Class E: Research
IP Address Classes

Bits: 1 8 9 16 17 24 25 32
0NNNNNNN Host Host Host
Class A:
Range (1-126)

Bits: 1 8 9 16 17 24 25 32
10NNNNNN Network Host Host
Class B:
Range (128-191)
1 8 9 16 17 2425 32
Bits:
110NNNNN Network Network Host
Class C:
Range (192-223)
1 8 9 16 17 2425 32
Bits:
1110MMMMMulticast GroupMulticast GroupMulticast Group
Class D:
Range (224-239)
Host Addresses

172.16.2.1 10.1.1.1
10.6.24.2
E1
172.16.3.10 E0 10.250.8.11
172.16.2.1

172.16.12.12 10.180.30.118

Routing Table
172.16 . 12 . 12 Network Interfac
e
Network Host 172.16.0. E0
0
E1
10.0.0.0
Determining Available Host Addresses
Network Host
172 16 0 0
N

8
7
6
5
4
3
2
1
9
16
15
14
13

10
12
11
101011000001000000000000
00000000 1
0000000000000001 2
0000000000000011 3
...

...
...
111111111111110165534
111111111111111065535
111111111111111165536
- 2
2N-2 = 216-2 = 6553465534
Addressing without Subnets

172.16.0.1172.16.0.2172.16.0.3 172.16.255.253
172.16.255.254

…...

172.16.0.0

 Network 172.16.0.0
Addressing with Subnets

172.16.3.0

172.16.4.0

172.16.1.0 172.16.2.0

 Network 172.16.0.0
Subnet Addressing

172.16.2.200 172.16.3.5
172.16.3.1
E1
172.16.2.2 E0 172.16.3.100
172.16.2.1

172.16.2.160 172.16.3.150

New Routing
172.16 . 2 . 160 Table Interfac
Network
e
Network Host 172.16.0. E0
0
E1
172.16.0.
Subnet Addressing

172.16.2.200 172.16.3.5
172.16.3.1
E1
172.16.2.2 E0 172.16.3.100
172.16.2.1

172.16.2.160 172.16.3.150

New Routing
172.16 . 2 . 160 Table Interfac
Network
e
Network Subnet Host 172.16.2. E0
0
E1
172.16.3.
Subnet Mask
Network Host

IP
Address
172 16 0 0
Network Host
Default
Subnet
Mask
255 255 0 0
11111111 11111111 00000000 00000000
Also written as “/16” where 16 represents the number of 1s in the
mask.
Network Subnet Host
8-bit
Subnet 255 255 255 0
Mask
Also written as “/24” where 24 represents the number of 1s in the
mask.
Decimal Equivalents of Bit Patterns
128 64 32 16 8 4 2 1

1 0 0 0 0 0 0 0 = 128
1 1 0 0 0 0 0 0 = 192
1 1 1 0 0 0 0 0 = 224
1 1 1 1 0 0 0 0 = 240
1 1 1 1 1 0 0 0 = 248
1 1 1 1 1 1 0 0 = 252
1 1 1 1 1 1 1 0 = 254
1 1 1 1 1 1 1 1 = 255
Subnet Mask without Subnets

Network Host

172.16.2.16010101100 00010000 00000010 10100000

255.255.0.0 11111111 11111111 00000000 00000000

10101100 00010000 00000000 00000000

Network 172 16 0 0
Number

 Subnets not in use—the default


Unicast, Multicast, Broadcast

26
Unicast, Multicast, Broadcast
 Unicast – a message addressed to one host
 Broadcast – a message addressed to all hosts on a
network. Uses network’s broadcast address or
255.255.255.255 locally
 Multicast – a message addressed to a group of hosts. Uses
an address starting 224 - 239

27
Private IP addresses
 Unrestricted use on private networks. Not routed across
the Internet.
 10.0.0.0 – 10.255.255.255 (10.0.0.0/8)
 172.16.0.0 – 172.31.255.255 (172.16.0.0/20)
 192.168.0.0 – 192.168.255.255 (192.168.0.0/24)

28
Public IP addresses
 Routed over the Internet
 Master holder is IANA
 Assigned to regional registries and then to ISPs
 ISPs allocate them to organisations and individual users
 Use is strictly controlled as duplicate addresses are not
allowed.

29
Special addresses
 0.0.0.0 “all addresses” in default route. Hosts cannot be given
addresses starting 0.
 127.0.0.1 is loopback. Hosts cannot be given addresses starting
127.
 240.0.0.0 and higher – reserved for experimental purposes.
 169.254.0.0 - 169.254.255.255 local only
 192.0.2.0 to 192.0.2.255 for teaching

30
Network address translation
 A large number of hosts on a network use private addresses to
communicate with each other.
 The ISP allocates one or a few public addresses.
 NAT allows the hosts to share the public addresses when they
want to use the Internet

31
Addressing hosts
 Static addressing
 Address is configured by an administrator.
 Servers, printers, routers, switches need static addresses.
 Dynamic addressing
 Address is allocated automatically by DHCP by leasing
addresses from a pool.
 Dynamic addressing is best for workstations.

32
Subnetting

33
Problems
 IPv4 address scheme is limited by its 32 bits problems for the

long-term growth of the Internet.

 The global internet routing table is huge and continues to grow

go beyond the capacity of routers.

 What if you want to break your big network into many

smaller networks?

34
Solutions
 Subnet masking
 Variable-length subnet masks
 Route summarization
 Classless interdomain routing
 Network address translation
 Address allocation for private internet

35
 solution 1: get netids for all groups; impossible
 Solution 2: allow a network to be split into several parts for internal
use but still act like a single network to the outside world (three levels
of hierarchy: site, subnet, host)

a campus network consisting of LANs for various departments

36
Subnetting
 Split the host number portion of an IP address into a
subnet number and a (smaller) host number.
 Result is a 3-layer hierarchy

network prefix host number

network prefix subnet number host number

 Then: extended network prefix


 Subnets can be freely assigned within the organization
 Internally, subnets are treated as separate networks
 Subnet structure is not visible outside the organization

37
Subnetting
router

Subnet 1 Subnet 2 Subnet 3


128.213.1.x 128.213.2.x 128.213.3.x

38
Subdividing IP Classes

 Subnetting - process of segmenting a network into


multiple smaller network spaces called sub-networks or
Subnets.

 The act of taking bits fromthe host portion of the address and
reserving them to define the subnet address instead.
Steps to create subnet:

1. Determine the number of required network IDs

2. Determine the number of required host IDs per subnet


IP SUBNETTING IS FUNDAMENTAL
Subneting
 Networks divided into subnets thus:
 saving IP address spaces
 reduce broadcasting
 use the network address more efficient

 Done by reserving bits from host address


 Any number of bits can be borrowed as long as two bits
remain.

41
Subnet Masking

Some of the benefits of subnetting include:


• Reduced network traffic
• Optimized network performance
• Simplified management
42
Subnetting
 Subnets can simplify routing.
 IP subnet broadcasts have a hostID of all 1s.
 It is possible to have a single wire network with multiple
subnets.

43
How to Create a Subnet

 To create subnetworks, you take bits from the host portion

of the IP address and reserve them to define the subnet


address.
 This means fewer bits for hosts, so the more subnets, the
fewer bits available for defining hosts.

44
Steps Followed
 Determine the number of required network IDs:
 One for each subnet
 One for each wide area network connection
 Determine the number of required host IDs per subnet:
 One for each TCP/IP host
 One for each router interface
 Based on the above requirements, create the following:
 One subnet mask for your entire network
 A unique subnet ID for each physical segment
 A range of host IDs for each subnet

45
Subnet Masks
 subnet mask is 32-bit value that allows the recipient of IP
packets to distinguish the network ID portion of the IP
address from the host ID portion of the IP address.
 When assigning addresses you set both the IP address and
subnet mask.
 Not all networks need subnets, meaning they use the default
subnet mask.
 Default subnet mask is found by setting all network address
to
46
1 for each class.
Restrictions on borrowed bits
 Reserved addresses

 all 0’s= network address, all 1’s broadcast address

 Minimum of 2 bits left for host portion

47
Example
Subnetting 192.168.1.0/24

Last octet binary


Address 192.168.1.0 00000000

Subnet mask 255.255.255.0 00000000

Borrow 1 bit from host part, give it to network part, /25

Addresses 192.168.1.0 00000000


192.168.1.128 10000000
Subnet mask 255.255.255.128 10000000

48
Subnetting 192.168.1.0/24

Borrow 2 bits from host part, give to network part, /26


Addresses 192.168.1.0 00000000
192.168.1.64 01000000
192.168.1.128 10000000
192.168.1.192 11000000
Subnet mask 255.255.255.192 11000000

49
Subnetting 192.168.1.0/24

Borrow 3 bits from host part, give to network part, /27


Addresses 192.168.1.0 00000000
192.168.1.32 00100000
192.168.1.64 01000000
192.168.1.96 01100000
192.168.1.128 10000000
192.168.1.160 10100000
192.168.1.192 11000000
192.168.1.224 11100000
Subnet mask 255.255.255.224 11100000

50
Subnetting 192.168.1.0/24

Borrow 4 bits from host part, give to network part, /28


192.168.1.0 192.168.1.128 00000000 10000000
192.168.1.16 192.168.1.144 00010000 10010000
192.168.1.32 192.168.1.160 00100000 10100000
192.168.1.48 192.168.1.176 00110000 10110000
192.168.1.64 192.168.1.192 01000000 11000000
192.168.1.80 192.168.1.208 01010000 11010000
192.168.1.96 192.168.1.224 01100000 11100000
192.168.1.112 192.168.1.240 01110000 11110000

Subnet mask 255.255.255.240 11110000


And so on…
51
Subnetting 192.168.1.0/24

Bits borrowed 1 2 3 4 5 6

No of networks 2 4 8 16 32 64

Prefix /25 /26 /27 /28 /29 /30

Bit value/ 128 64 32 16 8 4


network size
No of hosts 126 62 30 14 6 2

Subnet mask 128 192 224 240 248 252

52
Subnetting 192.168.1.0/24
 Every time you borrow another bit you:
 Double the number of subnets
 Halve the size of the subnets
 Each subnet has a network address, a broadcast address,
and everything in between is a host address.

53
An organization is granted a block of addresses with the
beginning address 14.24.74.0/24. The organization needs to
have 3 subblocks of addresses to use in its three subnets as
shown below:
❑ One subblock of 120 addresses.
❑ One subblock of 60 addresses.
❑ One subblock of 10 addresses.
Solution
There are 232 − 24 = 256 addresses in this block. The first
address is 14.24.74.0/24; the last address is 14.24.74.255/24.
a.The number of addresses in the first subblock is not a power
of 2.
We allocate 128 addresses. The subnet mask is 25. The first
address is 14.24.74.0/25; the last address is 14.24.74.127/25.
54
b. The number of addresses in the second subblock is not a
power of 2 either. We allocate 64 addresses. The subnet mask
is 26. The first address in this block is 14.24.74.128/26; the
last address is
14.24.74.191/26.
c. The number of addresses in the third subblock is not a power
of 2 either. We allocate 16 addresses. The subnet mask is 28.
The first address in this block is 14.24.74.192/28; the last
address is 14.24.74.207/28.
d. If we add all addresses in the previous subblocks, the result
is 208 addresses, which means 48 addresses are left in reserve.
The first address in this range is 14.24.74.209. The last
address is 14.24.74.255.
e. Figure shows the configuration of blocks. We have shown
the55first address in each block.
56
57
Exercise
An ISP is granted a block of addresses starting with
190.100.0.0/16 (65,536 addresses). The ISP needs to distribute
these addresses to three groups of customers as follows:
❑ The first group has 64 customers; each needs approximately
256 addresses.
❑ The second group has 128 customers; each needs
approximately 128 addresses.
❑ The third group has 128 customers; each needs
approximately 64 addresses.
We design the subblocks and find out how many addresses are
still available after these allocations.

58
Activity

An organization is granted the block 130.34.12.64/26. The


organization needs four subnetworks, each with an equal
number of hosts. Design the subnetworks and find the
information about each network.

59
Assume a company has three offices: Central, East, and
West. The Central office is connected to the East and West
offices via private, WAN lines. The company is granted a
block of 64 addresses with the beginning address
70.12.100.128/26. The management has decided to allocate
32 addresses for the Central office and divides the rest of
addresses between the two other offices.

60
61
62
Exercises
 Do full subnetting for the following addresses.

1. 192.168.10.0/28

2. 192.0.10.0/30

3. 192.1.1.0/25

63
Communication Between Subnets
 A router is necessary for devices on different networks and
subnets to communicate.
 Each router interface must have an IPv4 host address that belongs
to the network or subnet that the router interface is connected to.
 Devices on a network and subnet use the router interface

attached to their LAN as their default gateway.

You might also like