Você está na página 1de 126

Tunneling

• One of the method to connect two different


networks.
• This method is used when the source and
destination hosts are on the same type of
network, but there is a different network in
between.
• Tunneling is widely used to connect isolated hosts
and networks using other networks.
• The network that results is called an overlay
since it has effectively been overlaid on the base
network.
• Hosts on the network that is tunnelled cannot be
reached by other.
• This leads to creation of Virtual Private
Networks(VPN)
Advantages
1. Security: With tunnel we can create a private link across
public network.
2. R1 and R2 may be multicast routers- some extra
capabilities which are not available in other network.
3. To carry packets from protocols other than IP across an IP
network.
Disadvantages
• Increases the length of packets; this might represent a
significant waste of bandwidth for short packets.
• Longer packets might be subject to fragmentation, which
has its own set of drawbacks.
• There may also be performance implications for the routers
at either end of the tunnel, since they need to do more work
than normal forwarding as they add and remove the tunnel
header.
• There is a management cost for the administrative entity
that is responsible for setting up the tunnels and making
sure they are correctly handled by the routing protocols.
Internetwork routing
Need
• Original ARPANET had single routing protocol.
• New networks came on the scene
– NSFnet(National Science Foundation),
CSnet(Computer Science), DDN(Data Direct
Networks) etc
– Number of nodes were growing exponentially.
– Each small network had own routing protocols(RIP,
OSPF, ISIS) and rules(NSF AUP)
– New requirements
• Huge scale : millions of routers.
• Varying routing metrics.
• Business policies.
Complicated Internet
Two level hierarchy of routing algorithm
1. Routing within networks:
– Using different routing algorithm inside networks.
– Operated by different operators.
– Having different metrics for computing shortest
path.
Intradomain routing (Interior Gateway Protocol)
–The protocol used for routing within the network.
–Examples: Link state routing – OSPF.
Distance Vector routing- RIP
2. Routing between the networks
• Every network operates independently called
as AS (Autonomous System) e.g., ISP’s
Interdomian routing protocol(Exterior gateway
• Used for routing between the AS.
Examples: Border Gateway Protocol(BGP)
Exterior Gateway Protocol.
Discussion
• Each ISP may charge or receive money from
the other ISPs for carrying traffic.
• Laws and policies to carry data of other
countries
Fragmentation
Each network imposes some maximum size on its
packets. These limits have various causes, among
them:
1. Hardware (e.g., the size of an Ethernet frame).
2. Operating system (e.g., all buffers are 512 bytes).
3. Protocols (e.g., the number of bits in the packet
length field).
4. Compliance with some (inter)national standard.
5. Desire to reduce error-induced retransmissions to
some level.
6. Desire to prevent one packet from occupying the
channel too long.
• The network designers are not free to choose any
maximum packet size they wish.

• Maximum payloads range from 48 bytes (ATM


cells) to 65,515 bytes (IP packets).

• The payload size in higher layers is often larger.

• Problem appears when a large packet wants to


travel through a network whose maximum packet
size is too small.
Solutions.

1. To make sure the problem does not occur in


the first place- Get to know Path Maximum
Transmission Unit(MTU)

2. To allow gateways to break up packets into


fragments, sending each fragment as a
separate internet packet - Fragmentation
There are two types of fragmentations
a) Transparent Fragmentation
b) Non transparent fragmentation
a) Transparent Fragmentation
• The small-packet network has gateways (most likely,
specialized routers) that interface to other networks.
• When an oversized packet arrives at a gateway, the
gateway breaks it up into fragments.
• Each fragment is addressed to the same exit gateway,
where the pieces are recombined.
• Subsequent networks are not even aware that
fragmentation has occurred.
• ATM networks, for example, have special hardware to
provide transparent fragmentation of packets into cells
and then reassembly of cells into packets.
• In the ATM world, fragmentation is called
segmentation;
D’tages
• The exit gateway must know when it has
received all the pieces, so either a count field
or an ''end of packet'' bit must be provided.
• All packets must exit via the same gateway.
• Overhead required to repeatedly reassemble
and then refragment a large packet passing
through a series of small-packet networks.
a) Non transparent fragmentation
• In this approach the recombining of fragments
does not occur at intermediate gateways.
• Once a packet has been fragmented, each
fragment is treated as though it were an original
packet.
• All fragments are passed through the exit
gateway.
• Recombination occurs only at the destination
host.
 Example of non transparent fragmentation is IP
