Choosing between MySQL vs PostgreSQL vs SQL Server

posted on June 5, 2021

tags:

The choice between SQL and non-SQL databases usually boils down to differences in the structure. However, when we are looking into several SQL solutions, the criteria are a lot more distorted. Now will consider the aspects more precisely and analyze the underlying functionality. We’ll be taking a look at the three most popular relational databases: MySQL vs Postgresql vs SQL server.

To help you, we have collected advice from our database developers, re-went through manuals, and even looked up official in-depth guides. We do tend to have our personal preferences, but in this guide, we will put them aside in favor of objective comparison.

stackoverflow questions

MySQL

MySQL happens to be one of the most popular databases, according to DB Engines Ranking. It’s a definite leader among SQL solutions, used by Google, LinkedIn, Amazon, Netflix, Twitter, and others. MySQL popularity has been growing a lot because teams increasingly prefer open-source solutions instead of commercial ones.

Price: the database solution is developed by Oracle and has additional paid tools; the core functionality can be accessed for free.

Language: MySQL is written in C++; database management is done with Structured Query Language.

?

Read our comparison of MongoDB vs MySQL to make the right choice of a database solution.

PostgreSQL

A tried-and-proven relational database that is known for supporting a lot of data types, intuitive storage of schemaless data, and rich functionality. Some developers go even as far as to claim that it’s the most advanced open-source database on the market. We wouldn’t go that far, but it’s definitely a highly universal solution.

Price: open-source

Language: C

SQL Server

Unlike Postgresql vs MySQL, SQL Server is a commercial solution. It’s preferred by companies who are dealing with large traffic workloads on a regular basis. It’s also considered to be one of the most compatible systems with Windows services.

The SQL Server infrastructure includes a lot of additional tools, like reporting services, integration systems, and analytics. For companies that manage multiple teams, these tools make a big difference in day-to-day work.

Price: the database has a free edition for developers and small businesses but only supports 1 processor, 1GB of maximum memory used by the database engine and 10GB maximum database size.

. For a server, users need to pay $931.

Side-by-side Comparison of SQL Tools

In this comparison, we’ll take a look at the functionality of the three most popular SQL databases, examine their use cases, respective advantages, and disadvantages. Firstly, we’ll start by exploring the in-depth functionality.

Data Changes

Here we evaluate the ease that the data can be modified with and the database defragmented. The key priority is the systems’ flexibility, security, and usability.

Row updates

This criterion refers to the algorithms that a database uses to update its contents, speed, and efficiency.

In the MySQL case, a solution updates data automatically to the rollback storage. If something goes wrong, developers can always go back to the previous version.

PostgreSQL: developers insert a new column and row in order to update the database. All updated rows have unique IDs. This multiplies the number of columns and rows and increases the size of the database, but in turn, developers benefit from higher readability.

SQL Server: the database has three engines that are responsible for row updates. The ROW Store handles the information on all previous row updates, IDs, and modified content. The in-memory engine allows analyzing the quality of an updated database with a garbage collector. The column-store database lets store updates in columns, like in column-driven databases.

sql server

Among these three, SQL Server offers perhaps the most flexibility and efficiency, because it allows monitoring updated rows and columns, collecting errors, and automating the process. The difference between SQL Server and MySQL and Postgresql lies mainly in customizing the positions – SQL Server offers a lot more than others.

Defragmentation

When developers update different parts of an SQL database, the changes occur at different points of the systems and can be hard to read, track, and manage. Therefore, maintenance should include defragmentation – the process of unifying the updated database by assigning indexes, revisiting the structure, and creating new pages. The database frees up the disk space that is not used properly so that a database can run faster.

MySQL offers several approaches to defragmentation – during backup, index creation, and with an OPTIMIZE Table command. Without going into much detail, we’ll just say that having that many options for table maintenance is convenient for developers, and it surely saves a lot of time.

PostgreSQL allows scanning the entire tables of a data layer to find empty rows and delete the unnecessary elements. By doing so, the system frees up the disk space. However, the method requires a lot of CPU and can affect the application’s performance.

fragmentation

SQL Server offers an efficient garbage collector that doesn’t create more than 15-20% of overhead. Technically, developers can even run garbage collector on a continuous basis, because it’s that efficient.

Overall, MySQL and SQL Server offer more of defragmentation methods that Postgresql does. They consume less CPU and provide more flexible settings.

Data Queries

Here, we take a look at how the systems cache and process user requests, what approaches they take in storing data, and how developers can manage it.

Buffer Pool

Some systems call a buffer to pull cache, but regardless of terminology, our goal is to summarize the algorithms that systems use to process user queries and maintain connections.

MySQL offers a scalable buffer pool – developers can set up the size of the cache according to the workload. If the goal is to save CPU and storage space, developers can put strict benchmarks on their buffer pool. Moreover, MySQL allows dividing cache by segments to store different data types and maximize isolation.

PostgreSQL isolates processes even further than MySQL by treating them as a separate OS process. Each database has a separate memory and runs its own process. On the one hand, management and monitoring become a lot easier, but on the other, scaling multiple databases takes a lot of time and computing resources.

SQL Server also uses a buffer pool, and just like in MySQL, it can be limited or increased according to processing needs. All the work is done in a single pool, with no multiple pages, like in Postgresql.

If your priority is to save computing resources and storage, choose flexible solutions: the choice will be between MySQL vs SQL Server. However, if you prefer clear organization and long-term order, Postgre, with its isolated approach, might be a better fit.

Temporary Tables

Temporary tables allow storing intermediate results from complex procedures and branched business logic. If you need some information only to power the next process, it doesn’t make sense to store it in a regular table. Temporary tables improve database performance and organization by separating intermediary data from the essential information.

tables

MySQL offers limited functionality for temporary tables. Developers cannot set variables or create global templates. The software even limits the number of times that a temporary table can be referred to – not more than once.

Postgresql offers a lot more functionality when it comes to temporary content. You divide temporary tables into local and global and configure them with flexible variables.

SQL Server also offers rich functionality for temporary table management. You can create local and global temporary tables, as well as oversee and create variables.

Temporary tables are essential for applications with complicated business logic. If your software runs a lot of complex processes, you will need to store multiple intermediary results. Having rich customization functionality will often be necessary throughout the development process.

Indexes

The way a database handles indexes is essential because they are used to locate data without searching for a particular row. Indexes can refer to multiple rows and columns. You can assign the same index to files, located in the different places in the database, and collect all these pieces with a single search.

tables indexes

In this comparison, we evaluated the way indexes are created in every solution, the support of multiple-index searches, and multi-column indexes, as well as partial ones.

MySQL organized indexes in tables and clusters. Developers can automatically locate and update indexes in their databases. The search isn’t highly flexible – you can’t search for multiple indexes in a single query. MySQL supports multi-column indexes, allowing adding up to 16 columns.

Postgresql also supports index-based table organization, but the early versions don’t include automated index updates (which appear only after the 11th edition release). The solution also allows looking up many indexes in a single search, which means that you can find a lot of information. The multi-column settings are also more flexible than in MySQL – developers can include up to 32 columns.

SQL Server offers rich automated functionality for index management. They can organize in clusters and maintain the correct row order without manual involvement. The solution also supports multiple-index searches and partial indexes.

Having flexible index settings allows looking up information faster and organizing multiple data simultaneously.

Memory-Optimized Tables

Memory-optimized tables are mainly known as a SQL Server concept, but they also exist in other database management solutions. Such a table is stored in active memory and on the disk space in a simplified way. To increase the transaction speed, the application can simply access data directly on the disk, without blocking concurrent transactions. For processes that happen on a regular basis and usually require a lot of time, a memory-optimized table can be a solution to improve database performance.

Memory-optimized tables

MySQL supports the memory-stored table, but it can’t participate in transactions, and its security is highly vulnerable. Such tables are used only for reading purposes and can simplify exclusively primitive operations. For now, MySQL doesn’t come close to making the most out of memory-optimized tables.

PostgreSQL doesn’t support in-memory database creation.

SQL Server uses an optimistic strategy to handle memory-optimized tables, which means they can participate in transactions along with ordinary tables. Memory-based transactions are faster than regular ones, and this allows a drastic increase in application speed.

As expected, memory-optimized tables are best set up in MySQL – it’s basically their native approach. It’s not an essential database feature, but still, a good way to improve performance.

JSON Support

The use of JSON files allows developers to store non-numeric data and achieve faster performance. JSON documents don’t have to be parsed, which contributes to much higher processing speed. They are easily readable and accessible, which is why JSON support simplifies maintenance. JSON files are mostly used in non-relational databases, but lately, SQL solutions have supported this format as well.

MySQL supports JSON files but doesn’t allow indexing them. Overall, the functionality for JSON files in MySQL is very limited, and developers mostly prefer using classical strings. Similarly to non-relational databases, MySQL also allows working with geospatial data, although handling it isn’t quite as intuitive.

Postgresql supports JSON files, as well as their indexing and partial updates. The database supports even more additional data than MySQL. Users can upload user-defined types, geospatial data, create multi-dimensional arrays, and a lot more.

SQL Server also provides full support of JSON documents, their updates, functionality, and maintenance. It has a lot of additional features for GPS data, user-defined types, hierarchical information, etc.

Overall, all three solutions are pretty universal and offer a lot of functionality for non-standard data types. MySQL, however, puts multiple limitations for JSON files, but other than that, it’s highly compatible with advanced data.

Replication and Sharding

When the application grows, a single server can no longer accommodate all the workload. Navigating single storage becomes complicated, and developers prefer to migrate to different ones or, at least, create partitions. The process of partitioning is the creation of many compartments for data in the single process.

Replication

Partitioning

Replacing is easier in NoSQL databases because they support horizontal scaling rather than vertical – increasing the number of locations rather than the size of a single one. Still, it’s possible to distribute data among different compartments even in SQL solutions, even if it’s slightly less efficient.

MySQL allows partitioning databases with hashing functions in order to distribute data among several nodes. Developers can generate a specific partition key that will define the data location. Hashing permits avoiding bottlenecks and simplifying maintenance.

Postgresql allows making LIST and RANGE partitions where the index of a partition is created manually. Developers need to identify children and parent column before assigning a partition for them.

SQL Server also provides access to RANGE partitioning, where the partition is assigned to all values that fall into a particular range. If the data lies within the threshold, it will be moved to the partition.

Ecosystem

The database ecosystem is important because it defines the frequency of updates, the availability of learning resources, the demand on the market, and the tool’s long-term legacy.

MySQL Ecosystem

MySQL Ecosystem

MySQL is a part of the Oracle ecosystem. It’s the biggest SQL database on the market with a large open-source community. Developers can either purchase commercial add-ons, developed by the Oracle team or use freeware installations. You will easily find tools for database management, monitoring, optimization, and learning. The database itself is easy to install – all you have to do is pretty much download the installer.

MySQL has been a reliable database solution for 25 years, and statistics don’t pinpoint at any sights of its decline. It looks like MySQL will keep holding a leading position not only among SQL tools but also among all the databases in general.

Postgresql Ecosystem

Postgresql Ecosystem

The Postgresql community offers a lot of tools for software scaling and optimization. You can find add-ons by your industry – take a look at the full list on the official page. The integrations allow developers to perform clustering, integrating AI, collaborating, tracking issues, improving object mapping, and cover many other essential features.

Some developers point out that Postgresql’s installation process is slightly complicated – you can take a look at its official tutorial. Unlike MySQL, which can run right away, Postgresql requires additional installations.

SQL Server Ecosystem

SQL Server Ecosystem

SQL Server is highly compatible with Windows and all Microsoft OS and tools. If you are working with Windows, SQL server is definitely the best option on the market. Users of the database receive access to many additional instruments that cover server monitoring (Navicat Monitor), data analysis, parsing (SQL Parser), and safety management software (DBHawk).

SQL Server ecosystem is oriented towards large infrastructures. It’s more expensive than open-source competitors, but at the end of the day, users get access to frequently updated official ecosystem and active customer support.

What is the difference between SQL and MySQL? MySQL is an open-source database, whereas SQL Server is a commercial one. MySQL is more popular, but SQL Server comes close.

Popularity

For a start, we analyzed the DB Engines ratings of every compared engine. The leader is MySQL, with second place as the most popular database and second most popular relational solution. SQL Server takes third place, while PostgreSQL is ranked fourth.

The statistics by Statista shows the same tendency. MySQL is ranked second, leaving the leading position to Oracle, the most popular DBMS today. SQL Server follows with a slim difference, whereas Postgresql, which comes right after, is a lot less recognized.

databases popularity

MySQL, therefore, is the most demanded database on the market, which means finding competent teams, learning resources, reusable libraries, and ready add-ons will be easy. So, if you are choosing between SQL Server vs MySQL in terms of market trends, the latter is a better choice.

Companies using MySQL

  • Google
  • Udemy
  • Netflix
  • Airbnb
  • Amazon
  • Pinterest

MySQL is used widely by big corporations and governmental organizations. Over the last 25 years, the solution has built a reputation of a reliable database management solution, and as time shows, it’s indeed capable of supporting long-running projects.

Companies that use PostgreSQL

  • Apple
  • Skype
  • Cisco
  • Etsy

Postgre is known for its intuitive functionality and versatile security settings. This is why its main use cases are governmental platforms, messenger applications, video chats, and e-commerce platforms.

Companies using SQL Server

  • JPMorganChase
  • Bank of America
  • UPS
  • Houston Methodist

SQL Server is a go-to choice for large enterprises that have vast business logic and handle multiple applications simultaneously. Teams that prioritize efficiency and reliability over scalability and costs typically choose this database. It’s a common option for “traditional” industries – finances, security, manufacturing, and others.

MySQL vs PostgreSQL vs SQL Server infographic

Conclusion

