Professional Documents
Culture Documents
Chapter 1
Chapter 1
Class A addresses only include IP starting from 1.x.x.x to 126.x.x.x only. The
IP range 127.x.x.x is reserved for loopback IP addresses.
IP Address is divided in to Network Portion and Host Portion
Number
Firs First Netwo Host
Cla of Number of
t Byte rk ID ID
ss Network Hosts
Bits Values Bits Bits
s
A 0 1 - 126 8 24 126 1,67,77,214
128
B 10 16 16 16,384 65,534
-191
192 - 2,097,15
C 110 24 8 254
223 2
NOH= 2n where n= host ID bits
NON= 2m-i where m = no of network ID bits, i= no of first bits
Clas
Network Address
s
10.0.0.0 through
A
10.255.255.255
172.16.0.0 through
B
172.31.255.255
192.168.0.0 through
Classless C Addressing
192.168.255.255
There are three main problems
with “classful” addressing, which are somewhat related to each other (making
them a bit harder to explain).
1 Lack of Internal Address Flexibility: Big organizations are assigned large,
“monolithic” blocks of addresses that don't match well the structure of their
underlying internal networks.
2 Inefficient Use of Address Space: The existence of only three block sizes
(classes A, B and C) leads to waste of limited IP address space.
3 Proliferation of Router Table Entries: As the Internet grows, more and
more entries are required for routers to handle the routing of IP datagrams,
which causes performance problems for routers. Attempting to reduce
inefficient address space allocation leads to even more router table entries.
The Internet authorities announced a new architecture called classless
addressing. In classless addressing, variable-length blocks are used that belong
to no classes.
In classful addressing the whole address space was divided into five classes.
Although each organization was granted one block in class A, B, or C, the size
of the blocks was predefined; the organization needed to choose one of the three
block sizes. The only block in class D and the only block in class E were
reserved for a special purpose.
In classless addressing, the whole address space is divided into variable length
blocks. Theoretically, we can have a block of 20, 21, 22, . . . , 232 addresses. The
only restriction is that the number of addresses in a block needs to be a power of
2. An organization can be granted one block of addresses. Figure shows the
division of the whole address space into nonoverlapping blocks.
Fragmentation
IP fragmentation is an Internet Protocol (IP) process that breaks packets into
smaller pieces (fragments), so that the resulting pieces can pass through a link
with a smaller MTU (maximum transmission unit) than the original packet size.
The fragments are reassembled by the receiving host.
Maximum Transfer Unit (MTU)
Each data link layer protocol has its own frame format in most protocols. One
of the fields defined in the format is the maximum size of the data field. In other
words, when a datagram is encapsulated in a frame, the total size of the
datagram must be less than this maximum size, which is defined by the
restrictions imposed by the hardware and
software used in the network (see Figure).
The value of the MTU differs from one physical network protocol to another.
Options.
Protocol MTU
Hyperchannel 65,535
Token
17,914
Ring(16Mbps)
Token
4,464
Ring(4Mbps)
FDDDI 4,352
Ethernet 1,500
X.25 576
PPP 296
Fields Related to Fragmentation
The fields that are related to fragmentation and reassembly of an IP datagram
are the identification, flags, and fragmentation offset fields.
Identification
i. This 16-bit field identifies a datagram originating from the source host. The
combination of the identification and source IP address must uniquely define a
datagram as it leaves the source host.
ii. To guarantee uniqueness, the IP protocol uses a counter to label the
datagrams. The counter is initialized to a positive number.
iii. When the IP protocol sends a datagram, it copies the current value of the
counter to the identification field and increments the counter by one.
iv. As long as the counter is kept in the main memory, uniqueness is guaranteed.
When a datagram is fragmented, the value in the identification field is copied
into all fragments.
v. In other words, all fragments have the same identification number, which is
also the same as the original datagram.
vi. The identification number helps the destination in reassembling the
datagram. It knows that all fragments having the same identification value
should be assembled into one datagram.
Flags
i. This is a three-bit field. The first bit is reserved (not used). The second bit is
called the do not fragment bit.
ii. If its value is 1, the machine must not fragment the datagram. If it cannot
pass the datagram through any available physical network, it discards the
datagram and sends an ICMP error message to the source host. If its value is 0,
the datagram can be fragmented if necessary.
iii. The third bit is called the more fragment bit.
iv. If its value is 1, it means the datagram is not the last fragment; there are
more fragments after this one. If its value is 0, it means this is the last or only
fragment.
Fragmentation offset
i. This 13-bit field shows the relative position of this fragment with respect to
the whole datagram.
ii. It is the offset of the data in the original datagram measured in units of 8
bytes. Figure shows a datagram with a data size of 4000 bytes fragmented into
three fragments. The bytes in the original datagram are numbered 0 to 3999.
The first fragment carries bytes 0 to 1399.
iii. The offset for this datagram is 0/8= 0. The second fragment carries bytes
1400 to 2799; the offset value for this fragment is 1400/8= 175.
iv. Finally, the third fragment carries bytes 2800 to 3999. The offset value for
this fragment is 2800/8= 350.
Options
The header of the IP datagram is made of two parts: a fixed part and a variable
part. The
fixed part is 20 bytes long. The variable part comprises the options, which can
be a maximum of 40 bytes.
Options are not required for a datagram. They can be used for network testing
and debugging. Although options are not a required part of the IP header, option
processing is required of the IP software. This means that all implementations
must be able to handle options if they are present in the header.
Type
The type field is 8 bits long and contains three subfields: copy, class, and
number.
❑ Copy. This 1-bit subfield controls the presence of the option in
fragmentation.
When its value is 0, it means that the option must be copied only to the first
fragment.
If its value
is 1, it means the option must be copied to all fragments.
❑ Class. This 2-bit subfield defines the general purpose of the option. When its
value
is 00, it means that the option is used for datagram control. When its value is 10,
it
means that the option is used for debugging and management. The other two
possible
values (01 and 11) have not yet been defined.
❑ Number. This 5-bit subfield defines the type of option. Although 5 bits can
define
up to 32 different types, currently only 6 types are in use.
0 - Special case indicating the end of the option list, in this case the option field
is just one octet as no length or data fields are present.
1 - No Operation, again the option field is just one octet with no length or data
fields.
3 - Loose Source Routing which is IP routing based on information supplied by
the source station where the routers can forward the datagram to any number of
intermediate routers in order to get to the destination.
4 - Internet Timestamp. A timestamp option is used to record the time of
datagram processing by a router.
7 - Record Route records the route that a datagram takes.
9 - Strict Source Routing which is IP routing based on information supplied by
the source station where the routers can only forward the datagram to a directly
connected router in order to get to the next hop indicated in the source route
path.
Length
The length field defines the total length of the option including the type field and
the length field itself. This field is not present in all of the option types.
Value
The value field contains the data that specific options require. Like the length
field, this
field is also not present in all option types.
ICMPv4:
ICMP (Internet Control Message Protocol) is an error-reporting protocol
network devices like routers use to generate error messages to the source IP
address when network problems prevent delivery of IP packets. ICMP creates
and sends messages to the source IP address indicating that a gateway to the
Internet that a router, service or host cannot be reached for packet delivery. Any
IP network device has the capability to send, receive or process ICMP
messages.
The value of the protocol field in the IP datagram is 1 to indicate that the IP data
is an ICMP message.
Debugging Tools
There are several tools that can be used in the Internet for debugging. We can
find if a host or router is alive and running. We can trace the route of a packet.
We introduce two tools that use ICMP for debugging: ping and traceroute
Ping:
Ping is a computer network administration software utility used to test the
reachability of a host on an Internet Protocol (IP) network.
Ping operates by sending Internet Control Message Protocol (ICMP) echo
request packets to the target host and waiting for an ICMP echo reply. The
program reports errors, packet loss, and a statistical summary of the results,
typically including the minimum, maximum, the mean round-trip times, and
standard deviation of the mean.
Traceroute:
The traceroute program in UNIX or tracert in Windows can be used to trace the
route
of a packet from the source to the destination.
The traceroute command uses ICMP Time Exceeded messages to trace a
network route. As the Time to Live field is used in IP to avoid routing loops:
every time a packet passes through a router, the router decrements the TTL
field. If the TTL reaches zero, the router drops the packet and sends an ICMP
Time Exceeded message to the original sender.
The client then sends a packet with a TTL of 2 to the server. Router A
decrements the TTL to 1 and passes the packet to router B. Router B
decrements the TTL to 0, drops it, and sends an ICMP Time Exceeded message
to the client. Router B is now identified. This process continues until the server
is reached, as shown in Figure, identifying all routers along the route.
Figure: Traceroute
ICMP Checksum
The error detection method used by most TCP/IP protocols is called the
checksum.
The checksum protects against the corruption that may occur during the
transmission of a packet. It is redundant information added to the packet.
The checksum is calculated at the sender and the value obtained is sent with the
packet. The receiver repeats the same calculation on the whole packet including
the checksum. If the result is satisfactory, the packet is accepted; otherwise, it is
rejected.
In ICMP the checksum is calculated over the entire message (header and data).
Checksum Calculation
The sender follows these steps using one’s complement arithmetic:
1. The checksum field is set to zero.
2. The sum of all the 16-bit words (header and data) is calculated.
3. The sum is complemented to get the checksum.
4. The checksum is stored in the checksum field.
Checksum Testing
The receiver follows these steps using one’s complement arithmetic:
1. The sum of all words (header and data) is calculated.
2. The sum is complemented.
3. If the result obtained in step 2 is 16 0s, the message is accepted; otherwise, it
is rejected.
Mobile IP:
A. Addressing
Mobile IP is a communication protocol (created by extending Internet Protocol,
IP) that allows the users to move from one network to another with the same IP
address. It ensures that the communication will continue without user’s sessions
or connections being dropped.
a) Stationary Hosts
The original IP addressing was based on the assumption that a host is stationary,
attached to one specific network. A router uses an IP address to route an IP
datagram.
b)Mobile Hosts
When a host moves from one network to another, the IP addressing structure
needs to
be modified. Several solutions have been proposed.
i. Changing the Address
One simple solution is to let the mobile host change its address as it goes to the
new
network. The host can use DHCP to obtain a new address to associate it with the
new network.
This approach has several drawbacks.
First, the configuration files would need to be changed.
Second, each time the computer moves from one network to another, it must be
rebooted. Third, the DNS tables need to be revised so that every other host in
the Internet is aware of the change.
Fourth, if the host roams from one network to another during a transmission, the
data exchange will be interrupted. This is because the ports and IP addresses of
the client and the server must remain constant for the duration of the
connection.
ii. Two Addresses
The approach that is more feasible is the use of two addresses. The host has its
original
address, called the home address, and a temporary address, called the care-of
address.
The home address is permanent; it associates the host to its home network, the
network
that is the permanent home of the host. The care-of address is temporary. When
a host moves from one network to another, the care-of address changes; it is
associated with the foreign network, the network to which the host moves.
Figure shows the concept.
Figure: - Home address and care-of address
B.Agents,
To make the change of address transparent to the rest of the Internet requires a
Home Agent and a Foreign Agent.
Figure shows the position of a Home Agent relative to the Home Network and a
Foreign Agent relative to the Foreign Network.
Agent Advertisement
When a router advertises its presence on a network using an ICMP router
advertisement, it can append an agent advertisement to the packet if it acts as an
agent.
Mobile IP does not use a new packet type for agent advertisement; it uses the
router advertisement packet of ICMP, and appends an agent advertisement
message.
Agent Solicitation
When a mobile host has moved to a new network and has not received agent
advertisements, it can initiate an agent solicitation. It can use the ICMP
solicitation message to inform an agent that it needs assistance.
Mobile IP does not use a new packet type for agent solicitation; it uses the
router solicitation packet of ICMP.
b)Registration
Mobile node after discovering the foreign agent, sends registration request
(RREQ) to the foreign agent. Foreign agent in turn, sends the registration
request to the home agent with the care-of-address. Home agent sends
registration reply (RREP) to the foreign agent. Then it forwards the registration
reply to the mobile node and completes the process of registration.
c) Data transfer
The Mobile Node sends packets using its home IP address, effectively
maintaining the appearance that it is always on its home network. Even while
the Mobile Node is roaming on foreign networks, its movements are transparent
to correspondent nodes.
Data packets addressed to the Mobile Node are routed to its home network,
where the Home Agent now intercepts and tunnels them to the care-of address
toward the Mobile Node. Tunneling has two primary functions: encapsulation
of the data packet to reach the tunnel endpoint, and decapsulation when the
packet is delivered at that endpoint. The default tunnel mode is IP
Encapsulation within IP Encapsulation. Optionally, Generic Routing
Encapsulation (GRE) and minimal encapsulation within IP may be used.
Typically, the Mobile Node sends packets to the Foreign Agent, which routes
them to their final destination, the Correspondent Node, as shown in Figure.