network.
D’tages
• It requires every host to be able to do
reassembly.
• When a large packet is fragmented, the total
overhead increases because each fragment
must have a header.
Numbering the fragments for easier reassembly
Fragmentation when the elementary data size is 1 byte.
(a) Original packet, containing 10 data bytes.
(b) Fragments after passing through a network with maximum
packet size of 8 payload bytes plus header.
(c) Fragments after passing through a size 5 gateway.
Modern networks
• Fragmentation is detrimental to performance.
• Header overhead.
• Losing any one of the fragments may lead to
rejecting an entire packet.
Path MTU discovery
• Each IP packet is sent with its header bits set to
indicate that no fragmentation is allowed to be
performed.
• If a router receives a packet that is too large, it
generates an error packet, returns it to the source,
and drops the packet.
• The source refragments the packet into pieces
that are small enough for the router to handle.
• If a router further down the path has an even
smaller MTU, the process is repeated.
Advantage
• Source now knows what length packet to send.
• If the routes and path MTU change, new error
packets will be triggered and the source will
adapt to the new path.
Disadvantage
• Added startup delays simply to send a packet.
• More than one round-trip delay may be needed
to probe the path and find the MTU before any
data is delivered to the destination.
The network layer
• At the network layer, the Internet can be
viewed as a collection of networks or ASes
(Autonomous Systems) that are
interconnected.
• There is no real structure, but several major
backbones exist.
• Backbone networks are constructed from high-
bandwidth lines and fast routers.
• The biggest of these backbones, to which
everyone else connects to reach the rest of the
Internet, are called Tier 1 networks.
• Attached to the backbones are ISPs - provide
Internet access to homes and businesses, data
centers.
• The glue that holds the whole Internet together
is the network layer protocol, IP (Internet
Protocol).
IP Protocol
• The job of network layer is to provide a best-efforts (i.e.,
not guaranteed) way to transport datagrams from source to
destination, without regard to whether these machines are
on the same network or whether there are other networks in
between them.
Communication in the Internet works as follows:
• The transport layer takes data streams and breaks them up
into datagrams.
• Datagrams can be up to 64 Kbytes each, but in practice they
are usually not more than 1500 bytes (so they fit in one
Ethernet frame).
• Each datagram is transmitted through the Internet, possibly
being fragmented into smaller units as it goes.
• When all the pieces finally get to the destination machine,
they are reassembled by the network layer into the original
datagram.
• This datagram is then handed to the transport layer, which
inserts it into the receiving process' input stream.
IPV4 Header structure
• An IP datagram consists of a header part and a
text part.
• The header has a 20-byte fixed part and a
variable length optional part.
• It is transmitted in big-endian order: from left
to right, with the high-order bit of the Version
field going first.
The SPARC is big endian; the Pentium is
little-endian.
• Version: The version of the protocol.
• IHL: The length of header in 32 bit words.
– The minimum value is 5, which applies when no options
are present.
– The maximum value of this 4-bit field is 15, which limits
the header to 60 bytes, and thus the Options field to 40
bytes.
• Diffrentiated services: to distinguish between different
classes of service. MSB 6 bits marks service class and
LSB 2 bits carry ECN information.
• The Total length includes everything in the datagram—
both header and data.
– The maximum length is 65,535 bytes.
• The Identification field: needed to allow the destination
host to determine which datagram a newly arrived
fragment belongs to.
– All the fragments of a datagram contain the same
Identification value.
• Two 1 bit fields: DF(Don’t Fragment)- It is an order to
the routers not to fragment the datagram because the
destination is incapable of putting the pieces back
together again.
• MF (More Fragments): All fragments except the last one
have this bit set.
– It is needed to know when all fragments of a datagram have
arrived.
• Fragment offset: where in the current datagram this
fragment belongs.
– All fragments except the last one in a datagram must be a
multiple of 8 bytes, the elementary fragment unit.
– Since 13 bits are provided, there is a maximum of 8192
fragments per datagram, giving a maximum datagram length of
65,536 bytes.
• Time to live :a counter used to limit packet lifetimes.
– It is supposed to count time in seconds, allowing a maximum
lifetime of 255 sec.
– It must be decremented on each hop and is supposed to be
decremented multiple times when queued for a long time in a
router.
– In practice, it just counts hops. When it hits zero, the packet is
discarded and a warning packet is sent back to the source host.
• The Protocol field tells it which transport process
to give the packet to. TCP is one possibility, but
so are UDP and some others.
• Header checksum : verifies only header.
– Useful for detecting errors generated by bad memory
words inside a router.
– Recomputed at each hop because at least one field
always changes (the Time to live field).
• Source address and Destination address: indicate
the IP addresses
• Options: To allow subsequent versions of the
protocol to include information not present in the
original design,
– To permit experimenters to try out new ideas, and to
avoid allocating header bits to information that is
rarely needed.
Some IP options

• Security: how secret the information is- An


information to router to not to route to certain
countries.
• Strict source routing : complete path from source
to destination as a sequence of IP addresses.
– The datagram is required to follow that exact route.
– It is most useful for system managers to send
emergency packets when the routing tables are
corrupted, or for making timing measurements.
• Loose source routing : requires the packet to
traverse the list of routers specified, and in the
order specified, but it is allowed to pass
through other routers on the way.
• Record Route:tells the routers along the path to
append their IP address to the option field.
• Timestamp: each router also records a 32-bit
timestamp.
– Useful for debugging routing algorithms.
IP Addresses
• Every host and router on the Internet has an IP
address, which encodes its network number and
host number.
• No two machines on the Internet have the same IP
address.
• All IP addresses are 32 bits long and are used in
the Source address and Destination address fields
of IP packets.
• IP address does not actually refer to a host.
• It refers to a network interface, so if a host is on
two networks, it must have two IP addresses.

Prof. Veena.Gadad, Dept of CSE, RVCE. 32


Classful Addressing

• Class A address: 128 networks with 16 million hosts each.


• Class B address: 16384 networks with 64K hosts each.
• Class C network:2 million networks with 256 hosts each
• Class D network: Multicast addressing.
• Class E network: reserved.
 Network numbers are managed by a nonprofit corporation
called ICANN (Internet Corporation for Assigned Names
and Numbers) to avoid conflicts.
Prof. Veena.Gadad, Dept of CSE, RVCE. 33
• Network addresses, which are 32-bit numbers, are
usually written in dotted decimal notation.(e.g.,
128.208.2.151.)
• In this format, each of the 4 bytes is written in
decimal, from 0 to 255.
Special IP addresses

• The IP address 0.0.0.0 is used by hosts when they are


being booted.
• IP addresses with 0 as network number refer to the
current network.

Prof. Veena.Gadad, Dept of CSE, RVCE. 34


• The address consisting of all 1s allows
broadcasting on the local network, typically a
LAN.
• The addresses with a proper network number and
all 1s in the host field allow machines to send
broadcast packets to distant LANs anywhere in
the Internet
• All addresses of the form 127.xx.yy.zz are
reserved for loopback testing.
– Packets sent to that address are not put out onto the
wire; they are processed locally and treated as
incoming packets.
– This allows packets to be sent to the local network
without the sender knowing its number.

Prof. Veena.Gadad, Dept of CSE, RVCE. 35


Convert IP address: 172.16.18.106 and
79.73.236.63 into respective hexadecimal and
binary format .
Soln:
172.16.18.106 ------ac10126A-----
1010 1100 0001 0000 0001 0010 0110 1010
79.73.236.63 --------4f49ec3f ----
0010 1111 0100 1001 1110 1100 0011 1111

Prof. Veena.Gadad, Dept of CSE, RVCE. 36


IPV4 Addresses

Prof. Veena.Gadad, Dept of CSE, RVCE. 37


Prof. Veena.Gadad, Dept of CSE, RVCE. 38
Contrasting PC1 IPV4 dotted decimal and binary
address