The choice between the three most popular databases ultimately boils down to the comparison of the functionality, use cases, and ecosystems. Companies that prioritize flexibility, cost-efficiency, and innovation usually choose open-source solutions. They can be integrated with multiple free add-ons, have active user communities, and are continuously updated.

For corporations that prefer traditional commercial solutions, software like SQL Server backed up by a big corporation and compatible with an extensive infrastructure, is a better bet. They have access to constant technical support, personalized assistance, and professional management tools.

If you are considering a database for your project, getting a team of experts who will help you define the criteria and narrow down the options is probably the best idea. You can always get in touch with our database developers – we will create a tech stack for your product and share our development experience.

IPv6 Basics

posted on May 24, 2021

tags:

Internet Protocol version 6, is a new addressing protocol designed to incorporate whole sort of requirement of future internet known to us as Internet version 2. This protocol as its predecessor IPv4, works on Network Layer (Layer-3). Along with its offering of enormous amount of logical address space, this protocol has ample of features which addresses today’s shortcoming of IPv4.

Why new IP version?

So far, IPv4 has proven itself as a robust routable addressing protocol and has served human being for decades on its best-effort-delivery mechanism. It was designed in early 80’s and did not get any major change afterward. At the time of its birth, Internet was limited only to a few Universities for their research and to Department of Defense. IPv4 is 32 bits long which offers around 4,294,967,296 (232) addresses. This address space was considered more than enough that time. Given below are major points which played key role in birth of IPv6:

  • Internet has grown exponentially and the address space allowed by IPv4 is saturating. There is a requirement of protocol which can satisfy the need of future Internet addresses which are expected to grow in an unexpected manner.

  • Using features such as NAT, has made the Internet discontiguous i.e. one part which belongs to intranet, primarily uses private IP addresses; which has to go through number of mechanism to reach the other part, the Internet, which is on public IP addresses.

  • IPv4 on its own does not provide any security feature which is vulnerable as data on Internet, which is a public domain, is never safe. Data has to be encrypted with some other security application before being sent on Internet.

  • Data prioritization in IPv4 is not up to date. Though IPv4 has few bits reserved for Type of Service or Quality of Service, but they do not provide much functionality.

  • IPv4 enabled clients can be configured manually or they need some address configuration mechanism. There exists no technique which can configure a device to have globally unique IP address.

Why not IPv5?

Till date, Internet Protocol has been recognized has IPv4 only. Version 0 to 3 were used while the protocol was itself under development and experimental process. So, we can assume lots of background activities remain active before putting a protocol into production. Similarly, protocol version 5 was used while experimenting with stream protocol for internet. It is known to us as Internet Stream Protocol which used Internet Protocol number 5 to encapsulate its datagram. Though it was never brought into public use, but it was already used.

Here is a table of IP version and their use:

IPv6 Version Table

Brief History

After IPv4’s development in early 80s, the available IPv4 address pool begun to shrink rapidly as the demand of addresses exponentially increased with Internet. Taking pre-cognizance of situation that might arise IETF, in 1994, initiated the development of an addressing protocol to replace IPv4. The progress of IPv6 can be tracked by means of RFC published:

  • 1998 – RFC 2460 – Basic Protocol

  • 2003 – RFC 2553 – Basic Socket API

  • 2003 – RFC 3315 – DHCPv6

  • 2004 – RFC 3775 – Mobile IPv6

  • 2004 – RFC 3697 – Flow Label Specification

  • 2006 – RFC 4291 – Address architecture (revision)

  • 2006 – RFC 4294 – Node requirement

June 06, 2012 some of Internet giants chose to put their Servers on IPv6. Presently they are using Dual Stack mechanism to implement IPv6 parallel with IPv4.

Features

The successor of IPv4 is not designed to be backward compatible. Trying to keep the basic functionalities of IP addressing, IPv6 is redesigned entirely. It offers the following features:

  • Larger Address Space:

    In contrast to IPv4, IPv6 uses 4 times more bits to address a device on the Internet. This much of extra bits can provide approximately 3.4×1038 different combinations of addresses. This address can accumulate the aggressive requirement of address allotment for almost everything in this world. According to an estimate, 1564 addresses can be allocated to every square meter of this earth.

  • Simplified Header:

    IPv6’s header has been simplified by moving all unnecessary information and options (which are present in IPv4 header) to the end of the IPv6 header. IPv6 header is only twice as bigger than IPv4 providing the fact the IPv6 address is four times longer.

  • End-to-end Connectivity:

    Every system now has unique IP address and can traverse through the internet without using NAT or other translating components. After IPv6 is fully implemented, every host can directly reach other host on the Internet, with some limitations involved like Firewall, Organization’s policies, etc.

  • Auto-configuration:

    IPv6 supports both stateful and stateless auto configuration mode of its host devices. This way absence of a DHCP server does not put halt on inter segment communication.

  • Faster Forwarding/Routing:

    Simplified header puts all unnecessary information at the end of the header. All information in first part of the header are adequate for a Router to take routing decision thus making routing decision as quickly as looking at the mandatory header.

  • IPSec:

    Initially it was decided for IPv6 to must have IPSec security, making it more secure than IPv4. This feature has now been made optional.

  • No Broadcast:

    Though Ethernet/Token Ring are considered as broadcast network because they support Broadcasting, IPv6 does not have any Broadcast support anymore left with it. It uses multicast to communicate with multiple hosts.

  • Anycast Support:

    This is another characteristic of IPv6. IPv6 has introduced Anycast mode of packet routing. In this mode, multiple interfaces over the Internet are assigned same Anycast IP address. Routers, while routing, sends the packet to the nearest destination.

  • Mobility:

    IPv6 was designed keeping mobility feature in mind. This feature enables hosts (such as mobile phone) to roam around in different geographical area and remain connected with same IP address. IPv6 mobility feature takes advantage of auto IP configuration and Extension headers.

  • Enhanced Priority support:

    Where IPv4 used 6 bits DSCP (Differential Service Code Point) and 2 bits ECN (Explicit Congestion Notification) to provide Quality of Service but it could only be used if the end-to-end devices support it, that is, the source and destination device and underlying network must support it.

    In IPv6, Traffic class and Flow label are used to tell underlying routers how to efficiently process the packet and route it.

  • Smooth Transition:

    Large IP address scheme in IPv6 enables to allocate devices with globally unique IP addresses. This assures that mechanism to save IP addresses such as NAT is not required. So devices can send/receive data between each other, for example VoIP and/or any streaming media can be used much efficiently.

    Other fact is, the header is less loaded so routers can make forwarding decision and forward them as quickly as they arrive.

  • Extensibility:

    One of the major advantage of IPv6 header is that it is extensible to add more information in the option part. IPv4 provides only 40-bytes for options whereas options in IPv6 can be as much as the size of IPv6 packet itself.

Addressing Modes

In computer networking, addressing mode refers to the mechanism how we address a host on the network. IPv6 offers several types of modes by which a single host can be addressed, more than one host can be addressed at once or the host at closest distance can be addressed.

Unicast

In unicast mode of addressing, an IPv6 interface (host) is uniquely identified in a network segment. The IPv6 packet contains both source and destination IP addresses. A host interface is equipped with an IP address which is unique in that network segment. A network switch or router when receives a unicast IP packet, destined to single host, sends out to one of its outgoing interface which connects to that particular host.

Multicast

The IPv6 multicast mode is same as that of IPv4. The packet destined to multiple hosts is sent on a special multicast address. All hosts interested in that multicast information, need to join that multicast group first. All interfaces which have joined the group receive the multicast packet and process it, while other hosts not interested in multicast packets ignore the multicast information.

Anycast

IPv6 has introduced a new type of addressing, which is called Anycast addressing. In this addressing mode, multiple interfaces (hosts) are assigned same Anycast IP address. When a host wishes to communicate with a host equipped with an Anycast IP address, sends a Unicast message. With the help of complex routing mechanism, that Unicast message is delivered to the host closest to the Sender, in terms of Routing cost.

Let’s take an example of TutorialPoints.com Web Servers, located in all continents. Assume that all Web Servers are assigned single IPv6 Anycast IP Address. Now when a user from Europe wants to reach TutorialsPoint.com the DNS points to the server which is physically located in Europe itself. If a user from India tries to reach Tutorialspoint.com, the DNS will then point to Web Server physically located in Asia only. Nearest or Closest terms are used in terms of Routing Cost.

In the above picture, When a client computer tries to reach a Server, the request is forwarded to the Server with lowest Routing Cost.

Address Types

Hexadecimal Number System

Before introducing IPv6 Address format, we shall look into Hexadecimal Number System. Hexadecimal is positional number system which uses radix (base) of 16. To represent the values in readable format, this system uses 0-9 symbols to represent values from zero to nine and A-F symbol to represent values from ten to fifteen. Every digit in Hexadecimal can represent values from 0 to 15.

Address Structure

An IPv6 address is made of 128 bits divided into eight 16-bits blocks. Each block is then converted into 4-digit Hexadecimal numbers separated by colon symbol.

 

For example, the below is 128 bit IPv6 address represented in binary format and divided into eight 16-bits blocks:

0010000000000001 0000000000000000 0011001000110100 1101111111100001 0000000001100011 0000000000000000 0000000000000000 1111111011111011

Each block is then converted into Hexadecimal and separated by ‘:’ symbol:

2001:0000:3238:DFE1:0063:0000:0000:FEFB

Even after converting into Hexadecimal format, IPv6 address remains long. IPv6 provides some rules to shorten the address. These rules are:

Rule:1 Discard leading Zero(es):

In Block 5, 0063, the leading two 0s can be omitted, such as (5th block):

2001:0000:3238:DFE1:63:0000:0000:FEFB

Rule:2 If two of more blocks contains consecutive zeroes, omit them all and replace with double colon sign ::, such as (6th and 7th block):

2001:0000:3238:DFE1:63::FEFB

Consecutive blocks of zeroes can be replaced only once by :: so if there are still blocks of zeroes in the address they can be shrink down to single zero, such as (2nd block):

2001:0:3238:DFE1:63::FEFB

Interface ID

IPv6 has three different type of Unicast Address scheme. The second half of the address (last 64 bits) is always used for Interface ID. MAC address of a system is composed of 48-bits and represented in Hexadecimal. MAC address is considered to be uniquely assigned worldwide. Interface ID takes advantage of this uniqueness of MAC addresses. A host can auto-configure its Interface ID by using IEEE’s Extended Unique Identifier (EUI-64) format. First, a Host divides its own MAC address into two 24-bits halves. Then 16-bit Hex value 0xFFFE is sandwiched into those two halves of MAC address, resulting in 64-bit Interface ID.

Global Unicast Address

This address type is equivalent to IPv4’s public address. Global Unicast addresses in IPv6 are globally identifiable and uniquely addressable.

Global Routing Prefix: The most significant 48-bits are designated as Global Routing Prefix which is assigned to specific Autonomous System. Three most significant bits of Global Routing Prefix is always set to 001.

Link-Local Address

Auto-configured IPv6 address is known as Link-Local address. This address always starts with FE80. First 16 bits of Link-Local address is always set to 1111 1110 1000 0000 (FE80). Next 48-bits are set to 0, thus:

Link-Local addresses are used for communication among IPv6 hosts on a link (broadcast segment) only. These addresses are not routable so a Router never forwards these addresses outside the link.

Unique-Local Address

This type of IPv6 address which is though globally unique, but it should be used in local communication. This address has second half of Interface ID and first half is divided among Prefix, Local Bit, Global ID and Subnet ID.

Prefix is always set to 1111 110. L bit, which is set to 1 if the address is locally assigned. So far the meaning of L bit to 0 is not defined. Therefore, Unique Local IPv6 address always starts with ‘FD’.

Scope of IPv6 Unicast Addresses:

The scope of Link-local address is limited to the segment. Unique Local Address are though locally global but are not routed over the Internet, limiting their scope to an organization’s boundary. Global Unicast addresses are globally unique and recognizable. They shall make the essence of Internet v2 addressing.

Special Addresses

Version 6 has slightly complex structure of IP address than that of IPv4. IPv6 has reserved few addresses and address notations for special purposes. See the table below:

Special Addresses:

  • As shown in the table above 0:0:0:0:0:0:0:0/128 address does not specify to anything and is said to be an unspecified address. After simplifying, all 0s are compacted to ::/128.

  • In IPv4, address 0.0.0.0 with netmask 0.0.0.0 represents default route. The same concept is also applie to IPv6, address 0:0:0:0:0:0:0:0 with netmask all 0s represents default route. After applying IPv6 simplying rule this address is compressed to ::/0.

  • Loopback addresses in IPv4 are represented by 127.0.0.1 to 127.255.255.255 series. But in IPv6, only 0:0:0:0:0:0:0:1/128 address represents Loopback address. After simplying loopback address, it can be represented as ::1/128.

Reserved Multicast Address for Routing Protocols:

  • The above table shows reserved multicast addresses used by interior routing protocol.

  • All addresses are reserved in similar IPv4 fashion

Reserved Multicast Address for Routers/Node:

  • These addresses helps routers and hosts to speak to available routers and hosts on a segment without being configured with an IPv6 address. Hosts use EUI-64 based auto-configuration to self-configure an IPv6 address and then speaks to available hosts/routers on the segment by means of these addresses.

Headers

The wonder of IPv6 lies in its header. IPv6 address is 4 times larger than IPv4 but the IPv6 header is only 2 times larger than that of IPv4. IPv6 headers have one Fixed Header and zero or more Optional (Extension) Headers. All necessary information which is essential for a router is kept in Fixed Header. Extension Header contains optional information which helps routers to understand how to handle a packet/flow.

Fixed Header

IPv6 fixed header is 40 bytes long and contains the following information.

S.N.Field & Description
1

Version (4-bits): This represents the version of Internet Protocol, i.e. 0110.

2

Traffic Class (8-bits): These 8 bits are divided into two parts. Most significant 6 bits are used for Type of Service, which tells the Router what services should be provided to this packet. Least significant 2 bits are used for Explicit Congestion Notification (ECN).

