Exercises regarding working with IP Addresses

Questions

  1. What are two main components of an IP address?
  2. In a  block  of  addresses,  we  know  the  IP  address  of  one  host  is 25.34.12.56/16. What is the network address, first address and the last address in the block?
  3. Find the range of address in following blocks.        I.17.34.16.0/23
    II.180.34.64.64/30
    III.123.56.77.32/29
    IV.200.17.21.128/27
  4. You are given the network address 175.200.0.0; you are required to have 4 subnets. What is the minimum number of Host Bits can you take in to the Network Bits for this purpose? Write down the addresses of 4 subnets. Write the subnet mask for the network.
  5. An organization is granted the block 16.0.0.0 in class A. The administrator wants to create 500 subnets.         I.Find the subnet mask.
    II.Find the number of addresses in each subnet.
    III.Find the first and last address in the first subnet.
    IV.Find the first and last address in the last subnet.
  6. An organization is granted the block 130.56.0.0 in class B. The administrator wants to create 1024 subnets.          I.Find the subnet mask.
    II.Find the number of addresses in each subnet.
    III.Find the first and last address in the first subnet.
    IV.Find the first and last address in the last subnet (subnet 1024).
  7. An organization is granted the block 211.17.180.0 in class C. The administrator wants to create 32 subnets.                                                 I.Find the subnet mask.
    II.Find the number of addresses in each subnet.
    III.Find the first and the last address in the first subnet.
    IV.Find the first and the last address in the last subnet (subnet 32).

Answers

Capture1ex

Capture2ex

Capture3ex

Capture4ex

Capture5ex

Capture6ex

 

 

 

 

 

 

 

 

Further more on working with IP Addresses

Subnet mask

  • An IP address has 2 parts:
  1. The Network identification.
  2. The Host identification.
  • Frequently, the Network & Host portions of the address need to be separately extracted.
  • In most cases, if you know the address class, it’s easy to separate the 2 portions.
  • With the rapid growth of the internet & the ever-increasing demand for new addresses, the standard address class structure has been expanded by borrowing bits from the Host portion to allow for more Networks.
  • Under this addressing scheme, called Subnetting, separating the Network & Host requires a special process called Subnet Masking.
  • The subnet masking process was developed to identify & extract the Network part of the address.
  • The function of a subnet mask is to determine whether an IP address exists on the local network or whether it must be routed outside the local network.
  • However, if network address don’t matches the local network ID, the message must be routed outside the local network.
  • The process used to apply the subnet mask involves Boolean algebra to filter out non-matching bits to identify the network address.
  • Boolean algebra is a process that applies binary logic to yield binary results.
  • Working with subnet masks, you need only 4 basic principles of Boolean Algebra:
    • 1 and 1 = 1
    • 1 and 0 = 0
    • 0 and 1 = 0
    • 0 and 0 = 0
  • The process of combining binary values with Boolean Algebra is called Anding

Default Standard Subnet mask

defaultstandart.PNG

  • Subnet masks apply only to Class A, B or C IP addresses.
  • The subnet mask is like a filter that is applied to a message’s destination IP address.
  • If a destination IP address is 206.175.162.21, we know that it is a Class C.
  • We also know that the default standard Class C subnet mask is: 255.255.255.0
  • When these two binary numbers (the IP address & the subnet mask) are combine using Boolean Algebra, the Network ID of the destination network is the result.

binaryresult.PNG

  • The result is the IP address of the network. If this address is the same as the local network, the message is for a node on the local network.

Routing IP Addresses

  • When you build a network, you need to figure out how many network IDs your network requires.
  • There’s no hard & fast rule on how you should dole out your allotted IP addresses.
  • Commonly, though, the lowest numbers (1 through 10) are assigned to routers & servers but how you assign addresses is strictly up to you & your network policies & guidelines.

