Sei sulla pagina 1di 66

Unit II

BASIC
INTERNETWORKING
Objectives
 At end of this session, learners able to answer,
 What is an internet?
 What is sub netting and addressing?
• internetwork Internetworking
– collection of
networks
– interconnected
to provide
host-host to
packet delivery
service.
internetwork :
H represents hosts
and R represents
routers
Internetworking
• internet – logical network built out of collection of physical
networks.
• Network of networks
• Routers / gateways - interconnect networks

Internetworking
• What is IP
– IP stands for Internet Protocol, runs over anything
– Key tool used today to build scalable, heterogeneous
internetworks
– It runs on all the nodes in a collection of networks
– It defines the infrastructure that allows these nodes and
networks to function as a single logical internetwork

A simple internetwork showing the protocol layers


IP Service Model
• Packet Delivery Model
– Datagram - Connectionless model for data delivery
– Best-effort delivery (unreliable service)
• packets are lost
• packets are delivered out of order
• duplicate copies of a packet are delivered
• packets can be delayed for a long time
• Global Addressing Scheme
– Provides a way to identify all hosts in the internetwork
Position of IPv4 in TCP/IP protocol suite
Packet Format
– Version (4): currently 4 (IPv4)
– Hlen (4): length of header in 32-bit words
– TOS (8): type of service – allow the packets to be
treated differently based on application needs.
– Length (16): number of bytes in this datagram
– Counts bytes rather than words
– Maximum size of an IP datagram (65,535 bytes).
– Physical network may not support such long packets
– Solution – Fragmentation & Reassembly
Packet Format
Packet Format
– Ident (16): used by fragmentation
– Flags/Offset (16): used by fragmentation
– TTL (8): time to live, number of hops this
datagram has traveled, catch a packet (loop) - 64
– Protocol (8): demux key identifies the higher
level protocol to which IP packet should be
passed (TCP=6, UDP=17)
– Checksum (16): of the header only
– DestAddr & SrcAddr (32)
IP Fragmentation and Reassembly
• Each network has some MTU (Maximum
Transmission Unit)
– Ethernet (1500 bytes), FDDI (4500 bytes)

• Strategy
– Fragmentation occurs in a router when it receives a
datagram that it wants to forward over a network which
has (MTU < datagram)
– Reassembly is done at the receiving host
– All the fragments carry the same identifier in the Ident
field
– Fragments are self-contained datagrams
– IP does not recover from missing fragments
IP Fragmentation and Reassembly

IP datagrams traversing the sequence of physical networks


IP Fragmentation and Reassembly
Points to be noted:
• Each fragment – itself a self-contained IP datagram
that is transmitted over a sequence of physical
networks, independent of other fragments
• IP datagrams are re-encapsulated for each physical
network over which it travels.
IP Fragmentation and Reassembly

Header fields used in IP fragmentation. (a) Unfragmented packet; (b) fragmented


packets.
Global Addresses
• Properties
– globally unique
– hierarchical: network + host (logical structure of internetwork )
– Network part- identifies network to which host is attached
– Host part – identifies each host uniquely on the network
– 4 Billion IP address, half are A type, ¼ is B type, and 1/8 is C
type
• Format (32 bit long – in all cases)
• Dot notation
– 10.3.2.4
– 128.96.33.81
– 192.12.69.77
IPv4 Address Space
• IPV4 address space is the total number of addresses
used by the protocol.
• If a protocol uses If a protocol uses N bits to define
an address bits to define an address, the address
space is 2N .
• IPv4 uses 32-bit address: The address
space=232=4,294,967,296 ( more than 4 billion)
This means, if there were no restrictions, more than
4 billions devices would be connected to the
network
Dotted-decimal notation and binary
notation for an IPv4 address
Change the following IPv4 addresses from binary notation
to dotted-decimal notation.

Solution
We replace each group of 8 bits with its equivalent decimal
number and add dots for separation.
27 = 126 class A
networks IP Addresses
Each of them
accommodate -----
224 -2 ( 16 million)
hosts
Class B – 65,534
hosts
Class C – 256 unique
host identifiers, 0
not valid, 255 –
broadcasting,
remaining 254
attached to hosts
(221)
• In classful is divided into five classes, the address
space : A, B, C, D, and E
• Find the class of each address.
• a. 00000001 00001011 00001011 11101111
• b. 11000001 10000011 00011011 11111111
• c. 14.23.120.8
• d. 252.5.15.111
Number of blocks and block size in classful IPv4 addressing
Find the error, if any, in the following IPv4 addresses.
IP Datagram Forwarding
• Strategy
– every datagram contains destination's address
– if directly connected to destination network, then forward to host
– if not directly connected to destination network, then forward to
some router
– forwarding table maps network number into next hop
– each host has a default router
– each router maintains a forwarding table
• Example (router R2)
IP Fragmentation and Reassembly
• Algorithm
if (NetworkNum of destination = NetworkNum of one of my
interfaces) then
deliver packet to destination over that interface
else
if (NetworkNum of destination is in my forwarding table)
then
deliver packet to NextHop router
else
deliver packet to default router
For a host with only one interface and only a default router in its
forwarding table, this simplifies to
if (NetworkNum of destination = my NetworkNum)then
deliver packet to destination directly
else
deliver packet to default router
Blocks in class A