3

Flow Label (20-bits): This label is used to maintain the sequential flow of the packets belonging to a communication. The source labels the sequence which helps the router to identify that this packet belongs to a specific flow of information. This field helps to avoid re-ordering of data packets. It is designed for streaming/real-time media.

4

Payload Length (16-bits): This field is used to tell the routers how much information this packet contains in its payload. Payload is composed of Extension Headers and Upper Layer data. With 16 bits, up to 65535 bytes can be indicated but if Extension Headers contain Hop-by-Hop Extension Header than payload may exceed 65535 bytes and this field is set to 0.

5

Next Header (8-bits): This field is used to indicate either the type of Extension Header, or if Extension Header is not present then it indicates the Upper Layer PDU. The values for the type of Upper Layer PDU is same as IPv4’s.

6

Hop Limit (8-bits): This field is used to stop packet to loop in the network infinitely. This is same as TTL in IPv4. The value of Hop Limit field is decremented by 1 as it passes a link (router/hop). When the field reaches 0 the packet is discarded.

7

Source Address (128-bits): This field indicates the address of originator of the packet.

8

Destination Address (128-bits): This field provides the address of intended recipient of the packet.

Extension Headers

In IPv6, the Fixed Header contains only information which is necessary and avoiding information which is either not required or is rarely used. All such information, is put between the Fixed Header and Upper layer header in the form of Extension Headers. Each Extension Header is identified by a distinct value.

When Extension Headers are used, IPv6 Fixed Header’s Next Header field points to the first Extension Header. If there is one more Extension Header, then first Extension Header’s ‘Next-Header’ field point to the second one, and so on. The last Extension Header’s ‘Next-Header’ field point to Upper Layer Header. Thus all headers from point to the next one in a linked list manner.

If the Next Header field contains value 59, it indicates that there’s no header after this header, not even Upper Layer Header.

The following Extension Headers must be supported as per RFC 2460:

The sequence of Extension Headers should be:

These headers:

  • 1. Should be processed by First and subsequent destinations.

  • 2. Should be processed by Final Destination.

Extension Headers are arranged one after another in a Linked list manner, as depicted in the diagram below:

Communication

In IPv4, a host which wants to communicate with some other host on the network, needs first to have an IP address acquired either by means of DHCP or by manual configuration. As soon as a host is equipped with some valid IP address, it is now able to speak to any host on the subnet. To communicate on layer-3, a host also must know the IP address of the other host. Communication on a link, is established by means of hardware embedded MAC Addresses. To know the MAC address of host whose IP address is known, a host sends ARP broadcast and in revert the intended host sends back its MAC address.

In IPv6, there’s no broadcast mechanism. It is not a must for an IPv6 enabled host to obtain IP address from DHCP or manually configured, but it can auto-configure its own IP. Then, how would a host communicates with others on IPv6 enabled network?

ARP has been replaced by ICMPv6 Neighbor Discovery Protocol.

Neighbor Discovery Protocol

A host in IPv6 network is capable of auto-configuring itself with a unique link-local address. As soon as it is equipped with an IPv6 address, it joins a number of multicast groups. All communications related to that segment happens on those multicast addresses only. A host goes through a series of states in IPv6:

  • Neighbor Solicitation: After configuring all IPv6’s either manually, or by DHCP Server or by auto-configuration, the host sends a Neighbor Solicitation message out to FF02::1/16 multicast address for all its IPv6 addresses in order to know that no one else occupies same addresses.

  • DAD (Duplicate Address Detection): When the host does not listen from anything from the segment regarding its Neighbor Solicitation message, it assumes that no duplicate address exists on the segment.

  • Neighbor Advertisement: After assigning the addresses to its interfaces and making them up and running, the host once again sends out a Neighbor Advertisement message telling all other hosts on the segment, that it has assigned those IPv6 addresses to its interfaces.

Once a host is done with the configuration of its IPv6 addresses, it does the following things:

  • Router Solicitation: A host sends a Router Solicitation multicast packet (FF02::2/16) out on its segment to know the presence of any router on this segment. This helps the host to configure the router as its default gateway. If its default gateway router goes down, the host can shift to a new router and makes it the default gateway.

  • Router Advertisement: When a router receives a Router Solicitation message, it responses back to the host advertising its presence on that link.

  • Redirect: This may be the situation where a Router receives a Router Solicitation request but it knows that it is not the best gateway for the host. In this situation, the router sends back a Redirect message telling the host that there is a better ‘next-hop’ router available. Next-hop is where the host will send its data destined to a host which does not belong to the same segment.

Subnetting

In IPv4, addresses were created in classes. Classful IPv4 addresses clearly defines the bits used for network prefixes and the bits used for hosts on that network. To subnet in IPv4 we play with the default classful netmask which allows us to borrow hosts bit to be used as subnet bits. This results in multiple subnets but less hosts per subnet. That is, when we borrow host bit to create a subnet that costs us in lesser bit to be used for host addresses.

IPv6 addresses uses 128 bits to represent an address which includes bits to be used for subnetting. Second half of the address (least significant 64 bits) is always used for Hosts only. Therefore, there is no compromise if we subnet the network.

16 Bits of subnet is equivalent to IPv4’s Class B Network. Using these subnet bits an organization can have more 65 thousands of subnets which is by far, more than enough.

Thus routing prefix is /64 and host portion is 64 bits. We though, can further subnet the network beyond 16 bits of Subnet ID, borrowing hosts bit but it is recommended that 64 bits should always be used for hosts addresses because auto-configuration requires 64 bits.

IPv6 subnetting works on the same concept as Variable Length Subnet Masking in IPv4.

/48 prefix can be allocated to an organization providing it the benefit of having up to /64 subnet prefixes, which is 65535 sub-networks, each having 264 hosts. A /64 prefix can be assigned to a point-to-point connection where there are only two hosts (or IPv6 enabled devices) on a link.

IPv4 to IPv6

One problem in transition from IPv4 to IPv6 completely is that IPv6 is not backward compatible. This results in a situation where either a site is on IPv6 or it is not. Unlike an implementation of new technology where the newer one is backward compatible so the older system can still work with the newer without any additional changes.

To overcome this short-coming, there exist few technologies which can be used in slow and smooth transition from IPv4 to IPv6:

Dual Stack Routers

A router can be installed with both IPv4 and IPv6 addresses configured on its interfaces pointing to the network of relevant IP scheme.

In above diagram, a Server which is having IPv4 as well as IPv6 address configured for it now can speak with all hosts on IPv4 network and IPv6 network with help of Dual Stack Router. Dual Stack Router, can communicate with both networks and provides a medium for hosts to access Server without changing their respective IP version.

Tunneling

In a scenario where different IP versions exist on intermediate path or transit network, tunneling provides a better solution where user’s data can pass through a non-supported IP version.

The above diagram depicts how two remote IPv4 networks can communicate via Tunnel, where the transit network was on IPv6. Vice versa is also possible where transit network is on IPv6 and remote sites which intends to communicate, are on IPv4.

NAT Protocol Translation

This is another important method of transition to IPv6 by means of a NAT-PT (Network Address Translation – Protocol Translation) enabled device. With help of NAT-PT device, actual conversion happens between IPv4 and IPv6 packets and vice versa. See the diagram below:

A host with IPv4 address sends a request to IPv6 enabled Server on Internet which does not understand IPv4 address. In this scenario, NAT-PT device can help them communicate. When IPv4 host sends a request packet to IPv6 Server, NAT-PT device/router, strips down the IPv4 packet, removes IPv4 header and adds IPv6 header and passes it through the Internet. When a response from IPv6 Server comes for IPv4 host, the router does vice versa.

Mobility

When a host is connected to one link or network, it acquires an IP address and all communication happens using that IP address on that link. As soon as, the same host changes its physical location, that is, moves into some different area / subnet / network / link, its IP address changes accordingly and all communication happening on the host using old IP address, goes down.

IPv6 mobility provides a mechanism which equips a host with an ability to roam around among different links without losing any communication/connection and its IP address.

Multiple entities are involved in this technology:

  • Mobile Node: The device which needs IPv6 mobility.

  • Home Link: This link is configured with the home subnet prefix and this is where the Mobile IPv6 device gets its Home Address.

  • Home Address: This is the address which Mobile Node acquires from Home Link. This is permanent address of Mobile Node. If the Mobile Node remains in the same Home Link, the communication among various entities happens as usual.

  • Home Agent: This is a router which acts as registrar for Mobile Nodes. Home Agent is connected to Home Link and maintains information about all Mobile Nodes, their Home Addresses and their present IP addresses.

  • Foreign Link: Any other Link which is not Mobile Node’s Home Link.

  • Care-of Address: When a Mobile Node attaches to a Foreign Link, it acquires a new IP address of that Foreign Link’s subnet. Home Agent maintains the information of both Home Address and Care-of Address. Multiple Care-of addresses can be assigned to Mobile Node, but at any instance only one Care-of Address has binding with Home Address.

  • Correspondent Node: Any IPv6 enable device which intends to have communication with Mobile Node.

Mobility Operation

When Mobile Node stays in its Home Link, all communications happen on its Home Address. As shown below:

When Mobile Node leaves its Home Link and is connected to some Foreign Link, the Mobility feature of IPv6 comes into play. After connecting to Foreign Link, Mobile Node acquires an IPv6 address from Foreign Link. This address is called Care-of Address. Mobile Node sends binding request to its Home Agent with the new Care-of Address. Home Agent binds Mobile Node’s Home Address with Care-of Address, establishing a Tunnel between both.

Whenever a Correspondent Node tries to establish connection with Mobile Node (on its Home Address), the Home Agent intercepts the packet and forwards to Mobile Node’s Care-of Address over the Tunnel which was already established.

Route Optimization

When a Correspondent Node initiate communication by sending packets to Mobile Node on Home Address, these packets are tunneled to Mobile Node by Home Agent. In Route Optimization mode, when the Mobile Node receives packet from Correspondent Node, it does not forward replies to Home Agent. Rather it sends its packet directly to Correspondent Node using Home Address as Source Address. This mode is optional and not used by default.

Routing

Routing concepts remain same in case of IPv6 but almost all routing protocol have been redefined accordingly. We have seen in Communication in IPv6 segment, how a host speaks to its gateway. Routing is a process to forward routable data choosing best route among several available routes or path to the destination. A router is a device which forwards data which is not explicitly destined to it.

There exists two forms of routing protocols

  • Distance Vector Routing Protocol: A router running distance vector protocol advertises its connected routes and learns new routes from its neighbors. The routing cost to reach a destination is calculated by means of hops between the source and destination. A Router generally relies on its neighbor for best path selection, also known as “routing-by-rumors”. RIP and BGP are Distance Vector Protocols.

  • Link-State Routing Protocol: This protocol acknowledges the state of a Link and advertises to its neighbors. Information about new links is learnt from peer routers. After all the routing information has been converged, Link-State Routing Protocol uses its own algorithm to calculate best path to all available links. OSPF and IS-IS are link state routing protocols and both uses Dijkstra’s Shortest Path First algorithm.

Routing protocols can be divided in two categories:

  • Interior Routing Protocol: Protocols in this categories are used within an Autonomous System or organization to distribute routes among all routers inside its boundary. Examples: RIP, OSPF.

  • Exterior Routing Protocol: Whereas an Exterior Routing Protocol distributes routing information between two different Autonomous Systems or organization. Examples: BGP.

Routing protocols

  • RIPng

    RIPng stands for Routing Information Protocol Next Generation. This is an Interior Routing Protocol and is a Distance Vector Protocol. RIPng has been upgraded to support IPv6.

  • OSPFv3

  • Open Shortest Path First version 3 is an Interior Routing Protocol which is modified to support IPv6. This is a Link-State Protocol and uses Djikrasta’s Shortest Path First algorithm to calculate best path to all destinations.

  • BGPv4

    BGP stands for Border Gateway Protocol. It is the only open standard Exterior Gateway Protocol available. BGP is a Distance Vector protocol which takes Autonomous System as calculation metric, instead of number of routers as Hop. BGPv4 is an upgrade of BGP to support IPv6 routing.

Protocols changed to support IPv6:

  • ICMPv6: Internet Control Message Protocol version 6 is an upgraded implementation of ICMP to accommodate IPv6 requirements. This protocol is used for diagnostic functions, error and information message, statistical purposes. ICMPv6’s Neighbor Discovery Protocol replaces ARP and helps discover neighbor and routers on the link.

  • DHCPv6: Dynamic Host Configuration Protocol version 6 is an implementation of DHCP. Though IPv6 enabled hosts do not require any DHCPv6 Server to acquire IP address as they can be auto-configured. Neither do they need DHCPv6 to locate DNS server because DNS can be discovered and configured via ICMPv6 Neighbor Discovery Protocol. Yet DHCPv6 Server can be used to provide these information.

  • DNS: There has been no new version of DNS but it is now equipped with extensions to provide support for querying IPv6 addresses. A new AAAA (quad-A) record has been added to reply IPv6 query messages. Now DNS can reply with both IP versions (4 & 6) without any change in query format.

Summary

IPv4 since 1982, has been an undisputed leader of Internet. With IPv4’s address space exhaustion IPv6 is now taking over the control of Internet, which is called Internet2.

IPv4 is widely deployed and migration to IPv6 would not be easy. So far IPv6 could penetrate IPv4’s address space by less than 1%.

The world has celebrated ‘World IPv6 Day’ on June 08, 2011 with a purpose to test IPv6 address over Internet in full. On June 06, 2012 the Internet community officially launched IPv6. This day all ISPs who were offering IPv6 were to enable it on public domain and were to keep it enable. All the device manufacturer also participated to offer IPv6 by-default enabled on devices.

This was a step towards encouraging Internet community to migrate to IPv6.

