0% found this document useful (0 votes)
25 views11 pages

Lecture 8

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 11

Lecture 8: Network Layer Part 2

Slide: Subnets

What is a subnets?

A subnet is a logical subdivision of an IP network, and devices within the same subnet can
communicate with each other directly without the need for routing through an intervening router.

A subnet mask is a 32-bit number that divides an IP address into network and host portions. It's used
to delineate the network ID from the host ID within an IP address. The subnet mask contains a series
of contiguous "1" bits followed by contiguous "0" bits.

Default Subnet Masks:

Class A: 255.0.0.0 or /8

Class B: 255.255.0.0 or /16

Class C: 255.255.255.0 or /24

IP Address: 192.168.1.0 / 24 (255.255.255.0)

The pink one is the network.

The blue is the host.

For this IP, only the blue will change in the network.

The maximum for this IP address is 192.168.1.255/24

Note: we can cannot use IP 192.168.1.0 and 192.168.1.255 for our network, they are reserved.

Usable IP addresses:

/8 – Total: 16,777,216 = Usable: 16,777,214

/16- Total: 65,536 = Usable: 65,534

/24- Total: 256 = Usable: 254

Custom Subnet Masks:

Subnetting allows for custom subnet masks to create smaller, more efficient subnets. Common
examples include:

255.255.255.128 or /25

255.255.255.192 or /26

255.255.255.224 or /27

255.255.255.240 or /28
Subnetting is the process of dividing an IP network into sub-networks to improve performance and
security. This segmentation is achieved by creating smaller, more manageable groups of devices
within the larger network.

Subnetting is done to eliminate wastage to unassigned IP addresses.

It is calculated as shown below:

Step 1: Determine the number of hosts per network and convert to binary

For example, we have 60 hosts/devices for this 192.168.1.0 /24

60 = 64 32 16 8 4 2 1

1 1 1 1 0 0 = 6 bits to represent 60 hosts.

Step 2: Reserve bits in subnet mask and find your increment

/24 = 255.255.255.0

255.255.255.255. 00000000

255.255.255 . 11000000 = we must input six zero as we had 6 bits in the steps above and the
remaining one become 1.

As seen in the screenshot above, the ones are 128 + 64 = 192.

255.255.255.192 / 26

Step 3: Use increment to find your network ranges

192.168.1.0 ----- 63 = as we must look at the last one in the above step which is 64.

192.168.1.64 --- 127 (63+64) = We must look for and use the range where there is the least wastage.

192.168.1.128 ----- 191

192.168.1.0 ----- 63 is the least wastage we can get IP address for our 60 hosts.

We have 62 usable IP address and 64 in total.

So, the answer is 192.168.1.0 / 26.


Another example where we have 20 hosts:

Step 1: 32 16 8 4 2 1

1 0100

20 hosts = 5 bits

Step 2:

/24 = 255.255.255.0

255.255.255.255. 00000000

255.255.255 .11100000

128 +64+32 = 224

255.255.255.224 / 27

Step 3:

The answer if we consider the example of 60 hosts:

Last one = 32 (Increment)

192.168.1.64 ---- 95 (+ 32)

192.168.1.96 ---- 127

192.168.1.128 --- 159

Answer: 192.168.1.64 / 27

20 host

Total IP = 32

Usable = 30

Wastage = 10
The answer if we did not use the first 64 address in the 60 hosts

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

Last one = 32 (Increment)

192.168.1.0 --- 31

192.168.1.32 ----63

Answer: 192.168.1.0 / 27

20 host

Total IP = 32

Usable = 30

Wastage = 10

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

Slide: IP addressing: CIDR

Classless Inter-Domain Routing (CIDR) is an IP address allocation method that improves data routing
efficiency on the internet.

Slide: IP addresses: how to get one?

 Hard‐coded by systerm admin in config file (e.g., /etc/rc.config in UNIX)


 DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server (Home
Router do this)

Slide: Dynamic Host Configuration Protocol

The Dynamic Host Configuration Protocol (DHCP) is a network protocol used to automatically assign
and manage IP addresses and other network configuration information to devices on a network.
DHCP simplifies the process of IP address management and helps prevent conflicts caused by manual
IP address assignment. The WIFI router works like this at home. It will give all people at home an IP
address from its pool of addresses.
How DHCP assign the IP:

 Host broadcasts DHCP discover msg [optional]


 DHCP server responds with DHCP offer msg [optional]
 Host requests IP address: DHCP request msg
 DHCP server sends address: DHCP ack msg

Slide: DHCP Client-Server Scenario

Slide: DHCP: More than IP Addresses