Millions of class A addresses are wasted


Blocks in class B
Blocks in class C
The number of addresses in class C is smaller than the needs of
most organizations
A network with two levels of hierarchy
(not sub netted)
A network with three levels of
hierarchy (subnetted)
Addresses in a network with and
without subnetting
Default mask and subnet mask
Default masks

33
• The network address is the beginning address of
each block.
• It can be found by applying the default mask to any
of the addresses in the block (including itself). It
retains the netid of the block and sets the hostid to
zero
• Add another level Subnetting
to address/routing
hierarchy: subnet
• Subnet masks
single network
number can be
shared among
multiple networks
involves
configuring all the
modes on each
subnets.
• Subnet – visible
only within site.
Subnetting

• Forwarding Table at Router R1


Subnetting
Forwarding Algorithm
D = destination IP address
for each entry < SubnetNum, SubnetMask, NextHop>
D1 = SubnetMask & D
if D1 = SubnetNum (sending host – destination in
same subnet)
if NextHop is an interface
deliver datagram directly to destination
else
deliver datagram to NextHop (a router)
What is the subnetwork address if the destination address is
200.45.34.56 and the subnet mask is 255.255.240.0?
Solution
We apply the AND operation on the address and the
subnet mask.
Address ➡ 11001000 00101101 00100010 00111000
Subnet Mask ➡ 11111111 11111111 11110000 00000000
Subnetwork Address ➡ 11001000 00101101 00100000 00000000.

38
Comparison of a default mask
and a subnet mask

Default masking is a process that extracts the network address


from an IP address.
Subnet masking is a process that extracts the subnetwork address
from an IP address
Subnetting

Notes
• Would use a default router if nothing matches
• Not necessary for all ones in subnet mask to be
contiguous
• Can put multiple subnets on one physical network
• Subnets not visible from the rest of the Internet
Classful addressing
• In subnetting, we need the first address of the
subnet and the subnet mask to define the range of
addresses
• In supernetting, we need the first address of the
supernet and the supernet mask to define the range
of addresses.
• Classful addressing, which is almost obsolete, is
replaced with classless addressing
Comparison of subnet, default, and
supernet masks
Classless Addressing
• Classless Inter-Domain Routing
– A technique that addresses two scaling concerns in the
Internet
• The growth of backbone routing table as more and more network
numbers need to be stored in them
• Potential exhaustion of the 32-bit address space
– Address assignment efficiency
• Arises because of the IP address structure with class A, B, and C
addresses
• Forces us to hand out network address space in fixed-size chunks of
three very different sizes
– A network with two hosts needs a class C address
» Address assignment efficiency = 2/255 = 0.78
– A network with 256 hosts needs a class B address
» Address assignment efficiency = 256/65535 = 0.39
Classless Addressing
• Exhaustion of IP address space centers on
exhaustion of the class B network numbers
• Solution
– Say “NO” to any Autonomous System (AS) that requests
a class B address unless they can show a need for
something close to 64K addresses
– Instead give them an appropriate number of class C
addresses
– For any AS with at least 256 hosts, we can guarantee an
address space utilization of at least 50%
• What is the problem with this solution?
Classless Addressing
• Problem with this solution
– Excessive storage requirement at the routers.
• If a single AS has, say 16 class C network numbers
assigned to it,
– Every Internet backbone router needs 16 entries in its
routing tables for that AS
– This is true, even if the path to every one of these
networks is the same
• If we had assigned a class B address to the AS
– The same routing information can be stored in one entry
– Efficiency = 16 × 255 / 65, 536 = 6.2%
Classless Addressing

• Classless Inter Domain Routing (CIDR) tries to


balance the desire to minimize the number of routes
that a router needs to know against the need to hand
out addresses efficiently.

• CIDR uses aggregate routes