Organizations are provided plenty of ways to migrate from IPv4 to IPv6. Also organization, willing to test IPv6 before migrating completely can run both IPv4 and IPv6 simultaneously. Networks of different IP versions can communicate and user data can be tunneled to walk to the other side.

Future of IPv6

IPv6 enabled Internet version 2 will replace todays IPv4 enabled Internet. When Internet was launched with IPv4, developed countries like US and Europe took the larger space of IPv4 for deployment of Internet in their respective countries keeping future need in mind. But Internet exploded everywhere reaching and connecting every country of the world increasing the requirement of IPv4 address space. As a result, till this day US and Europe have many IPv4 address space left with them and countries like India and China are bound to address their IP space requirement by means of deployment of IPv6.

Most of the IPv6 deployment is being done outside US, Europe. India and China are moving forward to change their entire space to IPv6. China has announced a five year deployment plan named China Next Generation Internet.

After June 06, 2012 all major ISPs were shifted to IPv6 and rest of them are still moving.

IPv6 provides ample of address space and is designed to expand today’s Internet services. Feature-rich IPv6 enabled Internet version 2 may deliver more than expected.

[Image: Unicast Messaging][Image: Multicast Messaging][Image: Anycast Messaging][Image: Conversion Table][Image: EUI-64 Interface ID][Image: Global Unicast Address][Image: Link-Local Address][Image: Unique-Local Address][Image: IPv6 Unicast Address Scope][Image: IPv6 Fixed Header][Image: Extension Headers Connected Format][Image: IPv6 Subnetting][Image: Dual Stack Router][Image: Tunneling][Image: NAT - Protocol Translation][Image: Mobile Node connected to Home Link][Image: Mobile Node connected to Foreign Link]

IPv4 Basics

posted on May 24, 2021

tags:

This era is said to be the era of computers. Computers have significantly changed the way we live. A computing device when connected to other computing device(s) enables us to share data and information at lightning fast speed.

What is Network?

A Network in the world of computers is said to be a collection of interconnected hosts, via some shared media which can be wired or wireless. A computer network enables its hosts to share and exchange data and information over the media. Network can be a Local Area Network spanned across an office or Metro Area Network spanned across a city or Wide Area Network which can be spanned across cities and provinces.

A computer network can be as simple as two PCs connected together via a single copper cable or it can be grown up to the complexity where every computer in this world is connected to every other, called the Internet. A network then includes more and more components to reach its ultimate goal of data exchange. Below is a brief description of the components involved in computer network −

  • Hosts − Hosts are said to be situated at ultimate end of the network, i.e. a host is a source of information and another host will be the destination. Information flows end to end between hosts. A host can be a user’s PC, an internet Server, a database server etc.

  • Media − If wired, then it can be copper cable, fiber optic cable, and coaxial cable. If wireless, it can be free-to-air radio frequency or some special wireless band. Wireless frequencies can be used to interconnect remote sites too.

  • Hub − A hub is a multiport repeater and it is used to connect hosts in a LAN segment. Because of low throughputs hubs are now rarely used. Hub works on Layer-1 (Physical Layer) of OSI Model.

  • Switch − A Switch is a multiport bridge and is used to connect hosts in a LAN segment. Switches are much faster than Hubs and operate on wire speed. Switch works on Layer-2 (Data Link Layer), but Layer-3 (Network Layer) switches are also available.

  • Router − A router is Layer-3 (Network Layer) device which makes routing decisions for the data/information sent for some remote destination. Routers make the core of any interconnected network and the Internet.

  • Gateways − A software or combination of software and hardware put together, works for exchanging data among networks which are using different protocols for sharing data.

  • Firewall − Software or combination of software and hardware, used to protect users data from unintended recipients on the network/internet.

All components in a network ultimately serve the hosts.

Host Addressing

Communication between hosts can happen only if they can identify each other on the network. In a single collision domain (where every packet sent on the segment by one host is heard by every other host) hosts can communicate directly via MAC address.

MAC address is a factory coded 48-bits hardware address which can also uniquely identify a host. But if a host wants to communicate with a remote host, i.e. not in the same segment or logically not connected, then some means of addressing is required to identify the remote host uniquely. A logical address is given to all hosts connected to Internet and this logical address is called Internet Protocol Address.

IPv4 - OSI Model

The International Standard Organization has a well-defined model for Communication Systems known as Open System Interconnection, or the OSI Model. This layered model is a conceptualized view of how one system should communicate with the other, using various protocols defined in each layer. Further, each layer is designated to a well-defined part of communication system. For example, the Physical layer defines all the components of physical nature, i.e. wires, frequencies, pulse codes, voltage transmission etc. of a communication system.

The OSI Model has the following seven layers −

OSI Model Layers

  • Application Layer (Layer-7) − This is where the user application sits that needs to transfer data between or among hosts. For example − HTTP, file transfer application (FTP) and electronic mail etc.

  • Presentation Layer (Layer-6) − This layer helps to understand data representation in one form on a host to other host in their native representation. Data from the sender is converted to on-the-wire data (general standard format) and at the receiver’s end it is converted to the native representation of the receiver.

  • Session Layer (Layer-5) − This layer provides session management capabilities between hosts. For example, if some host needs a password verification for access and if credentials are provided then for that session password verification does not happen again. This layer can assist in synchronization, dialog control and critical operation management (e.g., an online bank transaction).

  • Transport Layer (Layer-4) − This layer provides end to end data delivery among hosts. This layer takes data from the above layer and breaks it into smaller units called Segments and then gives it to the Network layer for transmission.

  • Network Layer (Layer-3) − This layer helps to uniquely identify hosts beyond the subnets and defines the path which the packets will follow or be routed to reach the destination.

  • Data Link Layer (Layer-2) − This layer takes the raw transmission data (signal, pulses etc.) from the Physical Layer and makes Data Frames, and sends that to the upper layer and vice versa. This layer also checks any transmission errors and sorts it out accordingly.

  • Physical Layer (Layer-1) − This layer deals with hardware technology and actual communication mechanism such as signaling, voltage, cable type and length, etc.

Network Layer

The network layer is responsible for carrying data from one host to another. It provides means to allocate logical addresses to hosts, and identify them uniquely using the same. Network layer takes data units from Transport Layer and cuts them in to smaller unit called Data Packet.

Network layer defines the data path, the packets should follow to reach the destination. Routers work on this layer and provides mechanism to route data to its destination.

IPv4 - TCP/IP Model

A majority of the internet uses a protocol suite called the Internet Protocol Suite also known as the TCP/IP protocol suite. This suite is a combination of protocols which encompasses a number of different protocols for different purpose and need. Because the two major protocols in this suites are TCP (Transmission Control Protocol) and IP (Internet Protocol), this is commonly termed as TCP/IP Protocol suite. This protocol suite has its own reference model which it follows over the internet. In contrast with the OSI model, this model of protocols contains less layers.

TCP/IP Model Layers

Figure − Comparative depiction of OSI and TCP/IP Reference Models

This model is indifferent to the actual hardware implementation, i.e. the physical layer of OSI Model. This is why this model can be implemented on almost all underlying technologies. Transport and Internet layers correspond to the same peer layers. All three top layers of OSI Model are compressed together in single Application layer of TCP/IP Model.

Internet Protocol Version 4 (IPv4)

Internet Protocol is one of the major protocols in the TCP/IP protocols suite. This protocol works at the network layer of the OSI model and at the Internet layer of the TCP/IP model. Thus this protocol has the responsibility of identifying hosts based upon their logical addresses and to route data among them over the underlying network.

IP provides a mechanism to uniquely identify hosts by an IP addressing scheme. IP uses best effort delivery, i.e. it does not guarantee that packets would be delivered to the destined host, but it will do its best to reach the destination. Internet Protocol version 4 uses 32-bit logical address.

IPv4 - Packet Structure

Internet Protocol being a layer-3 protocol (OSI) takes data Segments from layer-4 (Transport) and divides it into packets. IP packet encapsulates data unit received from above layer and add to its own header information.

IP Encapsulation

The encapsulated data is referred to as IP Payload. IP header contains all the necessary information to deliver the packet at the other end.

IP Header

IP header includes many relevant information including Version Number, which, in this context, is 4. Other details are as follows −

  • Version − Version no. of Internet Protocol used (e.g. IPv4).

  • IHL − Internet Header Length; Length of entire IP header.

  • DSCP − Differentiated Services Code Point; this is Type of Service.

  • ECN − Explicit Congestion Notification; It carries information about the congestion seen in the route.

  • Total Length − Length of entire IP Packet (including IP header and IP Payload).

  • Identification − If IP packet is fragmented during the transmission, all the fragments contain same identification number. to identify original IP packet they belong to.

  • Flags − As required by the network resources, if IP Packet is too large to handle, these ‘flags’ tells if they can be fragmented or not. In this 3-bit flag, the MSB is always set to ‘0’.

  • Fragment Offset − This offset tells the exact position of the fragment in the original IP Packet.

  • Time to Live − To avoid looping in the network, every packet is sent with some TTL value set, which tells the network how many routers (hops) this packet can cross. At each hop, its value is decremented by one and when the value reaches zero, the packet is discarded.

  • Protocol − Tells the Network layer at the destination host, to which Protocol this packet belongs to, i.e. the next level Protocol. For example protocol number of ICMP is 1, TCP is 6 and UDP is 17.

  • Header Checksum − This field is used to keep checksum value of entire header which is then used to check if the packet is received error-free.

  • Source Address − 32-bit address of the Sender (or source) of the packet.

  • Destination Address − 32-bit address of the Receiver (or destination) of the packet.

  • Options − This is optional field, which is used if the value of IHL is greater than 5. These options may contain values for options such as Security, Record Route, Time Stamp, etc.

IPv4 - Addressing

IPv4 supports three different types of addressing modes. −

Unicast Addressing Mode

In this mode, data is sent only to one destined host. The Destination Address field contains 32- bit IP address of the destination host. Here the client sends data to the targeted server −

Unicast Addressing

Broadcast Addressing Mode

In this mode, the packet is addressed to all the hosts in a network segment. The Destination Address field contains a special broadcast address, i.e. 255.255.255.255. When a host sees this packet on the network, it is bound to process it. Here the client sends a packet, which is entertained by all the Servers −

Broadcast Addressing

Multicast Addressing Mode

This mode is a mix of the previous two modes, i.e. the packet sent is neither destined to a single host nor all the hosts on the segment. In this packet, the Destination Address contains a special address which starts with 224.x.x.x and can be entertained by more than one host.

Multicast Addressing

Here a server sends packets which are entertained by more than one servers. Every network has one IP address reserved for the Network Number which represents the network and one IP address reserved for the Broadcast Address, which represents all the hosts in that network.

Hierarchical Addressing Scheme

IPv4 uses hierarchical addressing scheme. An IP address, which is 32-bits in length, is divided into two or three parts as depicted −

IP Addressing

A single IP address can contain information about the network and its sub-network and ultimately the host. This scheme enables the IP Address to be hierarchical where a network can have many sub-networks which in turn can have many hosts.

Subnet Mask

The 32-bit IP address contains information about the host and its network. It is very necessary to distinguish both. For this, routers use Subnet Mask, which is as long as the size of the network address in the IP address. Subnet Mask is also 32 bits long. If the IP address in binary is ANDed with its Subnet Mask, the result yields the Network address. For example, say the IP Address is 192.168.1.152 and the Subnet Mask is 255.255.255.0 then −

IP Subnet Mask

This way the Subnet Mask helps extract the Network ID and the Host from an IP Address. It can be identified now that 192.168.1.0 is the Network number and 192.168.1.152 is the host on that network.

Binary Representation

The positional value method is the simplest form of converting binary from decimal value. IP address is 32 bit value which is divided into 4 octets. A binary octet contains 8 bits and the value of each bit can be determined by the position of bit value '1' in the octet.

Binary Representation

Positional value of bits is determined by 2 raised to power (position – 1), that is the value of a bit 1 at position 6 is 2^(6-1) that is 2^5 that is 32. The total value of the octet is determined by adding up the positional value of bits. The value of 11000000 is 128+64 = 192. Some examples are shown in the table below −

IP Bit Patterns

IPv4 - Address Classes

Internet Protocol hierarchy contains several classes of IP Addresses to be used efficiently in various situations as per the requirement of hosts per network. Broadly, the IPv4 Addressing system is divided into five classes of IP Addresses. All the five classes are identified by the first octet of IP Address.

Internet Corporation for Assigned Names and Numbers is responsible for assigning IP addresses.

The first octet referred here is the left most of all. The octets numbered as follows depicting dotted decimal notation of IP Address −

IP Decimal Notation

The number of networks and the number of hosts per class can be derived by this formula −

Number of networks

When calculating hosts' IP addresses, 2 IP addresses are decreased because they cannot be assigned to hosts, i.e. the first IP of a network is network number and the last IP is reserved for Broadcast IP.

Class A Address

The first bit of the first octet is always set to 0 (zero). Thus the first octet ranges from 1 – 127, i.e.

Class A Addresses

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.

The default subnet mask for Class A IP address is 255.0.0.0 which implies that Class A addressing can have 126 networks (27-2) and 16777214 hosts (224-2).

Class A IP address format is thus: 0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH

Class B Address

An IP address which belongs to class B has the first two bits in the first octet set to 10, i.e.

Class B Addresses

Class B IP Addresses range from 128.0.x.x to 191.255.x.x. The default subnet mask for Class B is 255.255.x.x.

Class B has 16384 (214) Network addresses and 65534 (216-2) Host addresses.

Class B IP address format is: 10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH

Class C Address

The first octet of Class C IP address has its first 3 bits set to 110, that is −

Class C Addresses

Class C IP addresses range from 192.0.0.x to 223.255.255.x. The default subnet mask for Class C is 255.255.255.x.

Class C gives 2097152 (221) Network addresses and 254 (28-2) Host addresses.

Class C IP address format is: 110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH

Class D Address