192 . 168 . 10 . 10

11000000 10101000 00001010 00001010

Octet1 Octet2 Octet3 Octet4

IP ADDRESS IS MADE UP OF 4 OCTETS

Prof. Veena.Gadad, Dept of CSE, RVCE. 39


Host and Network Portions.
• IPv4 address is a hierarchical address that is made
up of a network portion and a host portion.
• When determining the network portion versus the
host portion, it is necessary to look at the 32-bit
stream.
• Within the 32-bit stream, a portion of the bits
identify the network, and a portion of the bits identify
the host.

Prof. Veena.Gadad, Dept of CSE, RVCE. 40


• The bits within the network portion of the
address must be identical for all devices that
reside in the same network.
• The bits within the host portion of the address
must be unique to identify a specific host
within a network.
• If two hosts have the same bit-pattern in the
specified network portion of the 32-bit stream,
those two hosts will reside in the same
network.

Prof. Veena.Gadad, Dept of CSE, RVCE. 41


• But how do hosts know which portion of the
32-bits identifies the network and which
identifies the host?
• That is the job of the subnet mask.

Prof. Veena.Gadad, Dept of CSE, RVCE. 42


Subnet Mask
• IPv4 addresses must be configured when
assigning an IPv4 configuration to host:
IPv4 address – Unique IPv4 address of the host
Subnet mask- Used to identify the network/host
portion of the IPv4 address
Default gateway – Identifies the local gateway
(i.e. local router interface IPv4 address) to
reach remote networks

Prof. Veena.Gadad, Dept of CSE, RVCE. 43


• When an IPv4 address is assigned to a device,
the subnet mask is used to determine the
network address where the device belongs.
• The network address represents all the devices
on the same network.

Prof. Veena.Gadad, Dept of CSE, RVCE. 44


• To identify the network and host portions of an
IPv4 address, the subnet mask is compared to
the IPv4 address bit for bit, from left to right.
• The 1s in the subnet mask identify the network
portion.
• The 0s identify the host portion.
• Note that the subnet mask does not actually
contain the network or host portion of an IPv4
address, it just tells the computer where to look
for these portions in a given IPv4 address.

Prof. Veena.Gadad, Dept of CSE, RVCE. 45


To determine the network address

Prof. Veena.Gadad, Dept of CSE, RVCE. 46


Example:
Host Address: 10 . 133 . 26 . 106
Subnet Mask: 255 . 255 . 255 . 224
Host Address in Binary:
00001010 . 10000101 . 00011010 . 01101010
Subnet Mask in Binary:
11111111 . 11111111 . 11111111 . 11100000
Network Address in binary:
00001010 . 10000101 . 00011010 . 01100000
Network Address in decimal:
10 . 133 . 26 . 96
Prof. Veena.Gadad, Dept of CSE, RVCE. 47
The Prefix Length
• Expressing network addresses and host addresses
with the dotted decimal, subnet mask address can
become cumbersome.
• There is an alternate shorthand method of
identifying a subnet mask called the prefix
length.
• The prefix length is the number of bits set to 1 in
the subnet mask.
• It is written in “slash notation”, which is a “/”
followed by the number of bits set to 1.
• Count the number of bits in the subnet mask and
prepend it with a slash.

Prof. Veena.Gadad, Dept of CSE, RVCE. 48


Subnet mask used Subnet mask Subnet mask
with the host converted to binary expressed as prefix
address

Prof. Veena.Gadad, Dept of CSE, RVCE. 49


Types of Addresses in a network:
1. Network Address: All hosts within the network share
same network address. The host portion is all0s.
2. Host Addresses: Unique IP addresses to hosts and
devices. The host portion contains assorted 0s and 1s
but never all 0s or all 1s.
1. First Host Address: First available host IP address in that
network. The host portion always has all 0s ends with a 1.
2. Last Host Address: Last available host IP address in that
network. The host portion always has all 1s and ends with
a 0.
3. Broadcast Address: A special address that
communicates with all hosts in a network. It uses the
highest address in the network range. The host portion
is all 1s.

Prof. Veena.Gadad, Dept of CSE, RVCE. 50


Decimal IP Address Binary IP Address and Subnet
and Subnet Mask and Mask
Network Address
192.168.1.100 11000000. 10101000.00000001.1100100
255.255.255.0 11111111. 11111111. 11111111.00000000
NETWORK HOST PART
(/24) PART

192.168.1.0 11000000 .10101000. 00000000 . 00000000

•Because the first 24 bits in the subnet mask are consecutive numeral
ones , the corresponding first 24 bits in the IP address in binary is
11000000. 10101000.00000001;these represent the network portion of
the address.
•The remaining 8 bits are 1100100 and represent the host portion of the
address.
Prof. Veena.Gadad, Dept of CSE, RVCE. 51
• The network address is the first address in the
network.(192.168.1.0)
• The broadcast address is the last address in the
network. (192.168.1.255)
• The first usable host address in the network is
the first address after the network
address.(192.168.1.1)
• The last usable host address is the address
prior to the broadcast address. (192.168.1.254).
• How many hosts can be connected in this
network ?(or how many usable IP addresses?)
28-2= 254
Prof. Veena.Gadad, Dept of CSE, RVCE. 52
Example:
IP address: 192.168.1.10.
Subnet mask: 255.255.248.0.
Determine
1. Network address.
2. Number of hosts in this network.
3. First host address.
4. Last host address.
5. Broadcast address.

Prof. Veena.Gadad, Dept of CSE, RVCE. 53


Decimal IP Address Binary IP Address and Subnet
and Subnet Mask and Mask
Network Address
192.168.1.10 11000000. 10101000.00000001.00001010
255.255.248.0 11111111. 11111111. 11111000.00000000
NETWORK
(/21) PART
HOST PART

192.168.0.0 11000000 .10101000. 00000000 . 00000000

