CH-5: Internet Protocol and IP Addressing
CH-5: Internet Protocol and IP Addressing
CH-5: Internet Protocol and IP Addressing
MAC addresses are expressed in six hexadecimal values. In some instances, the six values are
separated by colons (:); in others, hyphens (-) are used; and in still others, a space is simply inserted
between the values. In any case, because the six values are hexadecimal, they can only be numbers
0 – 9 and the letters A – F. So, a valid MAC address might be 00-D0-56-F2-B5-12, or
00:26:DD:14:C4:EE.
There is a way of finding out whether a MAC address exists through the IEEE, which is responsible
for managing MAC address assignment. The IEEE has a system in place that lets you identify the
manufacturer of the network interface by looking at the MAC address. For example, in the MAC
address 00-80-C8-E3-4C-BD, the 00-80-C8 portion (the first three bytes) identifies the
manufacturer and the E3-4C-BD portion (the last three bytes) is assigned by the manufacturer to
make the address unique. The IEEE is the body that assigns manufacturers their IDs, called
Organizationally Unique Identifiers (OUI), and the manufacturer then assigns the second half,
called the Universal LAN MAC address. From the IEEE’s perspective, leaving the actual
1
assignment of addresses to the manufacturers significantly reduces the administrative overhead for
the IEEE.
The method by which you can discover the MAC address of the network interfaces in your
equipment depends on which operating system is being used. Table 5.1 shows you how to obtain the
MAC address on some of the more common platforms.
Platform Method
Windows 95/98/Me Run the winipcfg utility
Windows NT/2000 Run ipconfig /all from a command prompt
Linux/Some UNIX Run the ifconfig -a command
Novell NetWare Run the config command
Cisco Router Run the show interface <interface name> command
Table 5.1. Commands to obtain MAC addresses on different platforms
Example:
07:01:02:2C:4B
07-01-02-2C-4B
07 01 02 2C 4B
A 6 – byte (12 hex digits) physical address represented by different platforms.
A unicast destination address defines only one recipient; the relationship between the sender and
the receiver is one-to-one. A multicast destination address defines a group of receiver addresses;
the relationship between the sender and the receivers is one-to-many.
The broadcast address is a special case of the multicast address; the recipients are all the stations on
the LAN. A broadcast destination address is forty-eight 1s.
2
NOTE:
The least significant bit of the first byte defines the type of the address.
If the bit is 0, the address is unicast; otherwise, it is multicast.
The broadcast address is a special kind of multicast address in which all the
48 – bits are 1 (all hex digits are F).
Solution: To find the type of the address, we need to look at the second hexadecimal digit from the
left. If it is even, the address is unicast. If it is odd, the address is multicast. If all digits are F’s, the
address is broadcast. Therefore, we have the following:
a) T his is a unicast address, because A in binary is 1010 (even).
b) This is a multicast address, because 7 in binary is 0111 (odd).
c) This is a broadcast address, because all digits are F’s.
The way the addresses are sent out on line is different from the way they are written in hexadecimal
notation. The transmission is left-to-right, byte by byte; however, for each byte, the least
significant bit is sent first and the most significant bit is sent last. This means that the bit that
defines an address as unicast or multicast arrives first at the receiver.
Example 5.2: Show how the address 47:20:1B:2E:08:EE is sent out on line.
Solution: The address is sent left-to-right, byte by byte; for each byte, it is sent right-to-left, bit by
bit, as shown below.
➢ First, lets convert the hexadecimal digits to their binary equivalent:
0100 0111 : 0010 0000 : 0001 1011 : 0010 1110 : 0000 1000 : 1110 1110
4 7 2 0 1 B 2 E 0 8 E E
➢ Next, we will take the first byte (01000111), flip it over (11100010), and then send.
➢ Do exactly the same fir the remaining five bytes. Finally, the address will look like as
follows when it sends through the medium.
←111000100000010011011000011101000001000001110111
3
(2) Logical Addresses:
Logical addresses are necessary for universal communications that are independent of underlying
physical networks. Physical addresses are not adequate in an internetwork environment where
different networks can have different address formats. A universal addressing system is needed in
which each host can be identified uniquely, regardless of the underlying physical network. The
logical addresses are designed for this purpose. A logical address in the Internet is currently a 32-bit
address that can uniquely define a host connected to the Internet. No two publicly addressed and
visible hosts on the Internet can have the same IP address.
NOTE:
The physical address (MAC address) will change from hop-to-hop, but the logical
address remains the same.
NOTE:
The physical address (MAC address) will change from hop-to-hop, but the logical
and port addresses remain the same.
4
Resource Locator (URL) (for example, www.yahoo.com). The first defines the recipient of an e-
mail; the second is used to find a document on the World Wide Web. These addresses, however, get
changed to the corresponding port and logical addresses by the sending computer.
An IPv4 address is a 32-bit sequence of ones and zeros that uniquely and universally defines the
connection of a device (for example, a computer or a router) to the Internet. IPv4 addresses are
unique. They are unique in the sense that each address defines one, and only one, connection to
the Internet. Two devices on the Internet can never have the same address at the same time. It is
commonly represented in dotted decimal format, as it is easier to understand and less prone to error.
In this format, each of the 4 bytes is written in decimal, from 0 to 255. For example, 192.41.6.20 is
a valid IP address. The lowest IP address is 0.0.0.0 and the highest is 255.255.255.255.
5.2.2. Notations
Each TCP/IP host is identified by a logical IP address. This address is unique for each host that
communicates by using TCP/IP. Each 32-bit IP address identifies a location of a host system on the
network in the same way that a street address identifies a house on a city street. Just as a street
address has a standard two-part format (a street name and a house number), each IP address is
separated internally into two parts--a network ID and a host ID:
5
➢ The network ID, also known as a network address, identifies a single network segment
within a larger TCP/IP internetwork (a network of networks). All the systems that attach and
share access to the same network have a common network ID within their full IP address.
This ID is also used to uniquely identify each network within the larger internetwork.
➢ The host ID, also known as a host address, identifies a TCP/IP node (a workstation, server,
router, or other TCP/IP device) within each network. The host ID for each device identifies
a single system uniquely within its own network.
There are two prevalent notations to show an IPv4 address: binary notation and dotted-decimal
notation.
➢ Binary Notation: In binary notation, the IPv4 address is displayed as 32 bits. Each octet is
often referred to as a byte. So it is common to hear an IPv4 address referred to as a 32-bit
address or a 4-byte address. The following is an example of an IPv4 address in binary
notation:
01110101 10010101 00011101 00000010
➢ Dotted-Decimal Notation: To make the IPv4 address more compact and easier to read by
humans, Internet addresses are usually written in decimal form with a decimal point (dot)
separating the bytes. The following is the dotted decimal notation of the above address:
117.149.29.2
Example 5.3: Change the following IPv4 addresses from binary to dotted-decimal notation.
a) 10000001 00001011 00001011 11101111
b) 11000001 10000011 00011011 11111111
Solution: We replace each group of 8 bits with its equivalent decimal number (see Appendix B) and
add dots for separation.
a) 129.11.11.239
b) 193.131.27.255
Example 5.4: Change the following IPv4 addresses from dotted-decimal notation to binary
notation.
a) 111.56.45.78
b) 221.34.7.82
Solution: We replace each decimal number with its binary equivalent (see Appendix B).
a) 01101111 00111000 00101101 01001110
b) 11011101 00100010 00000111 01010010
6
Example 5.5: Find the error, if any, in the following IPv4 addresses.
a) 111.56.045.78
b) 221.34.7.8.20
c) 75.45.301.14
d) 11100010.23.14.67
Solution:
a) There must be no leading zero (045).
b) There can be no more than four numbers in an IPv4 address.
c) Each number needs to be less than or equal to 255 (301 is outside this range).
d) A mixture of binary notation and dotted-decimal notation is not allowed.
7
Table 5.1 shows detailed description of classful addresses. The table contains which part of the
address space we use to create network and host addresses, number of networks we can create in
each class, and number of hosts we can create per network. The letters w, x, y and z are used to
represent the first, second, third, and fourth octets respectively.
Depending on the values of the network and host portions, we have three types of addresses:
➢ Network address: this is the address by which we refer to the network; its host portion bits
are all 0.
➢ Broadcast address: a special address used to send data to all hosts in the network; its host
portion bits are all 1.
➢ Host addresses: The addresses assigned to the end devices in the network; its host portion
cannot all be 0 or 1.
The values 0 and 1 (all 0’s and all 1’s) have special meanings. For example:
➢ The IP address 0.0.0.0 (all the 32-bits are 0s)is used by hosts when they are being booted. It
means this host.
➢ IP addresses with 0 (all the bits of host portion are 0s) as network number refer to the
current network. These addresses allow machines to refer to their own network without
knowing its number.
➢ The address consisting of all 1’s (all the bits of host portion) 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 (although many network
administrators disable this feature).
➢ 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. These are special addresses that hosts use to direct traffic to themselves.
➢ Link-Local Addresses (169.254.0.0 to 169.254.255.255 (169.254.0.0/16)) is automatically
assigned to the local host by the operating system in environments where no IP
configuration is available.
8
Example 5.6: Find the class of each address.
a) 00000001 00001011 00001011 11101111
b) 11000001 10000011 00011011 11111111
c) 14.23.120.8
d) 252.5.15.111
Solution:
a) The first bit is 0. This is a class A address.
b) The first 2 bits are 1; the third bit is 0. This is a class C address.
c) The first byte is 14 (between 0 and 127); the class is A.
d) The first byte is 252 (between 240 and 255); the class is E.
5.2.3.1. Subnet-Mask
A subnet mask is used to delineate (represent accurately) the network portion from the host
portion. It is 32 bits long, with all 1’s corresponding to the network portion and all 0’s
corresponding to the host portion of the IP address. A subnet mask can be represented in dotted
binary, dotted decimal or slash (prefix length) notation.
For example, if the network and host portion are each 16 bits long, then the subnet mask can be
represented in any of the following ways:
Dotted binary : 11111111.11111111.00000000.00000000
Dotted decimal : 255.255.0.0
Slash (prefix length): /16
From the above, it can be seen that the bit-wise ANDing of the IP address and the subnet mask
gives the network address.
Example, given IP address of 192.168.5.28 and subnet mask of 255.255.255.0 (or /24), the
network address becomes 192.168.5.0, as shown below.
For classful IP addressing, the “default” subnet masks fall on “natural octet boundaries”, like /8
for class A, /16 for class B, or /24 class C. For classless IP addressing, the subnet masks do not have
to end on ”natural octet boundaries”, like /12, /20 or /27. The longer the subnet prefix length the
smaller the number of bits in the host portion and thus the smaller the number of hosts we have
per network.
5.2.3.2. Subnetting
As a network grows, a need arises to divide the network into smaller subnetworks for one or more
of the following reasons.
9
➢ A company uses two or more types of LAN technology (for example, Ethernet, and Token
Ring) on their network.
➢ Two network segments are restricted by distance limitations (for example, remote offices
linked via point-to-point circuit).
➢ Segments need to be localized for network management reasons (accounting segment, sales
segment, etc.).
➢ Hosts which dominate most of the LAN bandwidth need to be isolated.
➢ To reduce the broadcast domain and improve network efficiency.
The subnets may be arranged logically in a hierarchical architecture, partitioning the organization's
network address space into a tree-like routing structure. Routers are used to interchange traffic
between subnetworks and constitute logical or physical borders between the subnets. They manage
traffic between subnets.
To subnet, the host ID of the original IP address is subdivided into subnet ID and host ID, as shown
in the Figure 5.5. As shown in the figure, nine bits are borrowed from the host portion for
subnetting.
Depending on the network size, different values of subnet ID and host ID can be chosen.
Example 5.7: Given an IP address of 150.100.14.163 and a subnet mask of 255.255.255.128,
determine the maximum number of hosts per subnet.
Solution: The subnet mask of the classful network (Class B) was /16 and that for the subnetwork is
/25. Thus, 9 bits are borrowed for subnetting and 7 bits are left for the host portion. The number of
hosts is thus 27 - 2 = 62 (2 is subtracted from the theoretical number of possible bit combinations in
the host portion to account for the subnetwork address (all 0’s) and broadcast address (all 1’s)).
10
5.2.4. Classless Inter-Domain Routing (CIDR)
CIDR, defined in RFC 1519, was invented several years ago to keep the Internet from running out
of IP addresses. The "classful" system of allocating IP addresses can be very wasteful; anyone who
has a need for more that 254 host addresses was given a Class B address block of 65,533 host
addresses. Even more wasteful were companies and organizations that were allocated Class A
address blocks, which contain over 16 Million host addresses! Only a tiny percentage of the
allocated Class A and Class B address space can actually be assigned to a host in the network.
People realized that addresses could be conserved if the class system was eliminated. By
accurately allocating only the amount of address space that was actually needed, the address space
crisis could be avoided for many years. This was first proposed in 1992 as a scheme called
Supernetting. Under supernetting, the classful subnet masks are extended so that a network address
and subnet mask could, for example, specify multiple Class C subnets with one address.
For example, to accommodate 1000 addresses, 4 Class C networks could be combined together:
In this example, the subnet 192.60.128.0 includes all the addresses from 192.60.128.0 to
192.60.131.255. As can be seen in the binary representation of the subnet mask, the Network
portion of the address is 22 bits long, and the host portion is 10 bits long. Under CIDR, the subnet
mask notation is reduced to a simplified shorthand. Instead of spelling out the bits of the subnet
mask, it is simply listed as the number of 1s bits that the mask. In the above example, instead of
writing the address and subnet mask as 192.60.128.0, and 255.255.252.0 the network address could
be written simply as: 192.60.128.0/22. This indicates the starting address of the network, and
number of 1s bits (22) in the network portion of the address.
11
not reside on the same subnet. The automatic distribution of IP configuration information to hosts
eases the administrative burden of maintaining IP networks. In its simplest form, DHCP
distributes the IP address, subnet mask and default gateway to a host, but can include other
configuration parameters such as name servers and netbios configuration.
Advantages
The next-generation IP, or IPv6, has some advantages over IPv4 that can be summarized as follows:
➢ Larger address space: An IPv6 address is 128 bits long. Compared with the 32-bit address
of IPv4, this is a huge increase in the address space.
➢ Better header format: IPv6 uses a new header format in which options are separated from
the base header and inserted, when needed, between the base header and the upper-layer
data. This simplifies and speeds up the routing process because most of the options do not
need to be checked by routers.
➢ New options: IPv6 has new options to allow for additional functionalities.
➢ Allowance for extension: IPv6 is designed to allow the extension of the protocol if required
by new technologies or applications.
➢ Support for resource allocation: In IPv6, the type-of-service field has been removed, but a
mechanism has been added to enable the source to request special handling of the packet.
This mechanism can be used to support traffic such as real-time audio and video.
➢ Support for more security: The encryption and authentication options in IPv6 provide
confidentiality and integrity of the packet.
IPv6 addresses are represented by breaking them up into eight 16-bit segments (8 * 16 = 128 bits).
Each segment is written in hexadecimal between 0x0000 and 0xFFFF, separated by colons. An
example of a written IPv6 address is:
3FFE:1944:0100:000A:0000:00BC:2500:0D0B
12
➢ The sender side breaks application messages into segments, adds headers to each segment
and passes them to the network layer.
➢ The receiver side removes the headers from each segment, reassembles the segments into
messages, and then passes the messages to the application layer.
Whenever we need to deliver something to one specific destination among many, we need an
address. Transport layer uses port number to choose a process from among multiple processes
running on the destination host. The destination port number is needed for delivery; the source port
number is needed for the reply.
In the Internet model, the port numbers are 16-bit integers between 0 and 65,535. The client
program defines itself with a port number, chosen randomly by the transport layer software running
on the client host. This is the ephemeral port number (lasting a very short time). The server process
must also define itself with a port number. This port number, however, cannot be chosen randomly.
Thus in the Internet, universal port numbers, called well-known port numbers, are used with
servers.
Thus, IP addresses and port numbers play different roles in selecting the final destination of data.
The destination IP address defines the host among the different hosts in the world. After the host
has been selected, the port number defines one of the processes on this particular host. The IANA
(Internet Assigned Number Authority) has divided the port numbers into three ranges: well known,
registered, and dynamic (or private).
1) Well-known ports range from 0 to 1023; they are assigned and controlled by IANA.
Examples of well-known ports include 23 (Telnet), 53 (DNS), 80 (HTTP), 443 (HTTPS),
etc.
2) Registered ports range from 1024 to 49,151. These are not assigned or controlled by IANA.
They can only be registered with IANA to prevent duplication.
3) Dynamic ports range from 49,152 to 65,535. They are neither controlled nor registered.
They can be used by any process. These are the ephemeral ports.
In the Internet, there are two transport-layer protocols, namely User Datagram Protocol (UDP) and
Transmission Control Protocol (TCP).
13
UDP is often used for streaming multimedia applications because these applications are loss
tolerant and rate sensitive.
Congestion control: is a technique for monitoring network utilization and
manipulating transmission or forwarding rates for data frames to keep traffic
levels from overwhelming the network medium.
Flow control: is the process of managing the rate of data transmission between
two nodes to prevent a fast sender from outrunning a slow receiver.
UDP has only four fields, namely source port number, destination port number, length and
checksum as shown in Figure 5.6.
32 bits
Length Checksum
➢ Source Port Number: is port number of the source device. It is used later for reply by the
destination device.
➢ Destination Port Number: is port number of the destination device. It is used to identify the
specific process on the destination device.
➢ Length: is length of UDP segment, plus the header.
➢ Checksum: is used to detect errors in transmitted segment.
➢ Message: it is a segment of the Application Data (Message)
14
A key feature of TCP, and one which dominates the protocol design, is that every segment on a TCP
connection has its own 32-bit sequence number. Separate 32-bit sequence numbers are used for
acknowledgements and for the window mechanism, as discussed below.
The sending and receiving TCP entities exchange data in the form of segments. A TCP segment
consists of a fixed 20-byte header (plus an optional part) followed by zero or more data bytes. The
TCP software decides how big segments should be. It can accumulate data from several writes into
one segment or can split data from one write over multiple segments. Two limits restrict the
segment size. First, each segment, including the TCP header, must fit in the 65,515 byte IP payload.
Second, each network has a maximum transfer unit, or MTU, and each segment must fit in the
MTU. In practice, the MTU is generally 1500 bytes (the Ethernet payload size) and thus defines the
upper bound on segment size.
The basic protocol used by TCP entities is the sliding window protocol. When a sender transmits a
segment, it also starts a timer. When the segment arrives at the destination, the receiving TCP entity
sends back a segment (with data if any exist, otherwise without data) bearing an acknowledgement
number equal to the next sequence number it expects to receive. If the sender's timer goes off
before the acknowledgement is received, the sender transmits the segment again.
32-bits
Sequence Number
Acknowledgement Number
TCP U A P R S F
Header Not Used R C S S Y I Window Size
Length G K H T N N
Data (Optional)
15