Very first four bits of the first octet in Class D IP addresses are set to 1110, giving a range of −

Class D Addresses

Class D has IP address range from 224.0.0.0 to 239.255.255.255. Class D is reserved for Multicasting. In multicasting data is not destined for a particular host, that is why there is no need to extract host address from the IP address, and Class D does not have any subnet mask.

Class E Address

This IP Class is reserved for experimental purposes only for R&D or Study. IP addresses in this class ranges from 240.0.0.0 to 255.255.255.254. Like Class D, this class too is not equipped with any subnet mask.

IPv4 - Subnetting

Each IP class is equipped with its own default subnet mask which bounds that IP class to have prefixed number of Networks and prefixed number of Hosts per network. Classful IP addressing does not provide any flexibility of having less number of Hosts per Network or more Networks per IP Class.

CIDR or Classless Inter Domain Routing provides the flexibility of borrowing bits of Host part of the IP address and using them as Network in Network, called Subnet. By using subnetting, one single Class A IP address can be used to have smaller sub-networks which provides better network management capabilities.

Class A Subnets

In Class A, only the first octet is used as Network identifier and rest of three octets are used to be assigned to Hosts (i.e. 16777214 Hosts per Network). To make more subnet in Class A, bits from Host part are borrowed and the subnet mask is changed accordingly.

For example, if one MSB (Most Significant Bit) is borrowed from host bits of second octet and added to Network address, it creates two Subnets (21=2) with (223-2) 8388606 Hosts per Subnet.

The Subnet mask is changed accordingly to reflect subnetting. Given below is a list of all possible combination of Class A subnets −

Class A Subnets

In case of subnetting too, the very first and last IP address of every subnet is used for Subnet Number and Subnet Broadcast IP address respectively. Because these two IP addresses cannot be assigned to hosts, sub-netting cannot be implemented by using more than 30 bits as Network Bits, which provides less than two hosts per subnet.

Class B Subnets

By default, using Classful Networking, 14 bits are used as Network bits providing (214) 16384 Networks and (216-2) 65534 Hosts. Class B IP Addresses can be subnetted the same way as Class A addresses, by borrowing bits from Host bits. Below is given all possible combination of Class B subnetting −

Class B Subnets

Class C Subnets

Class C IP addresses are normally assigned to a very small size network because it can only have 254 hosts in a network. Given below is a list of all possible combination of subnetted Class B IP address −

Class C Subnets

IPv4 - VLSM

Internet Service Providers may face a situation where they need to allocate IP subnets of different sizes as per the requirement of customer. One customer may ask Class C subnet of 3 IP addresses and another may ask for 10 IPs. For an ISP, it is not feasible to divide the IP addresses into fixed size subnets, rather he may want to subnet the subnets in such a way which results in minimum wastage of IP addresses.

For example, an administrator have 192.168.1.0/24 network. The suffix /24 (pronounced as "slash 24") tells the number of bits used for network address. In this example, the administrator has three different departments with different number of hosts. Sales department has 100 computers, Purchase department has 50 computers, Accounts has 25 computers and Management has 5 computers. In CIDR, the subnets are of fixed size. Using the same methodology the administrator cannot fulfill all the requirements of the network.

The following procedure shows how VLSM can be used in order to allocate department-wise IP addresses as mentioned in the example.

Step - 1

Make a list of Subnets possible.

Subnet List

Step - 2

Sort the requirements of IPs in descending order (Highest to Lowest).

  • Sales 100
  • Purchase 50
  • Accounts 25
  • Management 5

Step - 3

Allocate the highest range of IPs to the highest requirement, so let's assign 192.168.1.0 /25 (255.255.255.128) to the Sales department. This IP subnet with Network number 192.168.1.0 has 126 valid Host IP addresses which satisfy the requirement of the Sales department. The subnet mask used for this subnet has 10000000 as the last octet.

Step - 4

Allocate the next highest range, so let's assign 192.168.1.128 /26 (255.255.255.192) to the Purchase department. This IP subnet with Network number 192.168.1.128 has 62 valid Host IP Addresses which can be easily assigned to all the PCs of the Purchase department. The subnet mask used has 11000000 in the last octet.

Step - 5

Allocate the next highest range, i.e. Accounts. The requirement of 25 IPs can be fulfilled with 192.168.1.192 /27 (255.255.255.224) IP subnet, which contains 30 valid host IPs. The network number of Accounts department will be 192.168.1.192. The last octet of subnet mask is 11100000.

Step - 6

Allocate the next highest range to Management. The Management department contains only 5 computers. The subnet 192.168.1.224 /29 with the Mask 255.255.255.248 has exactly 6 valid host IP addresses. So this can be assigned to Management. The last octet of the subnet mask will contain 11111000.

By using VLSM, the administrator can subnet the IP subnet in such a way that least number of IP addresses are wasted. Even after assigning IPs to every department, the administrator, in this example, is still left with plenty of IP addresses which was not possible if he has used CIDR.

IPv4 - Reserved Addresses

There are a few reserved IPv4 address spaces which cannot be used on the internet. These addresses serve special purpose and cannot be routed outside the Local Area Network.

Private IP Addresses

Every class of IP, (A, B & C) has some addresses reserved as Private IP addresses. These IPs can be used within a network, campus, company and are private to it. These addresses cannot be routed on the Internet, so packets containing these private addresses are dropped by the Routers.

Private IP Addresses

In order to communicate with the outside world, these IP addresses must have to be translated to some public IP addresses using NAT process, or Web Proxy server can be used.

The sole purpose to create a separate range of private addresses is to control assignment of already-limited IPv4 address pool. By using a private address range within LAN, the requirement of IPv4 addresses has globally decreased significantly. It has also helped delaying the IPv4 address exhaustion.

IP class, while using private address range, can be chosen as per the size and requirement of the organization. Larger organizations may choose class A private IP address range where smaller organizations may opt for class C. These IP addresses can be further sub-netted and assigned to departments within an organization.

Loopback IP Addresses

The IP address range 127.0.0.0 – 127.255.255.255 is reserved for loopback, i.e. a Host’s self-address, also known as localhost address. This loopback IP address is managed entirely by and within the operating system. Loopback addresses, enable the Server and Client processes on a single system to communicate with each other. When a process creates a packet with destination address as loopback address, the operating system loops it back to itself without having any interference of NIC.

Data sent on loopback is forwarded by the operating system to a virtual network interface within operating system. This address is mostly used for testing purposes like client-server architecture on a single machine. Other than that, if a host machine can successfully ping 127.0.0.1 or any IP from loopback range, implies that the TCP/IP software stack on the machine is successfully loaded and working.

Link-local Addresses

In case a host is not able to acquire an IP address from the DHCP server and it has not been assigned any IP address manually, the host can assign itself an IP address from a range of reserved Link-local addresses. Link local address ranges from 169.254.0.0 -- 169.254.255.255.

Assume a network segment where all systems are configured to acquire IP addresses from a DHCP server connected to the same network segment. If the DHCP server is not available, no host on the segment will be able to communicate to any other. Windows (98 or later), and Mac OS (8.0 or later) supports this functionality of self-configuration of Link-local IP address. In absence of DHCP server, every host machine randomly chooses an IP address from the above mentioned range and then checks to ascertain by means of ARP, if some other host also has not configured itself with the same IP address. Once all hosts are using link local addresses of same range, they can communicate with each other.

These IP addresses cannot help system to communicate when they do not belong to the same physical or logical segment. These IPs are also not routable.

IPv4 - Example

This chapter describes how actual communication happens on the Network using Internet Protocol version 4.

Packet Flow in Network

All the hosts in IPv4 environment are assigned unique logical IP addresses. When a host wants to send some data to another host on the network, it needs the physical (MAC) address of the destination host. To get the MAC address, the host an broadcasts ARP message and asks to give the MAC address whoever is the owner of destination IP address. All the hosts on that segment receive the ARP packet, but only the host having its IP matching with the one in the ARP message, replies with its MAC address. Once the sender receives the MAC address of the receiving station, data is sent on the physical media.

In case the IP does not belong to the local subnet, the data is sent to the destination by means of Gateway of the subnet. To understand the packet flow, we must first understand the following components −

  • MAC Address − Media Access Control Address is 48-bit factory hard coded physical address of network device which can uniquely be identified. This address is assigned by device manufacturers.

  • Address Resolution Protocol − Address Resolution Protocol is used to acquire the MAC address of a host whose IP address is known. ARP is a Broadcast packet which is received by all the host in the network segment. But only the host whose IP is mentioned in ARP responds to it providing its MAC address.

  • Proxy Server − To access the Internet, networks use a Proxy Server which has a public IP assigned. All the PCs request the Proxy Server for a Server on the Internet. The Proxy Server on behalf of the PCS sends the request to the server and when it receives a response from the Server, the Proxy Server forwards it to the client PC. This is a way to control Internet access in computer networks and it helps to implement web based policies.

  • Dynamic Host Control Protocol − DHCP is a service by which a host is assigned IP address from a pre-defined address pool. DHCP server also provides necessary information such as Gateway IP, DNS Server Address, lease assigned with the IP, etc. By using DHCP services, a network administrator can manage assignment of IP addresses at ease.

  • Domain Name System − It is very likely that a user does not know the IP address of a remote Server he wants to connect to. But he knows the name assigned to it, for example, tutorialpoints.com. When the user types the name of a remote server he wants to connect to, the localhost behind the screens sends a DNS query. Domain Name System is a method to acquire the IP address of the host whose Domain Name is known.

  • Network Address Translation − Almost all PCs in a computer network are assigned private IP addresses which are not routable on the Internet. As soon as a router receives an IP packet with a private IP address, it drops it. In order to access servers on public private address, computer networks use an address translation service, which translates between public and private addresses, called Network Address Translation. When a PC sends an IP packet out of a private network, NAT changes the private IP address with public IP address and vice versa.

We can now describe the packet flow. Assume that a user wants to access www.TutorialsPoint.com from her personal computer. She has internet connection from her ISP. The following steps will be taken by the system to help her reach the destination website.

Step 1 – Acquiring an IP Address (DHCP)

When the user’s PC boots up, it searches for a DHCP server to acquire an IP address. For the same, the PC sends a DHCPDISCOVER broadcast which is received by one or more DHCP servers on the subnet and they all respond with DHCPOFFER which includes all the necessary details such as IP, subnet, Gateway, DNS, etc. The PC sends DHCPREQUEST packet in order to request the offered IP address. Finally, the DHCP sends DHCPACK packet to tell the PC that it can keep the IP for some given amount of time that is known as IP lease.

Alternatively, a PC can be assigned an IP address manually without taking any help from DHCP server. When a PC is well configured with IP address details, it can communicate other computers all over the IP enabled network.

Step 2 – DNS Query

When a user opens a web browser and types www.tutorialpoints.com which is a domain name and a PC does not understand how to communicate with the server using domain names, then the PC sends a DNS query out on the network in order to obtain the IP address pertaining to the domain name. The pre-configured DNS server responds to the query with IP address of the domain name specified.

Step 3 – ARP Request

The PC finds that the destination IP address does not belong to his own IP address range and it has to forward the request to the Gateway. The Gateway in this scenario can be a router or a Proxy Server. Though the Gateway’s IP address is known to the client machine but computers do not exchange data on IP addresses, rather they need the machine’s hardware address which is Layer-2 factory coded MAC address. To obtain the MAC address of the Gateway, the client PC broadcasts an ARP request saying "Who owns this IP address?" The Gateway in response to the ARP query sends its MAC address. Upon receiving the MAC address, the PC sends the packets to the Gateway.

An IP packet has both source and destination addresses and it connects the host with a remote host logically, whereas MAC addresses help systems on a single network segment to transfer actual data. It is important that source and destination MAC addresses change as they travel across the Internet (segment by segment) but source and destination IP addresses never change.

IPv4 - Summary

The Internet Protocol version 4 was designed to be allocated to approx. imately 4.3 billion addresses. At the beginning of Internet this was considered a much wider address space for which there was nothing to worry about.

The sudden growth in internet users and its wide spread use has exponentially increased the number of devices which needs real and unique IP to be able to communicate. Gradually, an IPS is required by almost every digital equipment which were made to ease human life, such as Mobile Phones, Cars and other electronic devices. The number of devices (other than computers/routers) expanded the demand for extra IP addresses, which were not considered earlier.

Allocation of IPv4 is globally managed by Internet Assigned Numbers Authority (IANA) under coordination with the Internet Corporation for Assigned Names and Numbers (ICANN). IANA works closely with Regional Internet Registries, which in turns are responsible for efficiently distributing IP addresses in their territories. There are five such RIRS. According to IANA reports, all the IPv4 address blocks have been allocated. To cope up with the situation, the following practices were being done −

  • Private IPs − Few blocks of IPs were declared for private use within a LAN so that the requirement for public IP addresses can be reduced.

  • NAT − Network address translation is a mechanism by which multiple PCs/hosts with private IP addresses are enabled to access using one or few public IP addresses.

  • Unused Public IPs were reclaimed by RIRs.

Internet Protocol v6 (IPv6)

IETF (Internet Engineering Task Force) has redesigned IP addresses to mitigate the drawbacks of IPv4. The new IP address is version 6 which is 128-bit address, by which every single inch of the earth can be given millions of IP addresses.

Today majority of devices running on Internet are using IPv4 and it is not possible to shift them to IPv6 in the coming days. There are mechanisms provided by IPv6, by which IPv4 and IPv6 can co-exist unless the Internet entirely shifts to IPv6 −

  • Dual IP Stack
  • Tunneling (6to4 and 4to6)
  • NAT Protocol Translation

Is an Intel i7 always faster than an i5?

posted on May 20, 2021

tags:

Good question. Essentially, i5 is the same CPU as i7, only that its hyper-threading option is factory-disabled. If the hyper-threading is disabled in the BIOS for an i7 CPU, then it would have the same performance as a comparable i5.