•Because the first 21 bits in the subnet mask are consecutive numeral
ones , the corresponding first 21 bits in the IP address in binary is
11000000 10101000 00000 ;these represent the network portion of the
address.
•The remaining 11 bits are 00100001010 and represent the host portion
of the address.
Prof. Veena.Gadad, Dept of CSE, RVCE. 54
• The network number and the broadcast
address use two addresses out of the subnet.
• The number of hosts available in an IPv4
subnet is the number 2 to the power of the
number of host bits available , minus 2:
Number of available hosts = 2 (number of host bits)–2
• In the previous example, number of hosts
available in the subnet are 211-2= 2046.
• First host address: 192.168.0.1.
• Last host address: 192.168.7.254.
• Broadcast address: 192.168.7.255

Prof. Veena.Gadad, Dept of CSE, RVCE. 55


Complete the following

Prof. Veena.Gadad, Dept of CSE, RVCE. 56


Subnetting
• The block of addresses to be split into several
parts for internal use as multiple networks,
while still acting like a single network to the
outside world.
• This is called subnetting and the networks
(such as Ethernet LANs) that result from
dividing up a larger network are called
subnets.

Prof. Veena.Gadad, Dept of CSE, RVCE. 57


• Given an IP address, its class can be
determined from the three high-order bits (the
three left-most bits in the first octet).

Prof. Veena.Gadad, Dept of CSE, RVCE. 58


In a Class A address, the first octet is the network
portion, so the Class A has a major network address of
1.0.0.0 - 127.255.255.255. Octets 2, 3, and 4 (the next
24 bits) are for the network manager to divide into
subnets and hosts as he/she sees fit. Class A addresses
are used for networks that have more than 65,536 hosts
In a Class B address, the first two octets are the network portion,
(actually, up to
so the 16777214
Class B examplehosts!).
has a major network address of
128.0.0.0 - 191.255.255.255. Octets 3 and 4 (16 bits) are for
local subnets and hosts. Class B addresses are used for networks
that have between 256 and 65534 hosts.
In a Class C address, the first three octets are the network
portion. The Class C has a major network address of
192.0.0.0 - 223.255.255.255. Octet 4 (8 bits) is for local
subnets and hosts - perfect for networks with less than 254
hosts. Prof. Veena.Gadad, Dept of CSE, RVCE. 59
• A subnet mask helps to know which portion of
the address identifies the network and which
portion of the address identifies the host.
• Class A, B, and C networks have default
masks, also known as natural masks, as
shown here:
Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0

Prof. Veena.Gadad, Dept of CSE, RVCE. 60


Understanding Subnetting
• Subnetting allows to create multiple logical networks
that exist within a single Class A, B, or C network.
• In order to subnet a network, extend the natural mask
with some of the bits from the host ID portion of the
address in order to create a subnetwork ID.
Example:
Given an network address 204.17.5.0 (Which class?) C
The natural mask is: 255.255.255.0
Creating subnets for this network:
204.17.5.0 - 11001100.00010001.00000101.00000000
255.255.255.224 - 11111111.11111111.11111111.11100000
--------------------------|sub|----
Prof. Veena.Gadad, Dept of CSE, RVCE. 61
• By extending the mask to be 255.255.255.224,
we have taken three bits from the original host
portion of the address and used them to make
subnets.
• With these three bits, it is possible to create
eight subnets.
• With the remaining five host ID bits, each
subnet can have up to 32 host addresses.
• 30 of which can actually be assigned to a
device.

Prof. Veena.Gadad, Dept of CSE, RVCE. 62


Subnet 1:(204.17.5.0)
Host Addresses range from
204.17.5. 00000001 -------204.17.5.1
To No of Hosts =30
204.17.5.00011110--------204.17.5.30
Broadcast address for Subnet 1: 204.17.5.00011111---204.17.5.31
Subnet 2:(204.15.5.32)
Host Addresses range from
204.17.5. 00100001 -------204.17.5.33
To No of Hosts =30
204.17.5.00111110--------204.17.5.62
Broadcast address for Subnet 2: 204.17.5.00111111---204.17.5.63

Prof. Veena.Gadad, Dept of CSE, RVCE. 63


Subnet 3:(204.17.5.64)
Host Addresses range from
204.17.5. 01000001----- 204.17.5.65
To
204.17.5.01011110-------204.17.5.94
Broadcast address for Subnet 3: 204.17.5.95
Subnet 4:(204.15.5.96)
Host Addresses range from
204.17.5. 01100001 -------204.17.5.97
To
204.17.5. 01111110------204.17.5.126
Broadcast address for Subnet 2: 204.17.5.127

Prof. Veena.Gadad, Dept of CSE, RVCE. 64


Sub network address Subnet Mask (/27) Host address
204.17.5.0 255.255.255.224 host address range 1 to 30
204.17.5.32 255.255.255.224 host address range 33 to 62
204.17.5.64 255.255.255.224 host address range 65 to 94
204.17.5.96 255.255.255.224 host address range 97 to 126
204.17.5.128 255.255.255.224 host address range 129 to 158
204.17.5.160 255.255.255.224 host address range 161 to 190
204.17.5.192 255.255.255.224 host address range 193 to 222
204.17.5.224 255.255.255.224 host address range 225 to 254

Prof. Veena.Gadad, Dept of CSE, RVCE. 65


Subnetting :8 subnets for network 204.17.5.0

Prof. Veena.Gadad, Dept of CSE, RVCE. 66


• Each of the routers is attached to four
subnetworks, one subnetwork is common to both
routers.
• Also, each router has an IP address for each
subnetwork to which it is attached.
• Each subnetwork could potentially support up to
30 host addresses.
Remember:
• The more host bits we use for a subnet mask, the
more subnets we have.
• The more subnets available, the less host
addresses available per subnet.

Prof. Veena.Gadad, Dept of CSE, RVCE. 67


Example:
• If you use a mask of 255.255.255.240 (/28),
the break down is:
204.17.5.0 - 11001100.00010001.00000101.00000000
255.255.255.240 - 11111111.11111111.11111111.11110000
--------------------------|sub |---

• Four bits left for host addresses.


• In this case you can have up to 16 subnets,
each of which can have up to 16 host addresses
(14 of which can be assigned to devices).

Prof. Veena.Gadad, Dept of CSE, RVCE. 68