What is Subnetting ?

  • Subnetting is the foundation underlying the expansion of both Local Networks & the Internet in today’s world.
  • Subnetting has become essential knowledge for the Administrator of any network.
  • There are 2 fundamental reasons why subnetting has so much importance in today’s networking environment:
    • The world is running out of available IP addresses. Subnetting helps allocate the IP addresses efficiently.
    • Subnetting reduces the size of the routing tables stored in routers. Subnetting hides the internal network organization to external routers and thus simples routing.
    • There are only 3 usable IP address classes:
    • Class A
    • Class B
    • Class C
  • Class A networks have the highest number of available hosts.
  • Class C networks have the fewest number of hosts.

Subnetting Networks ID

A 3-step example of how the default Class A subnet mask is applied to a Class A address:

subnetting networkid.PNG

  • Default Class A subnet mask (255.0.0.0) is AND operation with the Class A address (123.123.123.1) using Boolean Algebra, which results in the Network ID (123.0.0.0) being revealed.
  • The default Class B subnet mask (255.255.0.0) strips out the 16-bit network ID & the default Class C subnet mask (255.255.255.0) strips out the 24-bit network ID.

Subnetting, Subnet, Subnet Mask

  • Subnetting, a subnet & a subnet mask are all different.
  • Subnetting is the process of dividing a network & its IP addresses into segments, each of which is called a subnetwork or subnet.
  • The subnet mask is the 32-bit number that the router uses to cover up the network address to show which bits are being used to identify the subnet.

Subnetting

  • A network has its own unique address, such as a Class B network with the address 152.20.0.0 which has all zeroes in the host portion of the address.
  • From the basic definitions of a Class B network & the default Class B subnet mask, you know that this network can be created as a single network that contains 65,534 individual hosts.
  • Subnetting does not improve the available shared bandwidth. But, it cuts down on the amount of broadcast traffic generated over the entire network as well.

Benefits of Subnetting

  • Reduced network traffic:

One network will not access the data of other network without the use of router. Thus we can reduce the amount of data remain in one network.

  • It provides security:

In larger companies, employees must be able to communicate with other employees from that department. Subnetting allows for the department to have its own subnetwork.

  • It allows organizing resources:

A company can have several departments or types of resources: sales, customer care, IT, executive, research.With subnetting, these resources can be organized within the larger network.

  • Example of subnetting: when the network administrator divides the 152.20.0.0 network into 5 smaller networks –152.20.1.0, 152.20.2.0, 152.20.3.0, 152.20.4.0 & 152.20.5.0 – the outside world 152.20.4.0 & 152.20.5.0 – the outside world stills sees the network as 152.20.0.0, but the internal routers now break the network addressing into the 5 smaller subnetworks.
  • In the example, only a single network address is used to reference the network & instead of 5 network addresses, only one network reference is included in the routing tables of routers on other networks.
  • The key concept in subnetting is borrowing bits from the host portion of the network to create a subnetwork.
  • Rules govern this borrowing, ensuring that some bits are left for a Host ID.
  • The rules require that two bits remain available to use for the Host ID & that all of the subnet bits cannot be all 1s or 0s at the same time.
  • For each IP address class, only a certain number of bits can be borrowed from the host portion for use in the subnet mask.

bitsavailable.PNG

  • To subnet a Class A network, you need to borrow a sufficient number of bits from the 24-bit host portion of the mask to allow for the number of subnets you plan to create, now & in the future.
  • A sample of subnet mask options available for Class A addresses.

class asubnet mask

  • All subnet masks contain 32 bits; no more, no less.However a subnet mask cannot filter more than 30 bits. This means 2 things:
  1. Two, that there must always be at least 2 bits available for the Host ID.
  2. One, that there cannot be more than 30 ones bits in the subnet mask.
  • Remember that the addresses with all ones (broadcast address) & all zeroes (local network) cannot be used as they have special meanings.
  • The table “Class A Subnet Masks” is similar to the tables used for Class B & Class C IP addresses & subnet masks. The only differences are that you have fewer options (due to a fewer number of bits available).
  • A sample of the subnet masks available for Class B.

class b subnet mask

  • A list of the subnet masks available for Class C.

class c subnet mask

  • To determine the number of subnets & hosts per subnet available for any of the available subnet masks, 2 simple formulas to calculate these numbers:

numberofsubnets2

numberofsubnets1