So how can Intel i5 CPU be faster than i7? In single-thread workloads, a comparable i5 can be faster if it has a higher basic clock speed. Note that I say “comparable” meaning of the same generation.

Consequently, Intel CPU is evolving and for example, newer i5 may be faster than a much older i7. How is that possible?

Well, just take a look at the newer i5–8400 which is a six-core CPU with turbo up to 3.8GHz, as it is a recent model so it is much newer than an old i7–2700k and consequently it performs much better than its older sibling.

When PassMark benchmarking software is used to compare them, i5–8400 will score 11640 multicore and 2336 single-thread score, while the i7–2700k multi-core score is 8687 and 2005 points single-thread.

Now, if you compare current-generation Intel CPU then a modern i7 which is not “gimped” in any way will always perform better than a comparable i5 model.

ASP.NET – Server Controls Basics

posted on May 17, 2021

tags:

Controls are small building blocks of the graphical user interface, which include text boxes, buttons, check boxes, list boxes, labels, and numerous other tools. Using these tools, the users can enter data, make selections and indicate their preferences.

Controls are also used for structural jobs, like validation, data access, security, creating master pages, and data manipulation.

ASP.NET uses five types of web controls, which are:

  • HTML controls
  • HTML Server controls
  • ASP.NET Server controls
  • ASP.NET Ajax Server controls
  • User controls and custom controls

ASP.NET server controls are the primary controls used in ASP.NET. These controls can be grouped into the following categories:

  • Validation controls - These are used to validate user input and they work by running client-side script.

  • Data source controls - These controls provides data binding to different data sources.

  • Data view controls - These are various lists and tables, which can bind to data from data sources for displaying.

  • Personalization controls - These are used for personalization of a page according to the user preferences, based on user information.

  • Login and security controls - These controls provide user authentication.

  • Master pages - These controls provide consistent layout and interface throughout the application.

  • Navigation controls - These controls help in navigation. For example, menus, tree view etc.

  • Rich controls - These controls implement special features. For example, AdRotator, FileUpload, and Calendar control.

The syntax for using server controls is:

<asp:controlType  ID ="ControlID" runat="server" Property1=value1  [Property2=value2] />

In addition, visual studio has the following features, to help produce in error-free coding:

  • Dragging and dropping of controls in design view
  • IntelliSense feature that displays and auto-completes the properties
  • The properties window to set the property values directly

Properties of the Server Controls

ASP.NET server controls with a visual aspect are derived from the WebControl class and inherit all the properties, events, and methods of this class.

The WebControl class itself and some other server controls that are not visually rendered are derived from the System.Web.UI.Control class. For example, PlaceHolder control or XML control.

ASP.Net server controls inherit all properties, events, and methods of the WebControl and System.Web.UI.Control class.

The following table shows the inherited properties, common to all server controls:

Property Description
AccessKey Pressing this key with the Alt key moves focus to the control.
Attributes It is the collection of arbitrary attributes (for rendering only) that do not correspond to properties on the control.
BackColor Background color.
BindingContainer The control that contains this control's data binding.
BorderColor Border color.
BorderStyle Border style.
BorderWidth Border width.
CausesValidation Indicates if it causes validation.
ChildControlCreated It indicates whether the server control's child controls have been created.
ClientID Control ID for HTML markup.
Context The HttpContext object associated with the server control.
Controls Collection of all controls contained within the control.
ControlStyle The style of the Web server control.
CssClass CSS class
DataItemContainer Gets a reference to the naming container if the naming container implements IDataItemContainer.
DataKeysContainer Gets a reference to the naming container if the naming container implements IDataKeysControl.
DesignMode It indicates whether the control is being used on a design surface.
DisabledCssClass Gets or sets the CSS class to apply to the rendered HTML element when the control is disabled.
Enabled Indicates whether the control is grayed out.
EnableTheming Indicates whether theming applies to the control.
EnableViewState Indicates whether the view state of the control is maintained.
Events Gets a list of event handler delegates for the control.
Font Font.
Forecolor Foreground color.
HasAttributes Indicates whether the control has attributes set.
HasChildViewState Indicates whether the current server control's child controls have any saved view-state settings.
Height Height in pixels or %.
ID Identifier for the control.
IsChildControlStateCleared Indicates whether controls contained within this control have control state.
IsEnabled Gets a value indicating whether the control is enabled.
IsTrackingViewState It indicates whether the server control is saving changes to its view state.
IsViewStateEnabled It indicates whether view state is enabled for this control.
LoadViewStateById It indicates whether the control participates in loading its view state by ID instead of index.
Page Page containing the control.
Parent Parent control.
RenderingCompatibility It specifies the ASP.NET version that the rendered HTML will be compatible with.
Site The container that hosts the current control when rendered on a design surface.
SkinID Gets or sets the skin to apply to the control.
Style Gets a collection of text attributes that will be rendered as a style attribute on the outer tag of the Web server control.
TabIndex Gets or sets the tab index of the Web server control.
TagKey Gets the HtmlTextWriterTag value that corresponds to this Web server control.
TagName Gets the name of the control tag.
TemplateControl The template that contains this control.
TemplateSourceDirectory Gets the virtual directory of the page or control containing this control.
ToolTip Gets or sets the text displayed when the mouse pointer hovers over the web server control.
UniqueID Unique identifier.
ViewState Gets a dictionary of state information that saves and restores the view state of a server control across multiple requests for the same page.
ViewStateIgnoreCase It indicates whether the StateBag object is case-insensitive.
ViewStateMode Gets or sets the view-state mode of this control.
Visible It indicates whether a server control is visible.
Width Gets or sets the width of the Web server control.

Methods of the Server Controls

The following table provides the methods of the server controls:

Method Description
AddAttributesToRender Adds HTML attributes and styles that need to be rendered to the specified HtmlTextWriterTag.
AddedControl Called after a child control is added to the Controls collection of the control object.
AddParsedSubObject Notifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's control collection.
ApplyStyleSheetSkin Applies the style properties defined in the page style sheet to the control.
ClearCachedClientID Infrastructure. Sets the cached ClientID value to null.
ClearChildControlState Deletes the control-state information for the server control's child controls.
ClearChildState Deletes the view-state and control-state information for all the server control's child controls.
ClearChildViewState Deletes the view-state information for all the server control's child controls.
CreateChildControls Used in creating child controls.
CreateControlCollection Creates a new ControlCollection object to hold the child controls.
CreateControlStyle Creates the style object that is used to implement all style related properties.
DataBind Binds a data source to the server control and all its child controls.
DataBind(Boolean) Binds a data source to the server control and all its child controls with an option to raise the DataBinding event.
DataBindChildren Binds a data source to the server control's child controls.
Dispose Enables a server control to perform final clean up before it is released from memory.
EnsureChildControls Determines whether the server control contains child controls. If it does not, it creates child controls.
EnsureID Creates an identifier for controls that do not have an identifier.
Equals(Object) Determines whether the specified object is equal to the current object.
Finalize Allows an object to attempt to free resources and perform other cleanup operations before the object is reclaimed by garbage collection.
FindControl(String) Searches the current naming container for a server control with the specified id parameter.
FindControl(String, Int32) Searches the current naming container for a server control with the specified id and an integer.
Focus Sets input focus to a control.
GetDesignModeState Gets design-time data for a control.
GetType Gets the type of the current instance.
GetUniqueIDRelativeTo Returns the prefixed portion of the UniqueID property of the specified control.
HasControls Determines if the server control contains any child controls.
HasEvents Indicates whether events are registered for the control or any child controls.
IsLiteralContent Determines if the server control holds only literal content.
LoadControlState Restores control-state information.
LoadViewState Restores view-state information.
MapPathSecure Retrieves the physical path that a virtual path, either absolute or relative, maps to.
MemberwiseClone Creates a shallow copy of the current object.
MergeStyle Copies any nonblank elements of the specified style to the web control, but does not overwrite any existing style elements of the control.
OnBubbleEvent Determines whether the event for the server control is passed up the page's UI server control hierarchy.
OnDataBinding Raises the data binding event.
OnInit Raises the Init event.
OnLoad Raises the Load event.
OnPreRender Raises the PreRender event.
OnUnload Raises the Unload event.
OpenFile Gets a Stream used to read a file.
RemovedControl Called after a child control is removed from the controls collection of the control object.
Render Renders the control to the specified HTML writer.
RenderBeginTag Renders the HTML opening tag of the control to the specified writer.
RenderChildren Outputs the contents of a server control's children to a provided HtmlTextWriter object, which writes the contents to be rendered on the client.
RenderContents Renders the contents of the control to the specified writer.
RenderControl(HtmlTextWriter) Outputs server control content to a provided HtmlTextWriter object and stores tracing information about the control if tracing is enabled.
RenderEndTag Renders the HTML closing tag of the control into the specified writer.
ResolveAdapter Gets the control adapter responsible for rendering the specified control.
SaveControlState Saves any server control state changes that have occurred since the time the page was posted back to the server.
SaveViewState Saves any state that was modified after the TrackViewState method was invoked.
SetDesignModeState Sets design-time data for a control.
ToString Returns a string that represents the current object.
TrackViewState Causes the control to track changes to its view state so that they can be stored in the object's view state property.

Example

Let us look at a particular server control - a tree view control. A Tree view control comes under navigation controls. Other Navigation controls are: Menu control and SiteMapPath control.

Add a tree view control on the page. Select Edit Nodes... from the tasks. Edit each of the nodes using the Tree view node editor as shown:

ASP.NET Edit Nodes

Once you have created the nodes, it looks like the following in design view:

ASP.NET Edit Nodes2

The AutoFormat... task allows you to format the tree view as shown:

ASP.NET AutoFormat

Add a label control and a text box control on the page and name them lblmessage and txtmessage respectively.

Write a few lines of code to ensure that when a particular node is selected, the label control displays the node text and the text box displays all child nodes under it, if any. The code behind the file should look like this:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using System.Xml.Linq;
 
namespace eventdemo {
   public partial class treeviewdemo : System.Web.UI.Page {
   
      protected void Page_Load(object sender, EventArgs e) { 
         txtmessage.Text = " "; 
      }
      
      protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) {
      
         txtmessage.Text = " "; 
         lblmessage.Text = "Selected node changed to: " + TreeView1.SelectedNode.Text;
         TreeNodeCollection childnodes = TreeView1.SelectedNode.ChildNodes;
         
         if(childnodes != null) {
            txtmessage.Text = " ";
            
            foreach (TreeNode t in childnodes) {
               txtmessage.Text += t.Value;
            }
         }
      }
   }
}

Execute the page to see the effects. You will be able to expand and collapse the nodes.

ASP.NET Control Nodes

ASP.NET Basics

posted on May 17, 2021

tags:


ASP.NET is a web development platform, which provides a programming model, a comprehensive software infrastructure and various services required to build up robust web applications for PC, as well as mobile devices. Check out this reliable .NET web hosting provider!

ASP.NET works on top of the HTTP protocol, and uses the HTTP commands and policies to set a browser-to-server bilateral communication and cooperation.

ASP.NET is a part of Microsoft .Net platform. ASP.NET applications are compiled codes, written using the extensible and reusable components or objects present in .Net framework. These codes can use the entire hierarchy of classes in .Net framework.

The ASP.NET application codes can be written in any of the following languages:

  • C#
  • Visual Basic.Net
  • Jscript
  • J#

ASP.NET is used to produce interactive, data-driven web applications over the internet. It consists of a large number of controls such as text boxes, buttons, and labels for assembling, configuring, and manipulating code to create HTML pages.

ASP.NET Web Forms Model

ASP.NET web forms extend the event-driven model of interaction to the web applications. The browser submits a web form to the web server and the server returns a full markup page or HTML page in response.

All client side user activities are forwarded to the server for stateful processing. The server processes the output of the client actions and triggers the reactions.

Now, HTTP is a stateless protocol. ASP.NET framework helps in storing the information regarding the state of the application, which consists of:

  • Page state
  • Session state

The page state is the state of the client, i.e., the content of various input fields in the web form. The session state is the collective information obtained from various pages the user visited and worked with, i.e., the overall session state. To clear the concept, let us take an example of a shopping cart.

User adds items to a shopping cart. Items are selected from a page, say the items page, and the total collected items and price are shown on a different page, say the cart page. Only HTTP cannot keep track of all the information coming from various pages. ASP.NET session state and server side infrastructure keeps track of the information collected globally over a session.

The ASP.NET runtime carries the page state to and from the server across page requests while generating ASP.NET runtime codes, and incorporates the state of the server side components in hidden fields.

This way, the server becomes aware of the overall application state and operates in a two-tiered connected way.

The ASP.NET Component Model

The ASP.NET component model provides various building blocks of ASP.NET pages. Basically it is an object model, which describes:

  • Server side counterparts of almost all HTML elements or tags, such as

    and .

     

  • Server controls, which help in developing complex user-interface. For example, the Calendar control or the Gridview control.

ASP.NET is a technology, which works on the .Net framework that contains all web-related functionalities. The .Net framework is made of an object-oriented hierarchy. An ASP.NET web application is made of pages. When a user requests an ASP.NET page, the IIS delegates the processing of the page to the ASP.NET runtime system.

The ASP.NET runtime transforms the .aspx page into an instance of a class, which inherits from the base class page of the .Net framework. Therefore, each ASP.NET page is an object and all its components i.e., the server-side controls are also objects.

Components of .Net Framework 3.5

Before going to the next session on Visual Studio.Net, let us go through at the various components of the .Net framework 3.5. The following table describes the components of the .Net framework 3.5 and the job they perform:

Components and their Description

(1) Common Language Runtime or CLR

It performs memory management, exception handling, debugging, security checking, thread execution, code execution, code safety, verification, and compilation. The code that is directly managed by the CLR is called the managed code. When the managed code is compiled, the compiler converts the source code into a CPU independent intermediate language (IL) code. A Just In Time(JIT) compiler compiles the IL code into native code, which is CPU specific.