– Uses a single entry in the forwarding table to tell the
router how to reach a lot of different networks
– Breaks the rigid boundaries between address classes
Classless Addressing
• Consider an AS with 16 class C network numbers.
• Instead of handing out 16 addresses at random, hand
out a block of contiguous class C addresses
• Suppose we assign the class C network numbers from
192.4.16 through 192.4.31
• Observe that top 20 bits of all the addresses in this
range are the same (11000000 00000100 0001)
– We have created a 20-bit network number (which is in
between class B network number and class C number in
terms of no. of hosts that it can support)
Classless Addressing
– We get high address efficiency of handing out address in
chunks smaller than class B network and a single
network prefix that can be used in forwarding tables.
• Requires to hand out blocks of class C addresses that
share a common prefix
Classless Addressing
• In IPv4 addressing, a block of
addresses can be defined as x.y.z.t /n
• x.y.z.t defines one of the addresses and the /n defines
the mask
• The convention is to place a /n after the prefix, where
n is the prefix length in bits
• For example, the 20-bit prefix for all the networks
192.4.16 through 192.4.31 is represented as
192.4.16/20
• By contrast, if we wanted to represent a single class C
network number, which is 24 bits long, we would
write it 192.4.16/24
A block of 16 addresses granted to a small organization
Classless Addressing
• How do the routing protocols handle this classless
addresses
– It must understand that the network number may be of
any length
• Represent network number with a single pair
<length, value>
All routers must understand CIDR addressing
• The first address in the block can be found by
setting the rightmost 32 − n bits to 0s.
• A block of addresses is granted to a small
organization. One of the addresses is
205.16.37.39/28. What is the first address in
the block?
Solution
• The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000
or 205.16.37.32.
Classless Addressing
• The last address in the block can be found by setting the
rightmost 32 − n bits to 1s.
• A block of addresses is granted to a small organization.
One of the addresses is 205.16.37.39/28. What is the
first address in the block?
Solution
• The binary representation of the given address is
11001101 00010000 00100101 00100111
• If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
or
205.16.37.47
Classless Addressing
• The number of addresses in the block can be found by
using the formula 232−n.
• A block of addresses is granted to a small
organization. We know that one of the addresses is
205.16.37.39/28. find the no. of address in the
block?
• Solution:
• The first address in a block is normally not assigned
to any device; it is used as the network address that
represents the organization to the rest of the world.
• Each address in the block can be considered as a
two-level hierarchical structure:
– the leftmost n bits (prefix) define the network
– the rightmost 32 − n bits define the host
Classless Addressing

 Customer share a common, shorter


address prefix
 Aggregation of routes
 ISP advertise single route to reach all
the 8 customers with common 21 bits
prefix they share.
Route aggregation with CIDR
IP Forwarding Revisited
• IP forwarding mechanism assumes that it can find
the network number in a packet and then look up
that number in the forwarding table

• We need to change this assumption in case of CIDR

• CIDR means that prefixes may be of any length,


from 2 to 32 bits
IP Forwarding Revisited
• It is also possible to have prefixes in the forwarding
tables that overlap
– Some addresses may match more than one prefix
• For example, we might find both 171.69 (a 16 bit
prefix) and 171.69.10 (a 24 bit prefix) in the forwarding
table of a single router
• A packet destined to 171.69.10.5 clearly matches both
prefixes.
– The rule is based on the principle of “longest match”
• 171.69.10 in this case
• A packet destined to 171.69.20.5 would match 171.69
and not 171.69.10
Address Resolution Protocol (ARP)
Sending node knows:
– destination host or receiving node IP address
– IP address of the next hop router or default router
– Each router expect the last one in the path gets the IP
address of the next router in the forwarding table .
– Last router knows the IP address of the destination host.
– But IP address of the next node is not helpful in moving
the frame through a link
– We need link layer address of the next node
ARP - Map IP addresses into physical addresses or logical
link address and passes into data link layer
• Techniques
– encode physical address in host part of IP address
– table-based
• ARP (Address Resolution Protocol)
– table of IP to physical address bindings
– broadcast request if IP address not in table
– target machine responds with its physical address
– table entries are discarded if not refreshed
ARP Packet Format

– HardwareType: type of physical network (e.g., Ethernet)


– ProtocolType: type of higher layer protocol (e.g., IP)
– HLEN & PLEN: length of physical and protocol addresses
– Operation: request or response
– Source/Target Physical(Ethernet)/Protocol (IP) addresses
Host Configurations
• Notes
– Ethernet addresses are configured into network by
network adopter manufacturer and they are unique
– IP addresses must be unique on a given internetwork but
also must reflect the structure of the internetwork
– Most host Operating Systems provide a way to manually
configure the IP information for the host
– Drawbacks of manual configuration
• A lot of work to configure all the hosts in a large network
• Configuration process is error-prune
– Automated Configuration Process is required
Dynamic Host Configuration Protocol (DHCP)

• DHCP server is responsible for providing


configuration information to hosts
• There is at least one DHCP server for an
administrative domain
• DHCP server maintains a pool of available addresses
DHCP
• Newly booted or attached
host sends DHCPDISCOVER
message to a special IP
address (255.255.255.255)
• One DHCP server not
required for each network.
(DHCP relay agent for one
network – configured with IP
address of DHCP server)
• DHCP relay agent unicasts
the message to DHCP server
and waits for the response.
Internet Control Message Protocol (ICMP)
• Defines a collection of error messages that are sent back to
the source host whenever a router or host is unable to
process an IP datagram successfully
– Destination host unreachable due to link /node failure
– Reassembly process failed
– TTL had reached 0 (so datagrams don't cycle forever)
– IP header checksum failed

• ICMP-Redirect
– From router to a source host
– Eg. It tells source, a better route to the destination
Internet Control Message Protocol (ICMP)
• ICMP provides two widely used debugging tools:
– Ping : uses ICMP echo messages to determine if a node
is reachable and alive

– Traceout : uses non-intuitive technique to determine


the set of routers along the path to a destination.

Potrebbero piacerti anche