Short Broadcast

  • A broadcast is a message that every node on a network or subnetwork receives & examines.
  • Cisco IOS supports 2 different types of broadcast messages:
  1. Flooded
  2. Directed
  • Generally speaking, routers do not propagate broadcasts, which is one of the benefits of installing a router in the first place.
  • Flooded broadcasts (those with the nominal broadcast address of 255.255.255.255) are not forwarded by the router & are considered local traffic only.
  • Directed broadcasts, which contain all 1’s in the Host portion of the IP address, are addressed to a specific subnetwork & are allowed to pass.

In next post I will discuss on exercise regrading to IP addresses.

 

 

 

 

How to Setup the Environments with OpenCV 3 and C++ Using Windows 10 + Visual Studio 2015 (Enterprise Edition) + precompiled binaries

Note: Bold indicates something that will change depending on your version of OpenCV and/or Visual Studio

Capture1.PNG

  1. Though I am using Visual Studio 2015 Enterprise edition you need license for use that version. So if you did not have license Visual Studio Product you can use Visual Studio Community edition. Download and install Visual Studio 2015 Community Edition latest version using Here (yes, it’s free, and choosing all default options will work fine)
  2. Download the latest version of OpenCV Here, for example OpenCV 3.1.0 use by me on future development examples.
  3. Make a folder “C:\OpenCV-X.X.X” for your version of OpenCV, ex. “C:\OpenCV-3.1.0“. ) Double-click on the completed OpenCV download executable, then set “Extract to:” to your “C:\OpenCVX.X.X” directory.
  4. Add the bin directory for your version of OpenCV and Visual Studio to the operating system PATH.
  5. Note: In the OpenCV directories: For example if you are using OpenCV 3.1.0 and Visual Studio 2015 add the following to your PATH:
  6. C:\OpenCV-3.1.0\opencv\build\x64\vc14\bin
  7. Pull up a Command Prompt and verify the bin directory is now in PATH, then reboot.

Capture2.PNG

That is basic for setup the environment and you will be able to learn Create project and make configurations on it, basic image processing techniques example using OpenCV on future post.

 

Introduction to working with IP Addresses

Probably work with decimal numbers much easier than with the binary numbers needed by the computer. Working with binary numbers is time-consuming & error-prone.

The 32-bit IP address is broken up into 4 octets, which are arranged into a dotted-decimal notation scheme. An octet is a set of 8 bits.

The binary system uses only 2 values “0 & 1” to represent numbers in positions representing increasing powers of 2.We all are accustomed to thinking & working in the decimal system, which is based on the number 10.

What then do you suppose is the largest decimal number that can be expressed in an octet?

11111111 (Eight 1’s)

  • Converting to decimal

The largest decimal number that can be stored in an IP address octet is 255.

  • IP Address Classes

IP addresses are divided into 5 classes, each of which is designated with the alphabetic letters A to E. Class D addresses are used for multi casting. Class E addresses are reserved for testing & some mysterious future use.

Using the ranges, you can determine the class of an address from its 1st octet value. An address beginning with 120 is a Class A address, 155 is a Class B address & 220 is a Class C address.

addressclasses.PNG

Each Network is assigned a network address & every device or interface (such as a router port) on the network is assigned a host address. There are only 2 specific rules that govern the value of the address.

A host address cannot be designated by all zeros or all ones. These are special addresses that are reserved for special purposes.

Class A Addresses

  • Class A IP addresses use the 1st8 bits (1st Octet) to designate the Network ID.
  • The 1stbit which is always a 0, is used to indicate the address as a Class A address & the remaining 7 bits are used to designate the Network.
  • The other 3 octets contain the Host ID.
  • There are 128 Class A Network Addresses, but because addresses with all zeros aren’t used & address 127 is a special purpose address, 126 Class A Networks are available.
  • There are 16,777,214 Host addresses available in a Class A address.
  • The following formula to compute the number of hosts available in any of the class addresses, where “n” represents the number of bits in the host portion.

equation1.PNG

Half of all IP addresses are Class A addresses. You can use the same formula to determine the number of Networks in an address class.

Class A address uses 7 bits to designate the network, so (27– 2) = 126 or there can be 126 Class A Networks.