Class B netwok subnetting
• We have network 172.16.0.0 ,then its natural
mask is 255.255.0.0.(or 172.16.0.0/16.)
• Extending the mask to anything beyond
255.255.0.0 means it is subnetting.
• If you use a mask of 255.255.248.0 (/21), how
many subnets and hosts per subnet does this
allow for?
172.16.0.0 - 10101100.00010000. 00000000.00000000
255.255.248.0 - 11111111.11111111. 11111000.00000000
-----------------| sub |-----------

Prof. Veena.Gadad, Dept of CSE, RVCE. 69


• Using five bits from the original host bits for
subnets, allows to have 32 subnets (25).
• Remaining 11 bits for host addresses, allows
each subnet so have 2048 host addresses (211),
2046 of which could be assigned to devices.

Prof. Veena.Gadad, Dept of CSE, RVCE. 70


Exercise 1
Device A’s IP address: 172.16.17.30/20.
Device B’s IP address: 172.16.28.15/20.
Determine whether the two devices are on same
network or on different.
Determine subnet of device A
172.16.17.30 - 10101100.00010000.00010001.00011110
255.255.240.0 - 11111111.11111111.11110000.00000000
-----------------| sub|------------
subnet = 10101100.00010000. 00010000.00000000 = 172.16.16.0
DeviceA and DeviceB have addresses
Determine subnet of device B that are part of the same subnet.
172.16.17.15- 10101100.00010000. 00010001.00001111
255.255.240.0 - 11111111.11111111.11110000.00000000
-----------------| sub|------------
subnet = 10101100.00010000. 00010000.00000000 = 172.16.16.0
Prof. Veena.Gadad, Dept of CSE, RVCE. 71
Exercise 2
• Given the Class C network of 204.15.5.0/24,
subnet the network in order to create the
network with the host requirements shown.

Prof. Veena.Gadad, Dept of CSE, RVCE. 72


Solution:
Subnets Required: 5.
Largest subnet must support 28 hosts.
• Start with subnet requirement, to create 5
subnets we need 3 bits in host portion.
• This leaves with five bits for the host portion
of the address.
• How many hosts does this support? 25 = 32
(30 usable).
• This meets the requirement.

Prof. Veena.Gadad, Dept of CSE, RVCE. 73


• Once determined that it is possible to create this
network with a Class C network.
• An example of how you might assign the
subnetworks is:
• netA: 204.15.5.0/27 host address range 1 to 30
• netB: 204.15.5.32/27 host address range 33 to 62
• netC: 204.15.5.64/27 host address range 65 to 94
• netD: 204.15.5.96/27 host address range 97 to 126
• netE: 204.15.5.128/27 host address range 129 to 158

Prof. Veena.Gadad, Dept of CSE, RVCE. 74


• The previous examples of subnetting, same
subnet mask was applied for all the subnets.
• This means that each subnet has the same
number of available host addresses.
• In most cases, having the same subnet mask
for all subnets ends up wasting address space.
• For example, in the Exercise 2 a class C
network was split into eight equal-size subnets.
• Each subnet did not utilize all available host
addresses, which results in wasted address
space.
Prof. Veena.Gadad, Dept of CSE, RVCE. 75
• Variable Length Subnet Masks (VLSM) allows to
use different masks for each subnet, thereby using
address space efficiently.
Example:
Given the same network and requirements as in
Exercise 2 develop a subnetting scheme with the
use of VLSM, given:
• netA: must support 14 hosts
• netB: must support 28 hosts
• netC: must support 2 hosts
• netD: must support 7 hosts
• netE: must support 28 host

Prof. Veena.Gadad, Dept of CSE, RVCE. 76


• Determine what mask allows the required number
of hosts.
• netA: requires a /28 (255.255.255.240) mask to
support 14 hosts
• netB: requires a /27 (255.255.255.224) mask to
support 28 hosts
• netC: requires a /30 (255.255.255.252) mask to
support 2 hosts
• netD*: requires a /28 (255.255.255.240) mask to
support 7 hosts
• netE: requires a /27 (255.255.255.224) mask to
support 28 hosts

Prof. Veena.Gadad, Dept of CSE, RVCE. 77


Alternatively
• The easiest way to assign the subnets is to assign the largest
first.
• For example:
• netB: 204.15.5.0/27 host address range 1 to 30
204. 15.5. 000 00000
204.15.5. 000 00001
204.15.5. 000 11110
• netE: 204.15.5.32/27 host address range 33 to 62
204.15.5. 00 100000
204. 15. 5. 001 00001
204. 15.5. 001 11110
• netA: 204.15.5.64/28 host address range 65 to 78
• netD: 204.15.5.80/28 host address range 81 to 94
• netC: 204.15.5.96/30 host address range 97 to 98

Prof. Veena.Gadad, Dept of CSE, RVCE. 78


CIDR- Classless InterDomain Routing
• The basic idea in CIDR is to allocate IP addresses in
variable sized blocks without regard to classes.
• If a site needs, say, 2000 addresses, it is given a block of
2048 addresses on a 2048-byte boundary.
• Every router now has a table consisting of (IP address,
Subnet Mask, out going line).
• When a packet comes in, its destination IP address is first
extracted.
• Then (conceptually) the routing table is scanned entry by
entry, masking the destination address and comparing it to
the table entry looking for a match.
• It is possible that multiple entries (with different subnet
mask lengths) match, in which case the longest mask is
used.
• Thus, if there is a match for a /20 mask and a /24 mask, the
/24 entry is used.
Prof. Veena.Gadad, Dept of CSE, RVCE. 79
Example
• Addresses are available starting at 194.24.0.0.
• Suppose that Cambridge University needs 2048 addresses and is assigned
the addresses 194.24.0.0 through 194.24.7.255, along with mask
194.24. 0000 0000 0000 0001 ----- 194.24. 0.1
194.24. 0000 01 11 1111 1110 ----- 194.24. 7.254
255.255.248.0. (/21)
• Next, Oxford University asks for 4096 addresses (12 host bits)
194.24. 0001 0000 . 0000 0001----194.24.16.1
194.24. 0001 1111.1111 1110----194.24.31.254
255.255.224.0. (/20)
• Now the University of Edinburgh asks for 1024 addresses and is assigned
addresses 194.24.8.0 through 194.24.11.255 and mask 255.255.252.0.
• These assignments are summarized as follows:

Prof. Veena.Gadad, Dept of CSE, RVCE. 80


NAT- Network Address Translation
• IP addresses are scarce.
• An ISP might have a /16 (formerly class B)
address, giving it 65,534 host numbers.
• If it has more customers than that, it has a
problem.
• The problem of running out of IP addresses is not
a theoretical problem that might occur at some
point in the distant future.
• The long-term solution is for the whole Internet to
migrate to IPv6, which has 128-bit addresses.
• A quick fix for this problem is NAT.

Prof. Veena.Gadad, Dept of CSE, RVCE. 83


• The basic idea behind NAT is to assign each company a
single IP address (or at most, a small number of them) for
Internet traffic.
• Within the company, every computer gets a unique IP
address, which is used for routing intramural traffic.
• When a packet exits the company and goes to the ISP, an
address translation takes place.
• To make this scheme possible, three ranges of IP addresses
have been declared as private.
• Companies may use them internally as they wish.
• The only rule is that no packets containing these addresses
may appear on the Internet itself.
• The three reserved ranges are:
10.0.0.0 – 10.255.255.255/8 (16,777,216 hosts)
172.16.0.0 – 172.31.255.255/12 (1,048,576 hosts)
192.168.0.0 – 192.168.255.255/16 (65,536 hosts)

Prof. Veena.Gadad, Dept of CSE, RVCE. 84


Placement and operation of NAT

• Every machine has a unique address of the form


10.x.y.z .
• When a packet leaves the company premises, it
passes through a NAT box that converts the
internal IP source address, 10.0.0.1 in the figure,
to the company's true IP address, 198.60.42.12 in
this example.

Prof. Veena.Gadad, Dept of CSE, RVCE. 85


• The NAT box is often combined in a single
device with a firewall, which provides security
by carefully controlling what goes into the
company and what comes out.
• When a packet comes in, it is destined to
198.60.42.12.
• To send to actual host, a table consisting of the
port numbers and IP address is stored.
• This is because every IP packet carries TCP or
UDP payloads.
• The ports are 16-bit integers that indicate
where the TCP connection begins and ends.
Prof. Veena.Gadad, Dept of CSE, RVCE. 86
Prof. Veena.Gadad, Dept of CSE, RVCE. 87
• Each outgoing TCP message contains both a
source port and a destination port.
• Together, these ports serve to identify the
processes using the connection on both ends.
• Whenever an outgoing packet enters the NAT
box, the 10.x.y.z source address is replaced by the
company's true IP address.
• In addition, the TCP Source port field is replaced
by an index into the NAT box's 65,536-entry
translation table.
• This table entry contains the original IP address
and the original source port.
• Finally, both the IP and TCP header checksums
are recomputed and inserted into the packet.
Prof. Veena.Gadad, Dept of CSE, RVCE. 88
• When a packet arrives at the NAT box from
the ISP, the Source port in the TCP header is
extracted and used as an index into the NAT
box's mapping table.
• From the entry located, the internal IP address
and original TCP Source port are extracted and
inserted into the packet.
• Then both the IP and TCP checksums are
recomputed and inserted into the packet.
• The packet is then passed to the company
router for normal delivery using the 10.x.y.z
address.
Prof. Veena.Gadad, Dept of CSE, RVCE. 89
Some violations of NAT architectural model and
disadvantages:
• Every machine should have unique address, but
with NAT, thousands of machines may (and do)
use address 10.0.0.1.
• NAT changes the Internet from a connectionless
network to a kind of connection-oriented network.
– The problem is that the NAT box must maintain
information (the mapping) for each connection passing
through it.
– Having the network maintain connection state is a
property of connection-oriented networks, not
connectionless ones.
– If the NAT box crashes and its mapping table is lost,
all its TCP connections are destroyed.

Prof. Veena.Gadad, Dept of CSE, RVCE. 90


• NAT violates the most fundamental rule of protocol
layering: layer k may not make any assumptions about
what layer k + 1 has put into the payload field.
– This basic principle is there to keep the layers independent.
– If TCP is later upgraded to TCP-2, with a different header
layout (e.g., 32-bit ports), NAT will fail.
– The whole idea of layered protocols is to ensure that
changes in one layer do not require changes in other layers.
NAT destroys this independence.
• All processes on the Internet are not required to use
TCP or UDP.
– If a user on machine A decides to use some new transport
protocol to talk to a user on machine B (for example, for a
multimedia application), introduction of a NAT box will
cause the application to fail

Prof. Veena.Gadad, Dept of CSE, RVCE. 91


• Some applications insert IP addresses in the
body of the text. The receiver then extracts
these addresses and uses them.
– Since NAT knows nothing about these addresses, it
cannot replace them, so any attempt to use them on
the remote side will fail.
• Since the TCP Source port field is 16 bits, at
most 65,536 machines can be mapped onto an
IP address.
– Actually, the number is slightly less because the
first 4096 ports are reserved for special uses

Prof. Veena.Gadad, Dept of CSE, RVCE. 92


Other Protocols at Network Layer
1. ICMP: Internet Control Message Protocol.
2. ARP: Address Resolution Protocol.
3. RARP: Reverse Address Resolution Protocol.
4. BOOTP: Bootstrap Protocol.
5. DHCP: Dynamic Host Configuration
Protocol.

ICMP BOOTP

INTERNET PROTOCOL
ARP
DHCP
RARP NETWORK LAYER
Prof. Veena.Gadad, Dept of CSE, RVCE. 93
Internet Control Message Protocol
• The operation of the Internet is monitored closely by
the routers.
• When something unexpected occurs, the event is
reported by the ICMP (Internet Control Message
Protocol), which is also used to test the Internet.
The principal ICMP message types.

Prof. Veena.Gadad, Dept of CSE, RVCE. 94


ARP- Address Resolution Protocol
• Every machine on the Internet has one (or more) IP addresses,
these cannot actually be used for sending packets because the
data link layer hardware does not understand Internet
addresses.
• To map IP addresses onto data link layer addresses a protocol
is used.

• A user on host 1 wants to send a packet to a user on host 2.