(2) .Net Framework Class Library

It contains a huge library of reusable types. classes, interfaces, structures, and enumerated values, which are collectively called types.

(3) Common Language Specification

It contains the specifications for the .Net supported languages and implementation of language integration.

(4) Common Type System

It provides guidelines for declaring, using, and managing types at runtime, and cross-language communication.

(5) Metadata and Assemblies

Metadata is the binary information describing the program, which is either stored in a portable executable file (PE) or in the memory. Assembly is a logical unit consisting of the assembly manifest, type metadata, IL code, and a set of resources like image files.

(6) Windows Forms

Windows Forms contain the graphical representation of any window displayed in the application.

(7) ASP.NET and ASP.NET AJAX

ASP.NET is the web development model and AJAX is an extension of ASP.NET for developing and implementing AJAX functionality. ASP.NET AJAX contains the components that allow the developer to update data on a website without a complete reload of the page.

(8) ADO.NET

It is the technology used for working with data and databases. It provides access to data sources like SQL server, OLE DB, XML etc. The ADO.NET allows connection to data sources for retrieving, manipulating, and updating data.

(9) Windows Workflow Foundation (WF)

It helps in building workflow-based applications in Windows. It contains activities, workflow runtime, workflow designer, and a rules engine.

(10) Windows Presentation Foundation

It provides a separation between the user interface and the business logic. It helps in developing visually stunning interfaces using documents, media, two and three dimensional graphics, animations, and more.

(11) Windows Communication Foundation (WCF)

It is the technology used for building and executing connected systems.

(12) Windows CardSpace

It provides safety for accessing resources and sharing personal information on the internet.

(13) LINQ

It imparts data querying capabilities to .Net languages using a syntax which is similar to the tradition query language SQL.

PHP & MySQL – Environment Setup Basics

posted on May 17, 2021

tags:

In order to develop and run PHP Web pages, three vital components need to be installed on your computer system.

  • Web Server − PHP works with virtually all Web Server software, including Microsoft's Internet Information Server (IIS) but most often used is Apache Server. Download Apache for free here − https://httpd.apache.org/download.cgi

  • Database − PHP works with virtually all database software, including Oracle and Sybase but most commonly used is MySQL database. Download MySQL for free here − https://www.mysql.com/downloads/

  • PHP Parser − In order to process PHP script instructions, a parser must be installed to generate HTML output that can be sent to the Web Browser. This tutorial will guide you how to install PHP parser on your computer.

PHP Parser Installation

Before you proceed, it is important to make sure that you have proper environment setup on your machine to develop your web programs using PHP. Store the following php file in Apache's htdocs folder.

phpinfo.php

<?php
   phpinfo();
?>

Type the following address into your browser's address box.

http://127.0.0.1/phpinfo.php

If this displays a page showing your PHP installation related information, then it means you have PHP and Webserver installed properly. Otherwise, you have to follow the given procedure to install PHP on your computer.

This section will guide you to install and configure PHP over the following four platforms −

Apache Configuration

If you are using Apache as a Web Server, then this section will guide you to edit Apache Configuration Files.

Check here − PHP Configuration in Apache Server

PHP.INI File Configuration

The PHP configuration file, php.ini, is the final and immediate way to affect PHP's functionality.

Check here − PHP.INI File Configuration

Windows IIS Configuration

To configure IIS on your Windows machine, you can refer your IIS Reference Manual shipped along with IIS.

Install MySQL Database

The most important thing you will need, of course is an actual running database with a table that you can query and modify.

  • MySQL DB − MySQL is an open source database. You can download it from MySQL Official Site. We recommend downloading the full Windows installation.

  • In addition, download and install MySQL Administrator as well as MySQL Query Browser. These are GUI based tools that will make your development much easier.

  • Finally, download and unzip MySQL Connector/J (the MySQL JDBC driver) in a convenient directory. For the purpose of this tutorial we will assume that you have installed the driver at C:Program FilesMySQLmysql-connector-java-5.1.8.

  • Accordingly, set CLASSPATH variable to C:Program FilesMySQLmysql-connector-java-5.1.8mysql-connector-java-5.1.8-bin.jar. Your driver version may vary based on your installation.

Set Database Credential

When we install MySQL database, its administrator ID is set to root and it gives provision to set a password of your choice.

Using root ID and password you can either create another user ID and password, or you can use root ID and password for your JDBC application.

There are various database operations like database creation and deletion, which would need administrator ID and password.

For rest of the JDBC tutorial, we would use MySQL Database with guest as ID and guest123 as password.

If you do not have sufficient privilege to create new users, then you can ask your Database Administrator (DBA) to create a user ID and password for you.

Create Database

To create the TUTORIALSPOINT database, use the following steps −

Step 1

Open a Command Prompt and change to the installation directory as follows −

C:>
C:>cd Program FilesMySQLin
C:Program FilesMySQLin>

Note − The path to mysqld.exe may vary depending on the install location of MySQL on your system. You can also check documentation on how to start and stop your database server.

Step 2

Start the database server by executing the following command, if it is already not running.

C:Program FilesMySQLin>mysqld
C:Program FilesMySQLin>

Step 3

Create the TUTORIALSPOINT database by executing the following command −

C:Program FilesMySQLin> mysqladmin create TUTORIALSPOINT -u guest -p
Enter password: ********
C:Program FilesMySQLin>

Create Table

To create the Employees table in TUTORIALSPOINT database, use the following steps −

Step 1

Open a Command Prompt and change to the installation directory as follows −

C:>
C:>cd Program FilesMySQLin
C:Program FilesMySQLin>

Step 2

Login to the database as follows −

C:Program FilesMySQLin>mysql -u guest -p
Enter password: ********
mysql>

Step 3

Create the table Employees as follows −

mysql> use TUTORIALSPOINT;
mysql> create table Employees
   -> (
   -> id int not null,
   -> age int not null,
   -> first varchar (255),
   -> last varchar (255)
   -> );
Query OK, 0 rows affected (0.08 sec)
mysql>

Create Data Records

Finally you create few records in Employee table as follows −

mysql> INSERT INTO Employees VALUES (100, 18, 'Zara', 'Ali');
Query OK, 1 row affected (0.05 sec)

mysql> INSERT INTO Employees VALUES (101, 25, 'Mahnaz', 'Fatma');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO Employees VALUES (102, 30, 'Zaid', 'Khan');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO Employees VALUES (103, 28, 'Sumit', 'Mittal');
Query OK, 1 row affected (0.00 sec)

mysql>

101 Websites Hosting Basics

posted on May 16, 2021

tags:

Web hosting is a service of providing online space for storage of web pages. These web pages are made available via World Wide Web. The companies which offer website hosting are known as Web hosts.

The servers on which web site is hosted remain switched on 24 x7. These servers are run by web hosting companies. Each server has its own IP address. Since IP addresses are difficult to remember therefore, webmaster points their domain name to the IP address of the server their website is stored on.

It is not possible to host your website on your local computer, to do so you would have to leave your computer on 24 hours a day. This is not practical and cheaper as well. This is where web hosting companies comes in.

Types of Hosting

The following table describes different types of hosting that can be availed as per the need:

S.N.Hosting Description
1. Shared Hosting
In shared hosting, the hosting company puts thousand of website on the same physical server. Each customer has their own allocation of physical web space and a set of bandwidth limit. As all websites share same physical memory, MYSQL server and Apache server, one website on the server experiencing high traffic load will affect performance of all websites on the server.
2. Virtual Private Server (VPS)
It is also known as Virtual Dedicated Server. It is a server which is partitioned into smaller servers. In this customer is given their own partition, which is installed with its own operating system. Unlike shared hosting, VPS doesn’t share memory or processor time rather it allocates certain amount of memory and CPU to use which means that any problem on a VPS partition on the same drive will not affect other VPS customers.
3. Dedicated Server
In this kind of hosting, single dedicated server is setup for just one customer. It is commonly used by the businesses that need the power, control and security that a dedicated server offers.
4. Reseller Hosting
A reseller acts as a middle man and sells hosting space of someone else’s server.
5. Grid Hosting
Instead of utilizing one server, Grid Hosting spreads resources over a large number of servers. It is quite stable and flexible. The servers can be added or taken away from the grid without crashing the system.

101 Websites Types Basics

posted on May 16, 2021

tags:

Internet Forums

An internet forum is message board where people can hold conversation by posting messages.

 

Key Points

  • A forum can contain several sub forums.

  • Each of sub forums may contain a number of topics.

  • Within a forum’s topic, each new discussion started is called a thread.

  • This thread can be replied by as many people as so wish.

Blog

The term Blog is taken from web log. It is a kind of web site that is updated regularly, with content about almost anything. In other words, blog is a Content Management System (CMS), an easy way of publishing articles on the internet.

internet_technologies_tutorial

Blogging Terminologies

Blog

A type of website used to publish content on the internet.

Blogger

A person who writes for a blog.

Blogging

Writing for blogs is referred as blogging.

Blogosphere

A term is used to refer all the blogs on the web.

What to Blog about

Following discussion will help you to figure out what to write about and as well as what to name your blog.

  • Write what you know about. For example, if you have good computer knowledge. You can write what you know about the subject.

  • You can share your experience. You can also write what you gained from that experience, what you learned.

  • Detail your personal research.

  • Share your memory of someone.

E-commerce

E-Commerce or Electronics Commerce is a methodology of modern business which addresses the need of business organizations, vendors and customers to reduce cost and improve the quality of goods and services while increasing the speed of delivery. E-commerce refers to paperless exchange of business information using following ways.

  • Electronic Data Exchange (EDI)

  • Electronic Mail (e-mail)

  • Electronic Bulletin Boards

  • Electronic Fund Transfer (EFT)

  • Other Network-based technologies

internet_technologies_tutorial

Features

E-Commerce provides following features:

Non-Cash Payment

E-Commerce enables use of credit cards, debit cards, smart cards, electronic fund transfer via bank's website and other modes of electronics payment.

24x7 Service availability

E-commerce automates business of enterprises and services provided by them to customers are available anytime, anywhere. Here 24x7 refers to 24 hours of each seven days of a week.

Advertising / Marketing

E-commerce increases the reach of advertising of products and services of businesses. It helps in better marketing management of products / services.

Improved Sales

Using E-Commerce, orders for the products can be generated anytime, anywhere without any human intervention. By this way, dependencies to buy a product reduce at large and sales increases.

Support

E-Commerce provides various ways to provide pre sales and post sales assistance to provide better services to customers.

Portfolio

Online portfolio is collection of images, multimedia, emails, blog entries, and hyperlinks that are managed online. It can be seen as a kind of learning record that provides actual evidence of achievement.

Types

There are three types of online portfolio:

  1. Developmental (e.g. working)

  2. Reflective (e.g. learning)

  3. Representational (e.g. showcase)

Developmental portfolio contains all the things that an individual has done over a period of time.

Reflective portfolio contains personal reflection on the content.

Representational online portfolio refers to learner’s achievement in a particular work.

There are many types of websites nowadays, but each one of them requires a quality web hosting service provider like LuquidWeb.

WWW: What does it mean?

posted on May 16, 2021

tags:

WWW stands for World Wide Web. A technical definition of the World Wide Web is : all the resources and users on the Internet that are using the Hypertext Transfer Protocol (HTTP).

A broader definition comes from the organization that Web inventor Tim Berners-Lee helped found, the World Wide Web Consortium (W3C).

The World Wide Web is the universe of network-accessible information, an embodiment of human knowledge.

In simple terms, The World Wide Web is a way of exchanging information between computers on the Internet, tying them together into a vast collection of interactive multimedia resources. Web hosts are intergrated part of WWW.

Internet and Web is not the same thing: Web uses internet to pass over the information.

internet_technologies_tutorial

Evolution

World Wide Web was created by Timothy Berners Lee in 1989 at CERN in Geneva. World Wide Web came into existence as a proposal by him, to allow researchers to work together effectively and efficiently at CERN. Eventually it became World Wide Web.

The following diagram briefly defines evolution of World Wide Web:

internet_technologies_tutorial

WWW Architecture

WWW architecture is divided into several layers as shown in the following diagram:

internet_technologies_tutorial

Identifiers and Character Set

Uniform Resource Identifier (URI) is used to uniquely identify resources on the web and UNICODE makes it possible to built web pages that can be read and write in human languages.

Syntax

XML (Extensible Markup Language) helps to define common syntax in semantic web.

Data Interchange

Resource Description Framework (RDF) framework helps in defining core representation of data for web. RDF represents data about resource in graph form.

Taxonomies

RDF Schema (RDFS) allows more standardized description of taxonomies and other ontological constructs.

Ontologies

Web Ontology Language (OWL) offers more constructs over RDFS. It comes in following three versions:

  • OWL Lite for taxonomies and simple constraints.

  • OWL DL for full description logic support.

  • OWL for more syntactic freedom of RDF

Rules

RIF and SWRL offers rules beyond the constructs that are available from RDFs and OWL. Simple Protocol and RDF Query Language (SPARQL) is SQL like language used for querying RDF data and OWL Ontologies.

Proof

All semantic and rules that are executed at layers below Proof and their result will be used to prove deductions.

Cryptography

Cryptography means such as digital signature for verification of the origin of sources is used.

User Interface and Applications

On the top of layer User interface and Applications layer is built for user interaction.

WWW Operation