Class B IP Addresses

  • Class B addresses use the 1st16 bits (two octets) for the Network ID.
  • The last 2 octets are used for the Host ID.
  • The 1st2 bit, which are always 10, designate the address as a Class B address & 14 bits are used to designate the Network. This leaves 16 bits (two octets) to designate the Hosts.
  • There can be 16,382 Class B Networks & each Network can have 65,534 Hosts.

Class C IP Addresses

  • Class C addresses use the 1st 24 bits (three octets) for the Network ID & only the last octet for Host ID.
  • The 1st 3 bits of all class C addresses are set to 110, leaving 21 bits for the Network ID, which means there can be 2,097,150Class C Networks, but only 254 Hosts per Network.

characteristics.PNG

Special Addresses

  • A few addresses are set aside for specific purposes.
  • Network addresses that are all binary zeros, all binary ones & Network addresses beginning with 127 are special Network addresses.

specialip.PNG

In next I hope to discuss further more about IP Addresses.

 

OSI Layer Model

  • Open System Interconnection (OSI) model is a conceptual model that covers all aspects of network communications.
  • This model characterizes and standardizes the internal functions of a communications system by partitioning it into abstraction layers.
  • This is a model that allows any two different systems to communicate regardless of their underlying architecture (hardware or software).

Benefits of OSI Model

  • Reduces complexity.
  • Standardizes interfaces.
  • Facilitate modular engineering.
  • Ensure interoperable technology.
  • Simplify teaching and learning.

osimodel

Physical Layer
The physical layer coordinates the functions required to transmit a bit stream over a physical medium. It also defines the procedures and functions that physical devices and interfaces have to perform for transmission occur. The physical layer is responsible for transmitting individual bits from one node to the next.

Data Link Layer
Provides connectivity and path selection between two hosts. The data link layer is responsible for transmitting frames from one node to the next.

Network Layer
Provide Reliable Transfer of data across media. The network layer is responsible for the delivery of packets from the original source to the final destination.

Transport Layer
Concerned with Transportation issues between hosts. Establish. Maintain, terminate virtual circuits. The transport layer is responsible for delivery of a message from one process to another.

 

Session Layer
Establishes, manages and terminates sessions between applications.
Presentation Layer
Ensure data is readable by receiving system. Consider about format of data and structure of data.
Application Layer
Provides network services to application processes. The application layer is responsible for providing services to the user.

Bandwidth

In computer networks, bandwidth is often used as a synonym for data transfer rate – the amount of data that can be carried from one point to another in a given time period (usually a second).

Important of bandwidth

  • Bandwidth is limited by physics and technology.
  • Bandwidth is not free.
  • Bandwidth requirements are growing at a rapid rate.
  • Bandwidth is critical for network performance.

Network Layer

The Network layer is responsible for the source-to-destination delivery of a packet possible across multiple networks. If two systems are connected to the same link, there is usually no need for a network layer. However, if the two systems are attached to different networks, there is often a need for the network layer to accomplish source-to-destination delivery.

Main Network Hardware Components

  • Hub– electronic device (with a number of ports) used in a LAN to link groups of computers.
  • Repeaters (also called amplifiers) – electronic devices that receive signals and amplify and send them along the network.
  • Routers – electronic devices used to ensure messages are sent to their intended destinations.
  • Gateway– consists of hardware and/or software that allows communications between dissimilar networks.
  • Bridge– consists of hardware and/or software that allows communication between two similar networks.

Why used Interconnect?

  • To connect two LANs with different protocols.
  • To connect a LAN to the Internet.
  • To break a LAN into segments to relieve traffic congestion.
  • To provide a security wall between two different types of users.
  • To connect WLAN to LAN
  • Remote Access.

Interconnection within similar networks or dissimilar networks done via different devices

  1. Computers within a LAN are often connected using a hub.
  2. LAN to LAN connections are often performed with a bridge.
  3. Segments of a LAN are usually connected using a switch.
  4. LAN to WAN connections are usually performed with a router.

Networks are usually classified using three properties:

  • Topology
  • Protocol
  • Architecture
  • Topology