Prof. Veena.Gadad, Dept of CSE, RVCE. 97
Step1: Find IP address for host 2, which is done by
DNS.
Step 2: The upper layer software on host 1 now
builds a packet with 192.31.65.5 in the
Destination address field and gives it to the IP
software to transmit.
Step3: The IP software can look at the address and
see that the destination is on its own network, but
needs Ethernet address.
Step 4: Host1 broadcasts a packetonto the Ethernet
asking: Who owns IP address 192.31.65.5? Host 2
alone will respond with its Ethernet address (E2).
Step5: host 1 learns that IP address 192.31.65.5 is
on the host with Ethernet address E2, builds frame
and transmits.
Prof. Veena.Gadad, Dept of CSE, RVCE. 98
DHCP
• BOOTP was extended and given a new name: DHCP
(Dynamic Host Configuration Protocol).
• DHCP allows both manual IP address assignment and
automatic assignment.
• Like RARP and BOOTP, DHCP is based on the idea
of a special server that assigns IP addresses to hosts
asking for one.
• This server need not be on the same LAN as the
requesting host.
• Since the DHCP server may not be reachable by
broadcasting, a DHCP relay agent is needed on
each LAN.
Prof. Veena.Gadad, Dept of CSE, RVCE. 99
• To find its IP address, a newly-booted machine
broadcasts a DHCP DISCOVER packet.
• The DHCP relay agent on its LAN intercepts all
DHCP broadcasts.
• When it finds a DHCP DISCOVER packet, it
sends the packet as a unicast packet to the DHCP
server, possibly on a distant network.
• The only piece of information the relay agent
needs is the IP address of the DHCP server.

Prof. Veena.Gadad, Dept of CSE, RVCE. 100


• An issue that arises with automatic assignment of IP
addresses from a pool is how long an IP address should
be allocated.
• If a host leaves the network and does not return its IP
address to the DHCP server, that address will be
permanently lost.
• After a period of time, many addresses may be lost.
• To prevent that from happening, IP address assignment
may be for a fixed period of time, a technique called
leasing.
• Just before the lease expires, the host must ask the
DHCP for a renewal.
• If it fails to make a request or the request is denied, the
host may no longer use the IP address it was given
earlier.

Prof. Veena.Gadad, Dept of CSE, RVCE. 101


Supernetting and route aggregation
• Big networks are difficult to handle.
– Security.
– Maintainance.
• Subnetting is dividing a network into small
pieces of networks.
• Supernetting is combining small networks into
one network.
• To reduce the size of routing tables in a router
route aggregation is used.
Rules for aggregation:
1. The address must be contiguous.
2. The subnets must be of same size and power of 2.
3. 1st IP address must be divisible by size of supernet.
Size of supernet=Number of subnets* Size of
Subnets
= 4*2^8= 2^10.
Calculation of supernet mask
• It is also 32 bit number similar to subnet mask.
• Number of 1’s represent fixed part.
• Number of 0’s represent variable part.
For example: 4subnets:

200.1.00000000.00000000
200.1.00000001.00000000
200.1.00000010.00000000 Supernet mask:
255.255.252.0 or/22
200.1.00000011.00000000

FIXED PART VARIABLE PART


• ISP has a block of 8192 IP addresses. starting
at 194.24.0.0.
• Suppose that Cambridge University needs
2048 addresses.
• Oxford University asks for 4096 addresses.
• University of Edinburgh asks for 1024
addresses.
Aggregation of IP prefixes.
DHCP(Dynamic Host configuration Protocol)
• Two ways to assign IP addresses to hosts:
– Manually- Static IP address.
– Using DHCP
• Every network has a DHCP server.
• A host that boots up has MAC address but not
IP address.
• The host broadcasts a request for an IP address
on its network- using a DHCP DISCOVER
packet.
• If that server is not directly attached to the
network, the router will be configured to
receive DHCP broadcasts and relay them to the
DHCP server.
• When the server receives the request, it
allocates a free IP address and sends it to the
host in a DHCP OFFER packet.
• A technique used by DHCP server to prevent
the IP addresses from getting lost is leasing.
• DHCP has largely replaced earlier protocols
(called RARP and BOOTP) with more limited
functionality.
IPV6(IPng)
• IPv6 is designed to be the successor to IPv4.
• IPv6 has a larger 128-bit address space, providing for 340
undecillion addresses. (That is the number 340, followed by
36 zeroes.)
Need for IPv6
• The depletion of IPv4 address space has been the
motivating factor for moving to IPv6.
• Private addresses in combination with Network Address
Translation (NAT) have been instrumental in slowing the
depletion of IPv4 address space.
• NAT breaks many applications and has limitations that
severely impede peer-to-peer communications.
• With an increasing Internet population, a limited IPv4
address space, issues with NAT and an Internet of
Everything, the time has come to begin the transition to
IPv6.
Prof. Veena.Gadad, Dept of CSE, RVCE. 109
IPV4 and IPV6 Coexistance
• For the foreseeable future, both IPv4 and IPv6
will coexist.
• The transition is expected to take years.
• The IETF has created various protocols and
tools to help network administrators migrate
their networks to IPv6.
• The migration techniques can be divided into
three categories:
– Dual Stack
– Tunnelling
– Translation
Prof. Veena.Gadad, Dept of CSE, RVCE. 110
• Dual stack allows IPv4 and IPv6 to coexist on
the same network segment.
• Dual stack devices run both IPv4 and IPv6
protocol stacks simultaneously.
Prof. Veena.Gadad, Dept of CSE, RVCE. 111
• A method of transporting an IPv6 packet over
an IPv4 network.
• The IPv6 packet is encapsulated inside an IPv4
packet, similar to other types of data.

Prof. Veena.Gadad, Dept of CSE, RVCE. 112