WWW works on client-server approach. Following steps explains how the web works:

  1. User enters the URL (say, https://www.google.com) of the web page in the address bar of web browser.

  2. Then browser requests the Domain Name Server for the IP address corresponding to www.google.com.

  3. After receiving IP address, browser sends the request for web page to the web server using HTTP protocol which specifies the way the browser and web server communicates.

  4. Then web server receives request using HTTP protocol and checks its search for the requested web page. If found it returns it back to the web browser and close the HTTP connection.

  5. Now the web browser receives the web page, It interprets it and display the contents of web page in web browser’s window.

internet_technologies_tutorial

Future

There had been a rapid development in field of web. It has its impact in almost every area such as education, research, technology, commerce, marketing etc. So the future of web is almost unpredictable.

Apart from huge development in field of WWW, there are also some technical issues that W3 consortium has to cope up with.

User Interface

Work on higher quality presentation of 3-D information is under deveopment. The W3 Consortium is also looking forward to enhance the web to full fill requirements of global communities which would include all regional languages and writing systems.

Technology

Work on privacy and security is under way. This would include hiding information, accounting, access control, integrity and risk management.

Architecture

There has been huge growth in field of web which may lead to overload the internet and degrade its performance. Hence more better protocol are required to be developed.

101 Firewall Security Basics

posted on May 16, 2021

tags:

Firewall is a barrier between Local Area Network (LAN) and the Internet. It allows keeping private resources confidential and minimizes the security risks. It controls network traffic, in both directions. Quality web host takes firewall security very seriously.

The following diagram depicts a sample firewall between LAN and the internet. The connection between the two is the point of vulnerability. Both hardware and the software can be used at this point to filter network traffic.

internet_technologies_tutorial

There are two types of Firewall system: One works by using filters at the network layer and the other works by using proxy servers at the user, application, or network layer.

Key Points

  • Firewall management must be addressed by both system managers and the network managers.

  • The amount of filtering a firewall varies. For the same firewall, the amount of filtering may be different in different directions.

101 Internet Security Basics

posted on May 16, 2021

tags:

Internet security refers to securing communication over the internet. It includes specific security protocols such as:

  • Internet Security Protocol (IPSec)

  • Secure Socket Layer (SSL)

Reputable web hosting companies always take internet security very seriously.

Internet Security Protocol (IPSec)

It consists of a set of protocols designed by Internet Engineering Task Force (IETF). It provides security at network level and helps to create authenticated and confidential packets for IP layer.

Secure Socket Layer (SSL)

It is a security protocol developed by Netscape Communications Corporation. ). It provides security at transport layer. It addresses the following security issues:

  • Privacy

  • Integrity

  • Authentication

Threats

Internet security threats impact the network, data security and other internet connected systems. Cyber criminals have evolved several techniques to threat privacy and integrity of bank accounts, businesses, and organizations.

Following are some of the internet security threats:

  • Mobile worms

  • Malware

  • PC and Mobile ransomware

  • Large scale attacks like Stuxnet that attempts to destroy infrastructure.

  • Hacking as a Service

  • Spam

  • Phishing

Email Phishing

Email phishing is an activity of sending emails to a user claiming to be a legitimate enterprise. Its main purpose is to steal sensitive information such as usernames, passwords, and credit card details.

Such emails contains link to websites that are infected with malware and direct the user to enter details at a fake website whose look and feels are same to legitimate one.

What a phishing email may contain?

Following are the symptoms of a phishing email:

Spelling and bad grammar

Most often such emails contain grammatically incorrect text. Ignore such emails, since it can be a spam.

Beware of links in email

Don’t click on any links in suspicious emails.

Threats

Such emails contain threat like “your account will be closed if you didn’t respond to an email message”.

Spoofing popular websites or companies

These emails contain graphics that appear to be connected to legitimate website but they actually are connected to fake websites.

101 Web Server Basics

posted on May 16, 2021

tags:

Web server is a computer where the web content is stored. Basically web server is used to host the web sites but there exists other web servers also such as gaming, storage, FTP, email etc.

Web site is collection of web pages whileweb server is a software that respond to the request for web resources.

Web Server Working

Web server respond to the client request in either of the following two ways:

  • Sending the file to the client associated with the requested URL.

  • Generating response by invoking a script and communicating with database

internet_technologies_tutorial

Key Points

  • When client sends request for a web page, the web server search for the requested page if requested page is found then it will send it to client with an HTTP response.

  • If the requested web page is not found, web server will the send an HTTP response:Error 404 Not found.

  • If client has requested for some other resources then the web server will contact to the application server and data store to construct the HTTP response.

Architecture

Web Server Architecture follows the following two approaches:

  1. Concurrent Approach

  2. Single-Process-Event-Driven Approach.

Concurrent Approach

Concurrent approach allows the web server to handle multiple client requests at the same time. It can be achieved by following methods:

  • Multi-process

  • Multi-threaded

  • Hybrid method.

Multi-processing

In this a single process (parent process) initiates several single-threaded child processes and distribute incoming requests to these child processes. Each of the child processes are responsible for handling single request.

It is the responsibility of parent process to monitor the load and decide if processes should be killed or forked.

Multi-threaded

Unlike Multi-process, it creates multiple single-threaded process.

Hybrid

It is combination of above two approaches. In this approach multiple process are created and each process initiates multiple threads. Each of the threads handles one connection. Using multiple threads in single process results in less load on system resources.

Examples

Following table describes the most leading web servers available today:

S.N.Web Server Descriptino
1 Apache HTTP Server
This is the most popular web server in the world developed by the Apache Software Foundation. Apache web server is an open source software and can be installed on almost all operating systems including Linux, UNIX, Windows, FreeBSD, Mac OS X and more. About 60% of the web server machines run the Apache Web Server.
2. Internet Information Services (IIS)
The Internet Information Server (IIS) is a high performance Web Server from Microsoft. This web server runs on Windows NT/2000 and 2003 platforms (and may be on upcoming new Windows version also). IIS comes bundled with Windows NT/2000 and 2003; Because IIS is tightly integrated with the operating system so it is relatively easy to administer it.
3. Lighttpd
The lighttpd, pronounced lighty is also a free web server that is distributed with the FreeBSD operating system. This open source web server is fast, secure and consumes much less CPU power. Lighttpd can also run on Windows, Mac OS X, Linux and Solaris operating systems.
4. Sun Java System Web Server
This web server from Sun Microsystems is suited for medium and large web sites. Though the server is free it is not open source. It however, runs on Windows, Linux and UNIX platforms. The Sun Java System web server supports various languages, scripts and technologies required for Web 2.0 such as JSP, Java Servlets, PHP, Perl, Python, and Ruby on Rails, ASP and Coldfusion etc.
5. Jigsaw Server
Jigsaw (W3C's Server) comes from the World Wide Web Consortium. It is open source and free and can run on various platforms like Linux, UNIX, Windows, and Mac OS X Free BSD etc. Jigsaw has been written in Java and can run CGI scripts and PHP programs.

What is a Web Server?

posted on April 25, 2021

tags:

The term web server can refer to hardware or software, or both of them working together.

On the hardware side, a web server is a computer that stores web server software and a website's component files. (for example, HTML documents, images, CSS stylesheets, and JavaScript files) A web server connects to the Internet and supports physical data interchange with other devices connected to the web.
On the software side, a web server includes several parts that control how web users access hosted files. At a minimum, this is an HTTP server. An HTTP server is software that understands URLs (web addresses) and HTTP (the protocol your browser uses to view webpages). An HTTP server can be accessed through the domain names of the websites it stores, and it delivers the content of these hosted websites to the end user's device.

At the most basic level, whenever a browser needs a file that is hosted on a web server, the browser requests the file via HTTP. When the request reaches the correct (hardware) web server, the (software) HTTP server accepts the request, finds the requested document, and sends it back to the browser, also through HTTP. (If the server doesn't find the requested document, it returns a 404 response instead.)

Basic representation of a client/server connection through HTTP

To publish a website, you need either a static or a dynamic web server.

A static web server, or stack, consists of a computer (hardware) with an HTTP server (software). We call it "static" because the server sends its hosted files as-is to your browser.

A dynamic web server consists of a static web server plus extra software, most commonly an application server and a database. We call it "dynamic" because the application server updates the hosted files before sending content to your browser via the HTTP server.

For example, to produce the final webpages you see in the browser, the application server might fill an HTML template with content from a database. Sites like MDN or Wikipedia have thousands of webpages. Typically, these kinds of sites are composed of only a few HTML templates and a giant database, rather than thousands of static HTML documents. This setup makes it easier to maintain and deliver the content.

To review: to fetch a webpage, your browser sends a request to the web server, which searches for the requested file in its own storage space. Upon finding the file, the server reads it, processes it as-needed, and sends it to the browser. Let's look at those steps in more detail.

Hosting files


First, a web server has to store the website's files, namely all HTML documents and their related assets, including images, CSS stylesheets, JavaScript files, fonts, and video.

Technically, you could host all those files on your own computer, but it's far more convenient to store files all on a dedicated web server because:

  • A dedicated web server is typically more available. (up and running)
  • Excusing downtime and systems troubles, a dedicated web server is always connected to the Internet.
  • A dedicated web server can have the same IP address all the time. This is known as a dedicated IP address. (not all ISPs provide a fixed IP address for home lines)
  •  A dedicated web server is typically maintained by a third-party.

For all these reasons, finding a good hosting provider is a key part of building your website. Examine the various services companies offer. Choose one that fits your needs and budget. (Services range from free to thousands of dollars per month.) You can find more details in this article.

Once you have web hosting service, you must upload your files to your web server.
Communicating through HTTP

Second, a web server provides support for HTTP (Hypertext Transfer Protocol). As its name implies, HTTP specifies how to transfer hypertext (linked web documents) between two computers.

A Protocol is a set of rules for communication between two computers. HTTP is a textual, stateless protocol.

Textual

  • All commands are plain-text and human-readable.
  • Stateless
  •  Neither the server nor the client remember previous communications. For example, relying on HTTP alone, a server can't remember a password you typed or remember your progress on an incomplete transaction. You need an application server for tasks like that. (We'll cover that sort of technology in other articles.)

HTTP provides clear rules for how a client and server communicate. We'll cover HTTP itself in a technical article later. For now, just be aware of these things:

  • Only clients can make HTTP requests, and then only to servers. Servers can only respond to a client's HTTP request.
  • When requesting a file via HTTP, clients must provide the file's URL.
  • The web server must answer every HTTP request, at least with an error message.

The MDN 404 page as an example of such error pageOn a web server, the HTTP server is responsible for processing and answering incoming requests.

  • Upon receiving a request, an HTTP server first checks if the requested URL matches an existing file.
  • If so, the web server sends the file content back to the browser. If not, an application server builds the necessary file.
  • If neither process is possible, the web server returns an error message to the browser, most commonly 404 Not Found. (The 404 error is so common that some web designers devote considerable time and effort to designing 404 error pages.4
  • Static vs. dynamic content

Roughly speaking, a server can serve either static or dynamic content. Remember that the term static means "served as-is". Static websites are the easiest to set up, so we suggest you make your first site a static site.

The term dynamic means that the server processes the content or even generates it on the fly from a database. This approach provides more flexibility, but the technical stack is more complex, making it dramatically more challenging to build a website.

There are so many application server technologies that it's difficult to suggest a particular one. Some application servers cater to specific website categories like blogs, wikis, or eCommerce; others are more generic. If you're building a dynamic website, take the time to choose technology that fits your needs. Unless you want to learn web server programming (which is an exciting area in itself!), you don't need to create your own application server.

How Does a Web Server Work?

posted on April 11, 2021

tags:

You have probably come to this site to find a company that provides Web servers or Web hosting services. But do you actually know how these hosting machines work? It's a good idea to know a little bit about the product or service you are searching for before you begin your quest.

First, it's important to note that this is a two-sided story. Web servers are responsible for storing and exchanging information with other machines. Because of this, at least two participants are required for each exchange of information: a client, which requests the information, and a server, which stores it. Each side also requires a piece of software to negotiate the exchange of data; in the case of the client, a browser like Netscape or Internet Explorer is used.

On the server side, however, things are not as simple. There is a myriad of software options available, but they all have a similar task: to negotiate data transfers between clients and servers via Hypertext Transfer Protocol, the communications protocol of the Web. What type of server software you are able to run depends on the Operating System chosen for the server. For example, Microsoft Internet Information Server is a popular choice for Windows NT, while many Unix fans choose Apache Web server.
A simple exchange between the client machine and Web server goes like this:

1. The client's browser dissects the URL in to a number of separate parts, including address, path name and protocol.

2. A Domain Name Server (DNS) translates the domain name the user has entered in to its IP address, a numeric combination that represents the site's true address on the Internet (a domain name is merely a "front" to make site addresses easier to remember).

3. The browser now determines which protocol (the language client machines use to communicate with servers) should be used. Examples of protocols include FTP, or File Transfer Protocol, and HTTP, Hypertext Transfer Protocol.

4. The server sends a GET request to the Web server to retrieve the address it has been given. For example, when a user types http://www.example.com/1.jpg, the browser sends a GET 1.jpg command to example.com and waits for a response. The server now responds to the browser's requests. It verifies that the given address exists, finds the necessary files, runs the appropriate scripts, exchanges cookies if necessary, and returns the results back to the browser. If it cannot locate the file, the server sends an error message to the client.

5. The browser translates the data it has been given in to HTML and displays the results to the user.

This process is repeated until the client browser leaves the site.

Aside from its functions listed above, the Web server also has an additional number of responsibilities. Whereas a Web browser simply translates and displays data it is fed, a Web server is responsible for distinguishing between various error and data types. A Web server must, for example, designate the proper code for any sort of internal error and send that back to the browser immediately after it occurs. It also has to distinguish between various elements on a Web page (such as .GIFs, JPEGS and audio files) so that the browser knows which files are saved in which format. Depending on the site's function, a Web server may also have numerous additional tasks to handle, including logging statistics, handling security and encryption, serving images for other sites (for banners, pictures, etc), generating dynamic content, or managing e-commerce functions.

Now that you've had a behind-the-scenes tour of a Web server, you can appreciate all the work that goes in to delivering a single page of content to your computer screen. Use this knowledge to your advantage, and keep it in mind when shopping around for your next host.