DHCP can return more than just allocated IP address on subnet:

 address of first‐hop router for client


 name and IP address of DNS sever
 network mask (indicating network versus host portion of address)

Slide: Hierarchical Addressing: Route Aggregation

Hierarchical addressing and route aggregation are concepts used in networking to efficiently
organize and manage IP addresses and routing information.

These concepts play a crucial role in reducing the size of routing tables and improving the scalability
and performance of the Internet.
Slide: IP Addressing: Last Words

These institution are given IP addresses and they sell them to local ISP and we buy it from them.
Slide: NAT: Network Address Translation

Network Address Translation (NAT) is a technique used in networking to map private IP addresses
within a local network to a single public IP address, or a small range of public IP addresses, when
accessing resources on the Internet.

NAT allows multiple devices in a private network to share a common public IP address, providing a
layer of security and conserving public IP address space (Conserving IPv4).

Advantages of NAT:

Conservation of Public IP Addresses:

NAT allows multiple devices in a local network to share a single public IP address, which conserves
the limited pool of available public IP addresses.

Security:

NAT acts as a basic firewall by hiding the internal network structure. It prevents direct access to
devices with private IP addresses from the Internet.
Address Space Flexibility:

Private IP addresses can be used within a local network without conflicting with public IP addresses
on the Internet.

NAT is implemented on the Router.

NAT is a bit controversial:

A router should only process up to layer 3. (Changing ports number is transport layer jobs.)

NAT will not be used as much as IPv6 is going to resolve the IPv4 shortage.

Slide: IPv6 Motivation

32-bits IPv4 address space would be completely allocated.

Transition from IPv4 to IPv6 = New equipment is needed. Costly (need new switches)

IPv4 and IPv6 is not compatible.


Slide: IPv6 Datagram Format

IPv6 Datagram Header Fields:

Version (4 bits):

Indicates the version of the IP protocol. For IPv6, this field is set to 6.

Traffic Class (8 bits):

Similar to the IPv4 Type of Service (ToS) field. It is used to differentiate and prioritize traffic. It
includes the Differentiated Services Code Point (DSCP) and Explicit Congestion Notification (ECN)
fields.

Flow Label (20 bits):

Used to identify a flow, which is a sequence of packets sent from a source to a destination. The flow
label helps routers and switches to provide special handling for packets belonging to the same flow.

Payload Length (16 bits):

Specifies the length of the payload in octets (8-bit units), excluding the length of the IPv6 header.
The maximum payload length is 65,535 octets.

Next Header (8 bits):

Identifies the protocol used in the payload, similar to the IPv4 Protocol field. For example, it might
indicate TCP, UDP, ICMPv6, or another protocol.

Hop Limit (8 bits):

Similar to the IPv4 Time-to-Live (TTL) field. It limits the number of hops a packet can take in the
network, helping to prevent packets from looping indefinitely.
Source Address (128 bits):

The 128-bit IPv6 address of the source node.

Destination Address (128 bits):

The 128-bit IPv6 address of the destination node.

Slide: Transition from IPv4 to IPv6

Transition is not quickly. It takes time for company to invest and some won’t invest for the time
being.

How to use tunnelling to allow IPv4 network to communicate with an IPv6 network?
IPv6 tunneling is a technique used to enable the transmission of IPv6 packets over an IPv4 network
infrastructure. This is necessary when either the source or destination network does not natively
support IPv6. IPv6 tunneling encapsulates IPv6 packets within IPv4 packets, allowing them to
traverse IPv4 networks.

Slide: Tunneling and Encapsulation

Encapsulation is the process of adding a header (and possibly a trailer) to the data (payload) of a
higher-layer protocol. The encapsulated data is then transmitted as the payload of a lower-layer
protocol.
Router B and E is hybrid. (understand both IPv4 and IPv6)

For the router A to send data to router F, it needs to send the IPv6 packet to Router B. Then, it will
encapsulate the IPv6 packet in a IPv4 packet which can be sent to Router E. Router E will then
decapsulate it for router F.

This process is like tunnel where the IPv6 is hidden in a IPv4 packet.

Slide: IP fragmentation/reassembly

IP fragmentation and reassembly are mechanisms used in the Internet Protocol (IP) to handle the
transmission of large packets across networks with smaller Maximum Transmission Unit (MTU) sizes.
When a packet is too large to be transmitted over a network with a lower MTU, IP fragmentation
breaks it into smaller fragments before transmission. The destination host then reassembles these
fragments to reconstruct the original packet.

Take resources and time to do this. This is why there is not this feature in IPv6.

You might also like