• Network Address Translation 64 (NAT64)
allows IPv6-enabled devices to communicate
with IPv4-enabled devices using a translation
technique similar to NAT for IPv4.
• An IPv6 packet is translated to an IPv4 packet
and vice versa.
Prof. Veena.Gadad, Dept of CSE, RVCE. 113
IPv6 Address Representation
• IPv6 addresses are 128 bits in length and
written as a string of hexadecimal values.
• Every 4 bits is represented by a single
hexadecimal digit; for a total of 32
hexadecimal values.
• IPv6 addresses are not case-sensitive and can
be written in either lowercase or uppercase.
Preferred Format
• The preferred format for writing an IPv6
address is x:x:x:x:x:x:x:x, with each “x”
consisting of four hexadecimal values.
Prof. Veena.Gadad, Dept of CSE, RVCE. 114
Prof. Veena.Gadad, Dept of CSE, RVCE. 115
• In IPv6, a hextet is the unofficial term used to
refer to a segment of 16 bits or four
hexadecimal values.
• Each “x” is a single hextet, 16 bits or four
hexadecimal digits.

Prof. Veena.Gadad, Dept of CSE, RVCE. 116


Reducing the size of representation
Rule 1 – Omit Leading 0s
• The first rule to help reduce the notation of
IPv6 addresses is to omit any leading 0s
(zeros) in any 16-bit section or hextet.
For example:
• 01AB can be represented as 1AB
• 09F0 can be represented as 9F0
• 0A00 can be represented as A00
• 00AB can be represented as AB
Prof. Veena.Gadad, Dept of CSE, RVCE. 117
Rule 2: Omit All 0 Segments
• A double colon (::) can replace any single,
contiguous string of one or more 16-bit
segments (hextets) consisting of all 0s.
• The double colon (::) can only be used once
within an address, otherwise there would be
more than one possible resulting address.
• When used with the omitting leading 0s
technique, the notation of IPv6 address can
often be greatly reduced.
• This is commonly known as the compressed
format.
Prof. Veena.Gadad, Dept of CSE, RVCE. 118
Prof. Veena.Gadad, Dept of CSE, RVCE. 119
Main Features of IPV6
• IPv6 has longer addresses than IPv4.
– They are 16 bytes long, which solves the problem that
IPv6 set out to solve: provide an effectively unlimited
supply of Internet addresses.
• Simplification of the header.
– It contains only seven fields (versus 13 in IPv4).
– This change allows routers to process packets faster and
thus improve throughput and delay.
• Better support for options.
– This change was essential with the new header because
fields that previously were required are now optional.
• Security.
– Authentication and privacy are key features of the new IP.
• More attention has been paid to quality of service.

Prof. Veena.Gadad, Dept of CSE, RVCE. 122


IPV6 Header
• Version: it is 6 here.
• Diff. Services:
To distinguish
between packets
with different
real-time delivery requirements.
• Flow label: to allow a source and destination to
set up a pseudoconnection with particular
properties and requirements.
Prof. Veena.Gadad, Dept of CSE, RVCE. 123
• For example:, a stream of packets from one process on
a certain source host to a certain process on a certain
destination host might have stringent delay
requirements and thus need reserved bandwidth.
• The flow can be set up in advance and given an
identifier.
• When a packet with a nonzero Flow label shows up, all
the routers can look it up in internal tables to see what
kind of special treatment it requires.
• In effect, flows are an attempt to have it both ways: the
flexibility of a datagram subnet and the guarantees of a
virtual-circuit subnet.
• Each flow is designated by the source address,
destination address, and flow number, so many flows
may be active at the same time between a given pair of
IP addresses

Prof. Veena.Gadad, Dept of CSE, RVCE. 124


• Payload length field tells how many bytes
follow the 40-byte header.
• Next header: This field is used to tell which
one of the extension header follow this one.
• Hop limit: Same as time to live in IPV4, which
is decremented at each hop.
• Source and Destination address: 16byte source
and destination addresses.

Prof. Veena.Gadad, Dept of CSE, RVCE. 125


Comparison between IPv4 and IPv6
1. IHL field is no more in IPV6 because IPv6 has a
fixed length.
2. The Protocol field is taken out because the Next
header field tells what follows the last IP header.
3. All the fields relating to fragmentation are
removed because IPv6 takes a different approach
to fragmentation.
1. all IPv6-conformant hosts are expected to
dynamically determine the datagram size to use.
2. When a host sends an IPv6 packet that is too large,
instead of fragmenting it, the router that is unable to
forward it sends back an error message.

Prof. Veena.Gadad, Dept of CSE, RVCE. 126


• Checksum field is not there in IPV6 as there is checksum field
in transport layer header and data link header.
Extension Headers
• Some of the missing IPv4 fields are occasionally still needed,
so IPv6 has introduced the concept of an (optional) extension
header.
• These headers can be supplied to provide extra information,
but encoded in an efficient way.
• Six kinds of extension headers are defined at present.

Prof. Veena.Gadad, Dept of CSE, RVCE. 127


• Some of the headers have a fixed format; others
contain a variable number of variable-length
fields.
• Each item is encoded as a (Type, Length, Value)
tuple.
• The Type is a 1-byte field telling which option
this is. The Type values have been chosen so that
the first 2 bits tell routers that do not know how to
process the option what to do.
• The Length is also a 1-byte field. It tells how long
the value is (0 to 255 bytes).
• The Value is any information required, up to 255
bytes.
Prof. Veena.Gadad, Dept of CSE, RVCE. 128
• The hop-by-hop header is used for information
that all routers along the path must examine.
– support of datagrams exceeding 64K.
– The large data grams are called jumbograms.
– The use of jumbograms is important for
supercomputer applications that must transfer
gigabytes of data efficiently across the Internet.

Prof. Veena.Gadad, Dept of CSE, RVCE. 129


• The destination options header is intended for
fields that need only be interpreted at the
destination host.
• The routing header lists one or more routers
that must be visited on the way to the
destination.
• The fragment header deals with fragmentation
similarly to the way IPv4 does.
– The header holds the datagram identifier, fragment
number, and a bit telling whether more fragments
will follow

Prof. Veena.Gadad, Dept of CSE, RVCE. 130


• The authentication header provides a
mechanism by which the receiver of a packet
can be sure of who sent it.
• The encrypted security payload makes it
possible to encrypt the contents of a packet so
that only the intended recipient can read it.
• These headers use cryptographic techniques to
accomplish their missions.

Prof. Veena.Gadad, Dept of CSE, RVCE. 131

Você também pode gostar