Refers to the way computers and peripherals are configured to form networks. There are several topologies use in networking.

Star Topology

The star topology is a popular method of connecting the cabling in a computer network. In a star, each device connects to a central point via a point-to point link.

star

Ring Topology

The Ring Topology is a physical, closed loop consisting of point-to-point links. It receives a transmission from the previous node and amplifies it before passing it on.

ring

Bus Topology

In a Bus topology, all devices attach to the same transmission medium. The medium has a physical beginning and end. All buses are implemented using electrical cable, usually coax, and the ends of the cable must be terminated with a terminating resistor that matches the impedance of the cable. The bus is considered a multipoint system because all devices tap into the same backbone cable.

hybrid

Hybrid Topology

The Hybrid topology scheme combines multiple topologies into one large topology. The hybrid network is common in large wide area networks.

hybrd

Protocol

A protocol is simply an agreed-on set of rules and procedures for transmitting data between two or more devices.

Architecture

Network architecture refers to the way a network is designed and built. There are two major types.

  • Peer-to-peer architecture– Computers connect with each other in a workgroup to share files, printers, and Internet access. This is used to connect a small number of computers.
  • Client/server architecture– sends information from a client computer to a server, which then relays the information back to the client computer, or to other computers on the network.

 

Introduction to Computer Networking

This is the start of computer network post series. In this post I would like to make introduction about computer network. In my undergraduate degree program currently in level two as a subject I am studying computer network.
First what is computer network? We can consider computer network as” Computer network is a collection of computers & devices connected by communication channels that facilitate communication among the users and allow users to share resources with other users.
But remember” A single computer system with its peripherals such as printers, scanners etc. is not considered as a network”.

There are lot of advantages in computer networks. Some of them are,

  • Accessing databases, transferring, processing and retrieval of data can be done on-line
  • Online credit card checking, e-commerce and Electronic Fund Transfer are possible
  • Easily administered
  • Provides an efficient means of communication such as e-mail, Voice mail, and Video conferencing.
  • Users can be easily added or removed.
  • Tasks of distributed nature can be processed by distributed computer systems by exchanging data.
  • Provides a way to share data, programs, peripherals, computing power and information.
  • Provides data security (Comparing to other communication devices).

The major issue regarding to computer network is the security of a computer network is challenged everyday by equipment malfunctions, system failures, computer hackers, virus attacks.

Network types

There are two major types,

  • Local Area Network (LAN)
  • Wide Area Network (WAN)

Local Area Network (LAN)

A Local Area Network spans a relatively small area. They are usually confined to one building or a group of buildings. Usually privately owned and provides high data rates. The most common type of Local Area Network is called Ethernet.

Wide Area Network (WAN)

A network which covers a very large geographical area such as a country, continent or even the whole world. Provides long distance communication of data or information. Also operating at low speeds (compare to LANs).

There are several types of WANs,

  • Metropolitan area network (MAN)
  • Public access network (PAN)
  • Value added network (VAN)
  • Virtual private network (VPN)

Metropolitan area network (MAN)

A network which covers medium geographical area such as a town or a city. Provides high speed connectivity for Internet through DSL / ADSL lines and other services such as cable TV.

Capture1

Virtual private network (VPN)

Virtual private network is a network that uses a public telecommunication infrastructure, such as the Internet, to provide remote offices or individual users with access to their organization’s network.

VPN became popular as more employees worked in remote locations. Employees can access the network (Intranet) from remote locations. The Internet is used as the backbone for VPNs. Secured networks. These systems use encryption and other security mechanisms to ensure that only authorized users can access the network and that the data cannot be intercepted.

Capture3

Storage Area Network (SAN)

A Storage Area Network (SAN) is a high-speed special-purpose network (or subnetwork) that interconnects different kinds of data storage devices with associated data servers. Storage is accessed at block level not at file level. In this network simplifies storage administration, high scalability and high performance are some benefits.

Capture3

Controller Area Network (CAN)

 

Controller Area Network is a serial bus network of microcontrollers that connects devices, sensors and actuators in a system or sub-system for real-time control applications. It is a dedicated development of the automotive electronics industry.

In next post I will hope to talk more about computer Network.