tcp ip english
TRANSCRIPT
-
7/29/2019 Tcp Ip English
1/45
Training for TIM Celular - Rio de Janeiro
Rio de Janeiro, Aug. 2005
Italo TOBIA
Internet Protocol
-
7/29/2019 Tcp Ip English
2/45
2
Internet Protocol
Italo TOBIA
Internet architecture and
services
Rio de Janeiro,
Aug. 2005
CONTENTS
TCP/IP architecture
IP protocol
IP addressing Direct/indirect forwarding
Address resolution protocol (ARP)
Sub-netting
The goal of this short presentation is to provide the basic concepts related to IP and
TCP architecture, with focus on IP addressing techniques.
-
7/29/2019 Tcp Ip English
3/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
They often usea transport layerservice
EthernetFDDIToken RingFrame RelayATM
TCP/IP is an open architecture configurable on most physical networktechnologies. It specifies high layer functions and protocols, regardless the
interfacing network mode.
So, if you have a host implementing TCP/IP software functions, you canchange the network adapter (from an Ethernet card to a serial modem card)without any modification of that software: you must only change the networkadapter driver.
DNS uses both TCP and UDP services: name resolution queries are UDPbased; zone transfers are TCP based.
ND protocol has been defined for the IPv6 stack and gives ARP and RARP
some more functionalities.
-
7/29/2019 Tcp Ip English
4/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
data
app
tcp
ipip
HeaderData Link
data
dataapp
dataapptcp
TrailerData Link
TCP segmentTCP segment
IP datagramIP datagram
Data Link FrameData Link Frame
dataappipip tcp
Each protocol creates a protocol data unit (PDU) for transmission that includesheaders required by that protocol and data to be transmitted. This data
becomes the service data unit (SDU) of the next layer below it. This diagramshows an application layer PDU consisting of an application header andapplication data. When this is passed to transport layer, it becomes a transportlayer SDU, an so on until layer 2 PDUin this case shown with both a headerand a footerthat is converted to bits and sent at layer 1
-
7/29/2019 Tcp Ip English
5/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
IP is the workhorse protocol of the TCP/IP protocol suite (W. R.
Stevens)
IP provides a datagram service which is connectionless and unreliable
unreliable means that no one can grant the correct packet delivery
to the designed destination (best effort service )
connectionless means that IP does not store any information withreference to forwarded packets. Each packet is handled (that is:
routed) in an independent way from others. So, IP datagrams can be
delivered to destination according to a wrong sequence that the
original
The Main Function of IP: Internetwork Datagram Delivery beyond the localbroadcast domain
The fundamental job of the Internet Protocol is the delivery of datagrams from onedevice to another over an internetwork. It is connection-less; the sender does notcontact the receiver before sending data, but it sends immediately the datagram.Some other protocol layer will take care of receiver synchronization, lost packets
recovery, etc..IP datagram are handled (routed, forwarded and not acknowledged) by theintermediate systems (routers) according to a memory-less scheme.
ADDRESSING, ROUTING, FRAGMENTATION and REASSEMBLY are IP relatedfunctions.
-
7/29/2019 Tcp Ip English
6/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
IP datagrams length is variable:
header: 20 64 bytedata + header
-
7/29/2019 Tcp Ip English
7/45
7
Internet Protocol
Italo TOBIA
Internet architecture and
services
Rio de Janeiro,
Aug. 2005
IP Header details
Time To Live (TTL): Specifies how long the datagram is allowed to live on the network, in terms of router hops.Each router decrements the value of the TTL field (reduces it by one) prior to transmitting it. If the TTL field drops tozero, the datagram is assumed to have taken too long a route and is discarded.
1TTL
Fragment Offset: When fragmentation of a message occurs, this field specifies the offset, or position, in the overall
message where the data in this fragment goes. It is specified in units of 8 bytes (64 bits). The first fragment has anoffset of 0.
1 5/8(13 bits)FragmentOffset
see table in next pages3/8
(3 bits)Flags
Identification: This field contains a 16-bit value that is common to each of the fragments belonging to a particularmessage; for datagrams originally sent unfragmented it is still filled in, so it can be used if the datagram must befragmented by a router during delivery. This field is used by the recipient to reassemble messages withoutaccidentally mixing fragments from different messages. This is needed because fragments may arrive from multiplemessages mixed together, since IP datagrams can be received out of order from any device
2Identification
Total Length (TL): Specifies the total length of the IP datagram, in bytes. Since this field is 16 bits wide, themaximum length of an IP datagram is 65,535 bytes, though most are much smaller.
2TL
Type Of Service (TOS): A field designed to carry information to provide quality of service features, such asprioritized delivery, for IP datagrams. It was never widely used as originally defined, and its meaning has beensubsequently redefined for use by a technique called Differentiated Services (DS). See below for more information.
1TOS
Internet Header Length (IHL): Specifies the length of the IP header, in 32-bit words. This includes the length of
any options fields and padding. The normal value of this field when no options are used is 5 (5 32-bit words = 5*4 =20 bytes). Contrast to the longer Total Length field below.
1/2(4 bits)IHL
Version: Identifies the version of IP used to generate the datagram. For IPv4, this is of course the number 4. Thepurpose of this field is to ensure compatibility between devices that may be running different versions of IP. Ingeneral, a device running an older version of IP will reject datagrams created by newer implementations, under theassumption that the older version may not be able to interpret the newer datagram correctly.
1/2(4 bits)
Version
DescriptionSize
(bytes)Field Name
-
7/29/2019 Tcp Ip English
8/45
8
Internet Protocol
Italo TOBIA
Internet architecture and
services
Rio de Janeiro,
Aug. 2005
IP Header details
Data: The data to be transmitted in the datagram, either an entire higher-layer message ora fragment of one.
VariableData
Padding: If one or more options are included, and the number of bits used for them is not amultiple of 32, enough zero bits are added to pad out the header to a multiple of 32 bits (4bytes).
VariablePadding
Options: One or more of several types of options may be included after the standardheaders in certain IP datagrams (supplementary services).
VariableOptions
Destination Address: The 32-bit IP address of the intended recipient of the datagram.Again, even though devices such as routers may be the intermediate targets of thedatagram, this field is always for the ultimate destination.
4DestinationAddress
Source Address: The 32-bit IP address of the originator of the datagram. Note that eventhough intermediate devices such as routers may handle the datagram, they do not normallyput their address into this fieldit is always the device that originally sent the datagram.
4Source
Address
Header Checksum: A checksum computed over the header to provide basic protectionagainst corruption in transmission. This is not the more complex CRC code typically used by
data link layer technologies such as Ethernet; it is just a 16-bit checksum. It is calculated bydividing the header bytes into words (a word is two bytes) and then adding them together.The data is not checksummed, only the header. At each hop the device receiving thedatagram does the same checksum calculation and on a mismatch, discards the datagram asdamaged.
2Header
Checksum
1Protocol
DescriptionSize
(bytes)Field Name
-
7/29/2019 Tcp Ip English
9/45
9
Internet Protocol
Italo TOBIA
Internet architecture and
services
Rio de Janeiro,
Aug. 2005
IP header details: flags and protocol type
-
7/29/2019 Tcp Ip English
10/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
A BMTU=1500 MTU=512 MTU=256
ID=12345
MF=0
OS=0
TL=1500
ID=12345
MF=1
OS=0
TL=512
ID=12345
MF=1
OS=64
TL=512
OS=128
TL=476
ID=12345
MF=0
ID=12345
MF=1
ID=12345
MF=1
ID=12345
MF=1
ID=12345
MF=1
ID=12345
MF=1
ID=12345
MF=0
OS=0
TL=256
OS=32
TL=256
OS=64
TL=256
OS=96
TL=256
OS=128
TL=256
OS=160
TL=220
Router Router
In order to send messages using IP we encapsulate the higher-layer data into IP datagrams. Thesedatagrams must then be sent down to the data link layer, where they are further encapsulated into theframes of whatever technology is going to be used to physically convey them, either directly to theirdestination, or indirectly to the next intermediate step in their journey to their intended recipient. Thedata link layer implementation puts the entire IP datagram into the data portion (the payload) of its frame
format, just as IP puts transport layer messages, transport headers and all, into its IP Data field. Thisimmediately presents us with a potential issue: matching the size of the IP datagram to the size ofthe underlying data link layer frame size.
The underlying network that a device uses to connect to other devices could be LAN connection likeEthernet or Token Ring, a wireless LAN link such as 802.11, or a dialup, DSL, E-1 or other WANconnection. Each physical network will generally use its own frame format, and each format has a limit onhow much data can be sent in a single frame (due to BER/packet error ratio). If the IP datagram is toolarge for the data link layer frame format's payload section, we MUST FRAGMENT before transmitting it.
More Fragments
This flag is set to a 1 for all fragments except the last one, which has it set to 0. When the fragment witha value of 0 in the More Fragments flag is seen, the destination knows it has received the last fragment of
the message.Fragment Offset
This field solves the problem of sequencing fragments by indicating to the recipient device where in theoverall message each particular fragment should be placed. The field is 13 bits wide, so the offset can befrom 0 to 8191. Fragments are specified in units of 8 bytes, which is why fragment length must be amultiple of 8. Uncoincidentally, 8191 * 8 is 65,528, just about the maximum size allowed for an IPdatagram.
Let's take the same example from above. The first fragment would have a Fragment Offset of 0. Thesecond would have an offset of 64 (512 divided by 8). The third would have an offset of 128 (1024divided by 8).
As an exercise, You can calculate by yourself other offsets due to the second fragmentation process.
-
7/29/2019 Tcp Ip English
11/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
051
085
0110330
De NH
0330 075
011 DC
De NH
0330 02
085 DC
De NH
0330 DC
011 DC02
075
06
0330/2134760330/174523
06/43539044Calling line
Called line
06 / 43539044
Host fieldnetwork fieldDC = directly connected
Layer 2 addresses are flatly organized so the cannot be routed over WAN
environments.
Network layer addresses must be organized according to hierarchical
schemes, so as the routing process can simply operate.
A hyerarchical scheme means that, each address contains a network field
(prefix) and a host field (end system address).
In telephone networks we have a country code, an area code, a subscriber
number.
In this mode we can route data from an area to another only by inspecting the
prefix, regardless the host field.
-
7/29/2019 Tcp Ip English
12/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Network Host
32 bit
8 bit 8 bit 8 bit 8 bit
198 . 18 . 140 . 208
Humans don't work too well with binary numbers, because they are long an
complicated, and the use of only two digits makes them hard to differentiate
(Quick, which of these is larger: 11100011010100101001100110110001 o
11100011010100101001101110110001 ?) For this reason, when we use IPaddresses we don't work with them in binary except when absolutely necessary.
The first thing that humans would naturally do with a long string of bits is to split
into four eight-bit octets, to make it more manageable. So
11100011010100101001101110110001 would become 11100011 - 01010010
10011101 - 10110001. Then, we could convert each of those octets into a mor
manageable two-digit hexadecimal number, to yield the following: E3 - 52 - 9D
B1. This is in fact the notation used for IEEE MAC address, except that they are
48 bits long so they have six two-digit hex numbers, and they are usuallyseparated by colons, not dashes as used here.
Each version 4 IP address is 32 bits long. When we refer to the IP address we
use a dotted-decimal notation, while the computer converts this into binary
However, even though these sets of 32 bits are considered a single entity, they
have an internal structure containing two components:
Network Identifier (Network ID):A certain number of bits, starting from the left
most bit, is used to identify the network where the host or other network interface
is located. This is also sometimes called the network prefixor even just theprefixHost Identifier (Host ID): The remainder of the bits are used to identify the hos
on the network.
-
7/29/2019 Tcp Ip English
13/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Class D (224.0.0.0 - 239.255.255.255)
Class E (240.0.0.0 - 255.255.255.254)
1 multicast group ID1 01
1 reserved1 11 0
28 bit
27 bit
Class C (192.0.0.0 - 223.255.255.255)
1 netid hostid1 0
21 bit 8 bit
0 netid hostid
7 bit 24 bit
Class A (0.0.0.0 - 127.255.255.255
Class B (128.0.0.0 - 191.255.255.255)
1 0 hostidnetid
14 bit 16 bit
Looking at this figure, you can see that the first three, classes A, B and C, comprise most of the totaaddress space (7/8ths of it). These are the classes used for unicast IP addressing, which means fomessages sent to a single destination host. (The blocks also include associated broadcast addresses fothese networks). They allow the Internet to provide addressing for a small number of very large networksa moderate number of medium-sized organizations, and a large number of smaller companies. Thiapproximately reflects the distribution of organization sizes, approximately, in the real world, though thlarge gulf in the maximum number of hosts allowed for each address class leads to inflexibility andproblems.
As you can see, the classes differ in the place where the dividing line is drawn between the network Iand the host ID portions of the addresses they contain. However, in each case the division is made on octeboundaries: in classful addressing, the division does not occur within an octet.
Class A
Class B
Class C
Class D
Class E
-
7/29/2019 Tcp Ip English
14/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Example:
15.10.10.90
Net ID Host ID
N H H H
8 bit 8 bit 8 bit 8 bit
In this class the first bit is set to 0. The net id field is 8 bit long, then you canhave 27 class A networks, each with a maximum number of hosts given by
16777216 (224). Class A addresses can be recognized by the first byte value:its decimal is GE 0 and LE 127.
-
7/29/2019 Tcp Ip English
15/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Example:
130.20.18.62
Net ID Host ID
N N H H
8 bit 8 bit 8 bit 8 bit
If the first bit is 1, we must consider the second bit in the address filed. ClassB has the second bit set to 0; in this case the net id field is 16 bits long and
the host id field is 16 bit long. The maximum number of class B networks is16384 (214), each with at most 65536 (216) host. Class B network addresses,according to de dotted decimal format, range from 120.0 up to 191.255.
-
7/29/2019 Tcp Ip English
16/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Example:
195.31.235.10
Net ID Host ID
N N N H
8 bit 8 bit 8 bit 8 bit
If the first and the second bit of the address field are 1, we consider the thirdbit. If this last is 0, we have a class C address. So, the net id field is 3 bytes
long and the host id field is only one byte.
We can have up to 2097152 (221) class C networks, each with 256 (28) hosts.Class C network addresses range from 192.0.0 up to 223.255.255.
-
7/29/2019 Tcp Ip English
17/45
-
7/29/2019 Tcp Ip English
18/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
All 0s This host1
All 0s Host on this net1
All 1s Limited broadcast (local net) 2
Directed broadcast for net 2
Loopback3
Host
Net All 1s
127 Anything (often 1)
1Allowed only as source address, during host bootstrap2 Can be used only as destination address3 Must not be propagated in networks (only for local use purposes)
-
7/29/2019 Tcp Ip English
19/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
200.168.1.0 200.168.2.0
200.168.3.0
200.168.4.0
255.255.255.255 (local broadcast)
X
200.168.4.255 (directed broadcast)
Routers can forward directed broadcast packets. Local broadcast packets
must travel only inside the interested LAN
-
7/29/2019 Tcp Ip English
20/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
For a windows XP machine the TCP/IP parameters configuration is similar to
this figure.
-
7/29/2019 Tcp Ip English
21/45
21
Internet Protocol
Italo TOBIA
Internet architecture and
services
Rio de Janeiro,
Aug. 2005
10/100 Ethernet NIC configuration
This is an example for the network interface card for a windows 2000 machine.
Only by roll over on the card name and type, the system visualizes the physicaladdress of the card (MAC address).
In the second window, the user can configure several parameters of the network card,
according to the specific card and using the card driver.
-
7/29/2019 Tcp Ip English
22/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
IP forwarding
Direct forwardingDirect forwarding
It takes place when two communicating hosts belong to the samelogical IP network; the communication does not involve routers
The sending host encapsulates its packet into the LAN frame andsends it using MAC host destination address.
Indirect forwardingIndirect forwarding
The sending station addresses the remote host at layer 3 andaddresses the default gateway at layer 2; packets cross one or morerouters
The transmitting host encapsulates its datagram in a frame using thedefault gateway MAC address
Datagrams crosses routers along the path, until they reach thedestination host
All machines located inside the same physical network (that is, in the samelogical IP network) can communicate each other by means of layer 2 services.
Direct forwarding is related to communications inside a logical IP network.Each machine needing to communicate with a host in the same LAN, must
map the destination IP address with its MAC address. This association can becarried on by means of:
- An ARP server (over non broadcast networks)
- A distributed algorithm and a protocol running on all hosts belongingto the same physical network (over broadcast networks)
In case of indirect forwarding, the sending host verifies that the destination IPaddress to contact is outside his network, so the default gateway must bedirectly addresses (using its MAC address) and sending the packet to it.
-
7/29/2019 Tcp Ip English
23/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Network 192.168.10.0/24.10 .35
MAC-D 000060AD8744
MAC-S 00082C785852
IP-D 192.168.10.35
IP-S 192.168.10.10
MAC-D 000060AD8744
MAC-S 00082C785852
IP-D 192.168.10.35
IP-S 192.168.10.10
MAC 00082C785852MAC 000060AD8744
Host A Host B
The steps are:
1. Host A verifies that host B does belong to the same network2. Host A sends an Address Resolution Protocol packet to a layer 2 broadcast
address, indicating the IP address to translate
3. All hosts in the same LAN receive that packet, but only host B repliesproviding the requested information
4. Host A encapsulates the IP packet into a MAC frame using its MAC and theresolved MAC addresses.
-
7/29/2019 Tcp Ip English
24/45
-
7/29/2019 Tcp Ip English
25/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
ga eway
If the host has not configured the default gateway address, packets from the
host can be forwarded only on the attached LAN, using MAC address and
ARP process. Communication is possible between the station and all otherLAN users.
-
7/29/2019 Tcp Ip English
26/45
Layer 2 addresses can be considered for communicating only in a localenvironment; these addresses cannot be organized neither managed. Layer 3
addresses must be used for communicating outside a local networkenvironment (outside a broadcast domain); in other words, when we mustsend data over a WAN infrastructure we need higher layer addresses thanlayer 2.
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Inside a logical IP network (or sub-network), routing service
is provided by the layer 2 infrastructure (using MAC
addresses in a LAN, for example)
We need a mapping between layer 2 and layer 3 addresses;
this mapping can take place by means of a standardprotocol: ARP (Address Resolution Protocol)
Layer 2 addresses can be:
MAC addresses for a LAN
Logical channel numbers in point to point networks, such
as frame relay, atm, x.25
-
7/29/2019 Tcp Ip English
27/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Direct forwarding needs the destination station MAC and IP
addresses
Statical mapping
Mapping table must be set initially, during the node
configuration step (e.g. X.25, ISDN, etc.)
Dynamical mapping The mapping table is dynamically set with data exchanged
by means of the address resolution protocol RFC826
broadcast (in LAN environment)
ARP-Server (in Non Broadcast networks)
In general, direct mapping is not possible when the layer three address is smallerthan the layer two address. Consider that Ethernet is the most popular technology
at layer two and uses a 48-bit address, and IP is the most popular technology atlayer three and uses a 32-bit address. This is one reason why direct mapping is atechnique that is seldom used, and that most people do not know about!
The bigger reason why static resolution is not at all uses, is why direct mapping isinflexible. Dynamic resolution is a more generalized solution, because it allowsdata link layer and network layer addresses to be independent, and itsdisadvantages can be mostly neutralized through careful implementation.
-
7/29/2019 Tcp Ip English
28/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
ARP Request ARP Reply
A B
EDC
A B
EDC
MAC broadcast MAC A IP AMAC A IP E??
MAC A MAC E IP EMAC E IP AMAC A
MAC frame addresses ARP packet: most significant fields
ARP Req
ARP Reply
ARP request: layer 2 broadcast ARP reply: layer 2 unicast
In order to reduce the overhead due to packets traveling the local network,dynamic address resolution is simple and functional, but it's usually not
enough. We must add some intelligence to the implementation of addressresolution to reduce the impact on performance of continual addressresolutions.
Designers always include a caching mechanism in the ARP software. After adevice's network layer address is resolved to a data link layer address, the linkbetween the two is kept in the memory of the system hosting the device, fora period of time. When it needs the layer two address the next time, thedevice just does a quick lookup in its cache. This means instead of doing a
broadcast on every datagram or session, we only do it once for a wholesequence of datagrams.
Cross resolution technique is also used by software designers:
1. A asks for B address resolution
2. B replies
3. A puts B MAC address in the local ARP table
4. B puts A MAC address in the local ARP table
-
7/29/2019 Tcp Ip English
29/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
C:\>arp -a
Interface: 195.31.237.213 on Interface 1
Internet Address Physical Address Type
195.31.237.136 08-00-20-95-1f-d3 dynamic
195.31.237.138 08-00-20-20-3d-28 dynamic
195.31.237.140 08-00-20-90-3e-b9 dynamic
195.31.237.193 00-e0-1e-84-cc-a0 dynamic
C:\>arp -a
Interface: 195.31.237.213 on Interface 1
Internet Address Physical Address Type
195.31.237.136 08-00-20-95-1f-d3 dynamic
195.31.237.138 08-00-20-20-3d-28 dynamic
195.31.237.140 08-00-20-90-3e-b9 dynamic
195.31.237.193 00-e0-1e-84-cc-a0 dynamic
Mapping information:
are stored in a cache memory (ARP Cache)
When a network driver on the host machine requests a packet transmission, somecontrol actions take place:
destination address existence
If YES, the MAC frame can be completed and transmitted
If NOT, an ARP frame must be constructed and transmitted
On windows machines, a command must be issued to view the arp table:
arp -a
ARP does not use IP services, but it only layes on LAN protocol stack.
-
7/29/2019 Tcp Ip English
30/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
IP addresses and routing tables dimension fast growth,
imposed some prevenction actions (IETF)
This solutions are:
Best IP addresses allocation degli indirizzi IP
Classless InterDomain Routing(CIDR)
Private addressed and Network Address Translation (NAT) IP version 6 (IPv6)
Advantages of Subnet Addressing
In essence, subnet addressing allows each organization to have its own internet within the
Internet. Just as the real Internet looks only at networks and hosts, a two-level hierarchy, eachorganization can now also have subnets and hosts within their network. This change provides
numerous advantages over the old system:
Better Match to Physical Network Structure: Hosts can be grouped into subnets that reflect
the way they are actually structured in the organization's physical network.
Flexibility: The number of subnets and number of hosts per subnet can be customized for
each organization. Each can decide on its own subnet structure and change it as required.
Invisibility To Public Internet: Subnetting was implemented so that the internal division of a
network into subnets is visible only within the organization; to the rest of the Internet the
organization is still just one big, flat, network. This also means that any changes made to the
internal structure are not visible outside the organization.
No Need To Request New IP Addresses: Organizations do not have to constantly requisition
more IP addresses, as they would in the workaround of using multiple small Class C blocks.
No Routing Table Entry Proliferation: Since the subnet structure exists only within the
organization, routers outside that organization know nothing about it. The organization still
maintains a single (or perhaps a few) routing table entries for all of its devices. Only routers
inside the organization need to worry about routing between subnets.
-
7/29/2019 Tcp Ip English
31/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
netid hostid
netid hostidsubnetid
Network Prefix
Network Prefix
Deciding where to put the boundary of the sub-net field is one of the most importantdesign considerations in setting up a subnetted IP network. The number of subnets is
generally determined based on the number of physical subnetworks in the overallorganizational network. The number of hosts per subnetwork must not exceed themaximum allowed for the particular subnetting choice we make. Choosing how to dividethe original host ID bits into subnet ID bits and host ID bits is sometimes called customsubnetting.
Sub-netting is based on the standard RFC 950, defined and published in 1985. A 3rd layerhere has been introduced: net-id, sub-net id, host-id.
Sub-netting solves the following problems:
-Routing table continuous growth
-IP addresses waste and anti-economic use
-
7/29/2019 Tcp Ip English
32/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Natural network address is a prefix with a mask equal to the implicit one
Subnetting: originates from an implicite mask with more bits set to 1
Address class and netmask
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0
1 1 0 0 0 0 0 1 1 1 0 0 1 1 1 1 10 0 1 1 0 0 0 1 0 0 1 0 0
255 255 255 248
1 1
0 1
193 205 102 36
Network HostSubnet
Address
Mask
In a non-subnetted classful environment, routers use the first octet of theIP address to determine what the class is of the address, and from this they
know which bits are the network ID and which are the host ID. When we usesubnetting, these routers also need to know how that host ID is divided intosubnet ID and host ID. However, this division can be arbitrary for eachnetwork. Furthermore, there is no way to tell how many bits belong to eachsimply by looking at the IP address.
In a subnetting environment, the additional information about which bits arefor the subnet ID and which for the host ID must be communicated to devices
that interpret IP addresses. This information is given in the form of a 32-bitbinary number called a subnet mask.
The network address for one of its hosts can be determined by an ANDoperation between the IP host address and its sub-net mask.
Inside an IP subnet communication takes place using layer 2 services, so:
One physical network is mapped onto one IP subnet.
-
7/29/2019 Tcp Ip English
33/45
33
Internet Protocol
Italo TOBIA
Internet architecture and
services
Rio de Janeiro,
Aug. 2005
Allowed values for the mask
Only consecutive ones:
128 1000 0000 (128)
192 1100 0000 (64)
224 1110 0000 (32)
240 1111 0000 (16)
248 1111 1000 (8)
252 1111 1100 (4)
254 1111 1110 (2)
255 1111 1111 (1)
0000000
0
(0)
1001000
0
(144)
01000111
(71)
10011010
(154)
Result of AND
Masking
0000000
0(0)
1111100
0(248)
11111111
(255)
11111111
(255)Subnet Mask
0010101
0
(42)
1001011
0
(150)
01000111
(71)
10011010
(154)Host IP Address
Octet 4Octet 3Octet 2Octet 1Address byte number
Determining the subnet ID from a host IP address:
-
7/29/2019 Tcp Ip English
34/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Router172.16.0.0
172.16.1.0
172.16.2.0
The class B network 172.16.0.0 has been subnetted extracting two small class
C like subnets:
172.16.1.0 and 172.16.2.0
-
7/29/2019 Tcp Ip English
35/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
172 16 0 0
HostNetwork
255 255 0 0Host
Network
255 255 255 0
HostNetwork
IP address
DefaultSubnet
Mask
24-bit
Subnet
Mask
Subnet
The natural netmask has been extended using the 3rd byte.
From a class B network we can obtain up to 256 class C like subnets, eachwith 256 addresses.
-
7/29/2019 Tcp Ip English
36/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
-
7/29/2019 Tcp Ip English
37/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Direct forwardingDirect forwarding Indirect forwardingIndirect forwarding
YES NO
Bitwise_AND (IP destination address, My subnet mask)
Is equal to
Bitwise_AND (My IP address, My subnet mask) ?
Bitwise_AND (IP destination address, My subnet mask)
Is equal to
Bitwise_AND (My IP address, My subnet mask) ?
The routing process runs on hosts, besides routers.
When a host must send an IP packet on the network, it first evaluates if thedestination IP address to contact belongs to the same network. This
evaluation come through a bitwise AND operation, described in the figure.
-
7/29/2019 Tcp Ip English
38/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
An important limitation in traditional subnetting consists of
using a fixed length subnet mask for each network address
Once the netmask has been defined, we must use a fixed
number of subnets, all with the same dimension (the same
number of host addresses)
In 1987 RFC 1009 specified how one network can be dividedin more subnets with more than one subnet mask
When a network is assigned more than one subnet mask, the
network is considered a VLSM structure
For example, consider a relatively small company with a Class C network,
195.31.238.0/24. They have six subnetworks in their network. The first four
subnets (S1, S2, S3 and S4) are relatively small, containing only 10 hostseach. However, one of them (S5) is for their production floor and has 50 hosts,
and the last (S6) is their development and engineering group, which has 100
hosts.
The total number of addresses needed is thus 196 (including the 6 router
interfaces and excluding the subnetwork and broadcast addresses for each
subnet). Without subnetting, we have enough hosts in our Class C network to
handle them all. However, when we try to subnet, we have a big problem. In
order to have six subnets we need to use 3 bits for the subnet ID. This leavesonly 5 bits for the host ID, which means every subnet has the identical
capacity of 30 hosts. This is enough for the smaller subnets but not enough for
the larger ones. The only solution with conventional subnetting, other than
shuffling the physical subnets, is to get another Class C block for the two big
subnets and use the original for the four small ones. But this is expensive, and
means wasting hundreds of IP addresses!
With traditional subnetting, all subnets must be the same size, which creates
problems when there are some subnets that are much larger than others
-
7/29/2019 Tcp Ip English
39/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Classless InterDomain Routing (CIDR) supports two
important features that broughth two benefits to Internet
routing system:
CIDR removes address classes concept, allowing a more
efficient IP address space allocation
CIDR supports addresses aggregation (supernetting)allowing to represent thousands network classfull IP
address space with a single routing table entry
Subnetting does not really tackle the problems in general terms. Some issues remain due to
the use of classes even with subnets, mainly due to routing operations in the big Internet
environment.As the name implies, classless addressing completely eliminates the prior notions of classes.
There are no more Class A, B, C blocks that are divided by the first few bits of the address.
Instead, under CIDR, all Internet blocks can be of arbitrary size. Instead of having all networks
use 8 (Class A), 16 (Class B) or 24 (Class C) bits for the network ID, we can have larger
networks with, say, 13 bits for the network ID (leaving 19 bits for the host ID), or very small
ones that use 28 bits for the network ID (only 4 bits for the host ID). The size of the network is
still based on the binary power of the number of host ID bits, of course
VLSM is very much like CIDR in how it works.
A classless network is normally specified in CIDR or slash notation, such as this example:
184.13.152.0/22. Here, the /22 means the first 22 bits of the address are the network ID. Theequivalent subnet mask can be calculated by creating a 32-bit number with 22 ones followed
by 10 zeroes. That is:
11111111 11111111 11111100 000000 or in dotted decimal format:
255 255 252 0
The subnet mask length is 22
-
7/29/2019 Tcp Ip English
40/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
Address space is now allocated in such a way to allow
addresses aggregation
Organization needs Assigned addresses
Less than 256 addresses 1 C class network
Less than 512 but more than 256 2 adjacent C class networks
Less than 1024 but more than 512 4 adjacent C class networks
Less than 2048 but more than 1024 8 adjacent C class networks
Less than 4096 but more than 2048 16 adjacent C class networks
Less than 8192 but more than 4096 32 adjacent C class networks
Less than 16384 but more than 8192 64 adjacent C class networks
-
7/29/2019 Tcp Ip English
41/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
198.32.0.0
198.32.7.0
198.32.6.0198.32.1.0198.32.2.0
TokenRing
198.32.0.0/24
198.32.1.0/24
198.32.2.0/24
198.32.3.0/24
198.32.0.0/24
198.32.1.0/24
198.32.2.0/24
198.32.3.0/24
198.32.6.0/24
198.32.7.0/24
198.32.6.0/24
198.32.7.0/24
198.32.0.0/24
198.32.1.0/24.
.
.
198.32.7.0/24
198.32.0.0/24
198.32.1.0/24.
.
.
198.32.7.0/24
198.32.5.0
198.32.4.0
198.32.4.0/24
198.32.5.0/24
198.32.4.0/24
198.32.5.0/24
198.32.3.0
TokenRing
TokenRing
TokenRing Token
RingTokenRing
-
7/29/2019 Tcp Ip English
42/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
198.32.0.0/22198.32.0.0/22198.32.6.0/23198.32.6.0/23
198.32.0.0/21198.32.0.0/21
198.32.4.0
198.32.4.0/23198.32.4.0/23
198.32.0.0
198.32.7.0
198.32.6.0198.32.1.0
198.32.2.0
TokenRing 198.32.5.0
198.32.4.0
198.32.3.0
TokenRing
TokenRing
TokenRing Token
RingTokenRing
-
7/29/2019 Tcp Ip English
43/45
-
7/29/2019 Tcp Ip English
44/45
Internet Protocol
Italo TOBIA
nternet architecture and
ervices
Rio de Janeiro,
Aug. 2005
192.168.11.90
Default Gateway
192.168.10.1
Default Gateway
192.168.10.1Default Gateway
192.168.11.1
Default Gateway
192.168.11.1
192.168.10.0/24
192.168.11.0/24
192.168.10.1 (primary)
192.168.11.1 (secondary)
1 2
192.168.10.10
A host or a router (more often, also desirable) can belong to more than one single logical IP
network.
The primary address is used as default source address for locally generated packets.
It is possible to map more IP networks on to the same local area network. In this case the
router located on both LANs must operate using only one ethernet interface, configured with
two IP addresses.
-
7/29/2019 Tcp Ip English
45/45
45
Internet Protocol
Italo TOBIA
Internet architecture and
services
Rio de Janeiro,
Aug. 2005
LAN A: 1000 hosts
LAN B: 500 hosts
LAN D: 60 hosts
LAN C: 30 hosts
R5
R1
R2
R3R4
LAN E: 100 hosts
WAN G
WAN H WAN I
LANF
:200
hosts
Exercise: subnetting problem
Design the IP addressing plan for the network described in the figure.
We have 9 networks with a total amount of about 2000 hosts. You must use the address blocks from 200.0.0.0/24
to 200.0.7.0/24 (8 adjacent class C address blocks).
You can avoid to use IP addresses for router serial interfaces; in doing so you can loose management capabilities
and network discovery for these interfaces.The following text has been intentionally left in italian, because the solution must be investigated by the class.
Conviene sempre numerare prima le sottoreti pi estese.
Per la LAN A, quindi, occorrono 4 blocchi di indirizzi di classe C (1000 -> 4 x 256) e la maschera dovr tener conto della lunghezza della parte host
(che 10 bit), per cui sar lunga 32-10=22 bit. Quindi per la LAN A si hanno i seguenti indirizzi:
200.0.x.0/22, con x=0,1,2,3. Gli host saranno numerati da 200.0.0.2 in poi, evitando gli indirizzi 200.0.x.0; in caso di espansione futura, infatti,
alcuni host dovrebbero cedere alla rete il loro indirizzo ed essere rinumerati. Il router ha un indirizzo 200.0.0.1 verso la LAN A.
Per la LAN B occorrono due blocchi di 256 indirizzi non tutti utilizzati:
200.0.4.0/23 e 200.0.5.0/23. Gli host sono numerati a partire da 200.0.4.2 e 200.0.5.2 ed avranno come router di default 200.0.4.1 e come
secondario 200.0.5.1 definiti sullinterfaccia di R1 verso la rete B.
La rete F pu essere numerata con un blocco di indirizzi del tipo 200.0.6.0/24 (gli host sono 200, per cui occorrono 8 bit e la maschera avr una
lunghezza 32-8=24).
La rete E pu utilizzare una parte dellultimo blocco di indirizzi, cio 200.0.7.0/25 (100 host -> 7 bit -> lunghezza maschera= 32-7=25).
La rete D numerata con una parte del sottoinsieme di indirizzi residui del blocco 200.0.7.x, in particolare: 200.0.7.128/26 (essendo 60 gli host, lamaschera ha una lunghezza 32-6=26).
La numerazione di C si ottiene impiegando una parte degli indirizzi residui del blocco utilizzato per D ed E: 200.0.7.192/27 (30 host -> 5 bit per il
campo host e maschera di lunghezza 32-5=27).
Le reti definite sui collegamenti seriali si indirizzano infine impiegando le numerazioni residue:
G: 200.0.7.224/30;
H: 200.0.7.228/30;
I: 200.0.7.232/30