What is a Firewall

What is a Firewall ?


Most commonly you would have came across a term call as a firewall while using internet.Let's see what does it really mean.

  • A firewall can either be a hardware or a software.
  • It can be called as a network security system that monitors and controls traffic to a private network based on some defined security rules.
  • It blocks unwanted traffic and permits wanted traffics.
So what is traffic here?
  • we commonly define traffic as the amount of data moving across a network at a given point of time.
In today's world every network(office,business) should have a firewall to keep their network safe.

  • The one way that the firewall controls the flow of traffic in to and out of the network is by Access Control List(ACL).
  • a ACL consist of the list of members who can access the network through the firewall.
  • Example:

                    A firewall has the following ACL
                        165.43.99.03 --> Allow
                        172.15.16.10 -->Deny
                        45.90.172.66 --> Allow

  • Then only the IP addresses 165.43.99.03 and 45.90.172.66 can access and pass through this firewall
  • When ever 172.15.16.10 tries to access the firewall it blocks its request.
Some firewall comes with implicit deny rules.for example a firewall can allow only access to port 80 i.e. the websites.so we cannot access other things such as ftp , smtp etc..
  • one of the example of the firewall is the Host based fire wall.
  • It is a software based firewall.
  • It is installed on a computer only and it protects that computer alone.
  • Later versions of windows comes with host based firewall called as windows firewall.we can enable it or disable it as per our need.
  • we can also install third party firewall softwares . such as Glash wire, zonealarm , peerblock etc..


  • An another example of firewall is the network based firewall .
  • It is a combination of hardware and software.
  • It protects an entire network.





A real time application of firewall is that we know that some websites are not allowed in some countries .
  • In this case all the ISP who are serving the internet to the users use a fire wall to block the users in that particular country from accessing the list of sites.

note: you can read my previous posts at  https://iamafutureprogrammer.blogspot.com/

If you have any queries ask in the comment section below.......Thank you ....


Ping and Traceroute


we have discussed about IP addresses , network basics in our previous post .if you have not read them read them first to get a better understanding.





What is ping ?
  • It is a command in command prompt(windows).
  • ping is used to test weather the destination is reachable by the source.
  • Example:
  • If I want to reach www.youtube.com then by using ping command we can find out weather we can reach the node or node.
Working is as follows,
  • source send request messages to the destination computer,that request messages are called as ICMP (Internet Control Message Protocol).
  • After sending request message the source waits for the response message from the destination.
  • If the source receives the response message then it means that the destination is available otherwise its means that destination is not available.
You can try this command by,
  • go to start -> type cmd -> click command prompt
now command prompt opens (make sure you have connected to internet before executing the command,if no internet connection it will say " host not available")
  • type " ping(space)hostname ", host name can be www.google.com or www.facebook.com etc...
  • note: enter the full address (not as facebook or facebook.com).


case 1: when the host you request is available 
 


  • In the above picture we can see that we have made a request to youtube.com as " ping www.youtube.com " .we can also ping for any other host such as google.com,facebook.com etc...
  • we can see 32 bytes of data is sent as request data.
  • you can see 172.217.31.206 is the IP address of youtube and we get four reply messages (packets) from the host (here host is youtube.com)
  • it also says the time taken to send reply in milli seconds and TTL stands for time to live .
  • there is no loss since we got response for all the four packets we sent.
case 2  : when the host is not available or not internet connected

  • In the above image you can see that we have requested for a host called www.gooooogleeee.com which is not a available host.so it says ping request could not find the host.

What is traceroute?
  • traceroute is also a command used in command prompt.
  • As we know that when a request is made from source (packet are sent) they travel through number of intermediate node(routers) to reach the destination .
  • By using traceroute we can we the path and nodes through which the packets reaches the destination.
Using traceroute in windows,
  1. go to start
  2. type cmd and click on command prompt
  3. command prompt opens(make sure you connected to internet)
  4. type " tracert www.facebook.com" and hit enter.
  5. Note: we use the command " traceroute " in mac and " tracert " in windows
Example:


  • In the above example we have a tracert request to www.facebook.com
  • 157.240.192.35 is the IP address of facebook as seen in the picture.
  • It took 11 hops to reach the facebook.com (hops is the number of intermediate routers the packet is traversed through).

Note: there is not a single IP address for www.facebook.com or www.youtube.com the IP address may change based on the traffic.
If a particular facebook server has more traffic and i am requesting a facebook page at that time then the request goes to another facebook server with less traffic.

If you have any doubts ask in the comment section below.....Thank you....



Browsing the Web(Working)

How we get a Web Page on Our browser?

Note: To get a better under standing read my previous post on IP address and continue here...


We all would have used some browsers such as Mozila firefox,chrome,safari,opera etc... 

you would have entered some website such as "www.google.com" in the url of the browser and you have the google page on the browser window. 

Do you admired how it works? Let's explore how it works in this post.

Before we see how it works we have to know about some terms such as Web Server, DNS and Browser .

First we will Start with Browser.so what is a browser?

                     A Browser is a software that can request files to                 server and receive files from the Web server and display it on           the browser screen.(i.e. Downloading and viewing website) 
     Examples:      Google Chrome, Mozilla Firefox , Opera Mini           ,Internet Explorer etc...

what is  a Web Server?
            
                      A web server is simply a computer that has a higher           performance and a dedicated software what servers the request         from the client  by sending response  .The servers are                       connected with data centres to retrive the data required by the           client. 
                      It is estimated that 75 million servers powering the             Internet.
                      Each server has a IP address e.g. www.google .com            has a IP address of 172.217.7.23  you can reach out google              using this IP also. there are many google servers at different            location and google has some more IP also.


Lets see what is a DNS Server,
                      A DNS stands for Domain Name System or Domain           Name Server.
                     The purpose of a DNS server is to map the website              name (domain name)in to its respective IP address.
                     As I said before google has Ip address of                              172.217.7.23      
                      Each node in a network is identified with the help of             IP address only .for the easy usage for humans only we are               using names such as google.com , youtube.com etc..

Lets now see how it works,

step 1: You type in your browser url www.google .com and hit enter.then the browser see that it is a domain name so it send the request to DNS server to find out its IP address.and the DNS maps its name with respective IP address and send back the IP address to the browser.

step 2:Now the browser has the IP address now it request that particular server on that IP address and it copies the index.html and some files of google and download it to the browser screen.
Step 3: now you can see google page on your browser.


 other cases,
      now your browser knows the IP address of google.com it will store it on the browser's cache memory,so the next time when you search for google.com the IP address is found on the computer itself so the step 1(request to DNS) is skipped.


Note: we will discuss about the Advance working of DNS server , what is html, css, js in upcoming post .....

If any doubts type in comment section below....  Thank you.....                                     
      



IP Address(Advance)

IP Address(Advance)

In our previous post we have discussed about IP address basis.I hope you will have some idea about IP address now. If you have not read my previous post on IP address(basic) read it first and continue this for a better understanding.





Now lets have a quick recap on IP address ,
  • It is a numeric address
  • It is an identifier for a computer or a device on a network
  • Every device on a network need to have an IP address to communicate.
IP address consist of two parts 
  1. Network address
  2. Host address
IP address are of two types
  1. IPv4(commonly used)
  2. IPv6

IPv4 address looks as follow:


                       "  68.123.78.3 " (four digits separated by a dot)

  • each digit is called a octet.
  • The number range in each octet is from 0 to 255.
  • By changing the octets it is possible to get up to 4 billion combination of IP address. 

IPv6 address looks as follow:


           " 12DC:567A:FA12:9DC6:47A2:54AB:EE44:654B "

  • It is a 128 bit hexadecimal address.
  • Hexadecimal uses both numbers and alphabets(A to F){A means 10 ...... F means 15}
  • It is the next generation of IP address.
  • It is capable of producing 340 undecillion addresses.

Now lets see what is called as subnet mask,


As I said earlier IP address consist of two parts,they are network id and host id,

The above picture shows that there are three class of subnet mask(A,B,C) but actually there are 5 classes but its enough to know about first three classes.


  • The class A IP address supports 60 million hosts on 126 networks.
  • This class is mainly given to very large organisations because of very tremendous number of IP addresses.

  • The class B IP address supports 65 thousand hosts on 16 thousand networks.
  • It is given to medium sized organizations.

  • The class C IP address supports 254 hosts on 2 million networks.
  • It is given to small organisations.

Now lets discuss about public and private IP address,

  • Public IP addresses are publicly registered on the internet.(i.e, if you have a public IP address you can access the Internet) 
  •  Private IP addresses are not publicly registered so you cannot directly access the internet with it.
Private IP addresses are used in small area network such as schools,collages etc.. where the institute has only one registered public IP address and all the nodes in that network has a private IP addresses .when the node what to access the internet it makes mask the Public IP of the Admin node(i.e,the node with public IP).

The main reason for using it to prevent shortage of public IP addresses.


The private IP addresses are of the above Three classes.



Note:Lets discuss some more intresting topics in the upcoming posts....

If any doubts aask in the comment section below......Thankyou.



What is IP Adress

IP Address(basic):

In our previous post we have seen the basic of network.You might have noted that I used a term called source address and destination address.These are nothing but the IP address.

if you have not read our previous post ,you can read that through the link below and read this for a better understanding.

Lets get started...

What is IP ?
  • IP means Internet Protocol address.
  • There are two types of IP address .
  • They are IPv4 and IPv6.
  • IPv4 stands for Internet Protocol version 4 and IPv6 for Internet Protocol version 6.
Why we need IP address?
  • The answer is just simple. Your house has a address why?.  The answer is that anyone can find out you house using your house address i.e.they are unique
  • Similarly,IP address is used to find each node in a network.(if person A want to send a message to person B then a uses the IP address of B to send the message).
  • you can see your computers IP address as follows,

  1. first connect your computer or laptop to internet.
  2. for windows user, Go to command prompt or press ctrl+R and type cmd and hit enter.
  3. you will see a black screen open as shown in above picture its command prompt .
  4. then type the command   ipconfig   and hit enter you can see the Ipv4 address of your node in the list.
  5. for mac user,Go to terminal and type ifconfig
  6. you can find the lot of information on it . so just look on to Inet address on it.it is your ip address.
Why there are two types of IP address?
  • As i said before we have IPv4 and IPv6 address ,First IPv4 was the commonly used then only IPv6 came in to action.
  • The reason is that we can make only 4.3 billion combination of IPv4 address but as you know in current world we have approximately 24 billion devices ,In order to fulfill this need of IP address they introduced the concept of IPv6 address.
  • now IPv6 can make up to 340 undecillion addresses.
So in today's world Our device have both IPv4 and IPv6 address.
but still we are using IPv4 address commonly.

Is IP address are Static for a device?
  • The IP address can be allocated to a device Statically and dynamically.
  • Static allocation means the ip address is fixed to the device.
  • Dynamic allocation means the ip address of device keeps on changing.
  • most commonly all our mobile and computer uses dynamic IP.
  • the servers are also nodes and they uses static Ip address (example : ip address of google servers cannot change dynamically as they are used by many users).
How a IPv4 address and IPv6 address looks like?
  • IPv4 - It is a 32 bit address.
  • it looks like " 172.15.102.16 "
  • IPv6  - It is a 128 bit address.
  • it looks like "2001:0db8:85a3:0000:0000:8a2e:0370:7334"


Note:We can discuss about Ip address(advance),servers,databases and website in the upcoming posts...

If any doubts ask in the comment section below..Thank you 


Basics Of Network

Basics Of Network


Before we see how internet works first we can see what is an Internet.
so , what is Internet?
  •    Simply we can say that internet is a  Inter Connection of large number of networks.
Now you may have a question , what is a network?
  • In simple term network can be defines as It is a Collection of nodes connected with each other through a wired( Fibre optic cable) or wireless (Radio waves)connection.
  • Each network has a hub or switch and a router that transfer data to a another network.

Now you may have a question , what is a node and what is hub and switch?

  • A node is any devices such as a Computer , laptop , mobile phones etc.
  • A  router is a device which guides in sending the data packet from its source to destination i.e. from one network to another network.
  • data packet sent from one node will be send through a switch or a hub to the destination node with in a particular network. 
So what is a packet?
  • packet - as we use packets in our daily life it will hold something here it hold the data.
  • example : you are sending hello message to your friend ."hello" is the data and it is put inside a packet and sent over the network.
You may now ask ,why we need a packet ,we can send data directly?
  • The reason is that packet holds additional information in addition to the data(hello) .they are sender address ,receiver address,size of packet etc.
How Internet works.
  • let assume you are sending a 'Hi' message to your friend in US.
  • first the data 'Hi' is put in a packet with your friends address(Destination Address) .
  • The switch Checks whether the destination address is in your network is so the switch will redirect the packet to the destination.else it forwards the packet to router and the router look at the destination address and forward packer to that respective networks router then it sends the packet to the corresponding network switch and then it send the packet to the destination(your friend receives 'Hi' message).

Note:We can discuss about destination and source address ,routing some other details in next post .

If any doubts ask in the comment section below...Thank you 






C Code 31 _ To Print the Prime numbers with in the given number range



C Code 31 _ To Print the Prime numbers with in the given number range


Sample Input : 10

Sample Output  : 2 , 3 , 5 , 7 

 

Program:


#include<stdio.h>
int main()
{
                int n,i,j,f;
                printf("\nEnter a number to find prime numbers with in that number : ");
                scanf("%d",&n);
                printf("\n\nThe Prime numbers with in %d are : ",n);
                for(i=1;i<=n;i++)
                {
                                f=0;
                                for(j=1;j<=n;j++)
                                {
                                                if(i%j==0)
                                                {
                                                                f=f+1;
                                                }
                                }
                                if(f==2)
                                {
                                                printf("%d ",i);
                                }
                }
                return 0;
}




Output:








Thank You ...

C Code 30 _ To Find the Number of handshakes possible between people such that a person can hand shake only once [Wipro Programming Question]

C Code 30 _ To Find the Number of handshakes possible between people such that a person can hand shake only once [Wipro Programming Question]

sample Input : 5

sample output: 10

solving:  5 persons(a,b,c,d,e).  a can give hand shake to b,c,d,e (so 4) , b can give hand shake to c,d,e (so 3) , c can give hand shake to d,e (so 2) , d can give hand shake to e (so 1) . totally 4+3+2+1 = 10 .

Program:


#include<stdio.h>
int main()
{
int n,ans;
printf("\nEnter the number of peoples : ");
scanf("%d",&n);
if(!(n<0))
{
ans=n*(n-1)/2;
printf("\n\nNumber of hand shakes possible : %d",ans);
}
else
{
printf("\n\nEnter only positive values");
}
return 0;
}


Output:
















Thank You ...

C Code 29 _ To find the Position of a person diametrically Opposite on a circle [Wipro Programming Question]



C Code 29 _ To find the Position of a person diametrically Opposite on a circle  [Wipro Programming Question]




Program:


#include<stdio.h>
int main()
{
                int n,pos,opp;
                printf("\nEnter the number of persons in the circle (Enter only even numbers) : ");
                scanf("%d",&n);
                if(n%2==0)
                {
                                printf("\nEnter the position of person from 1 to %d to find the opposite person to him on the circle : ",n);
                                scanf("%d",&pos);
                                if(pos<=n&&pos>0)
                                {
                                                if(pos>(n/2))
                                                {
                                                                opp=pos-(n/2);
                                                }
                                                else
                                                {
                                                                opp=pos+(n/2);
                                                }
                                                printf("\nThe person opposite to %d is %d",pos,opp);
                                }
                                else
                                {
                                                printf("\nEnter position from 1 to %d only",n);
                                }
                }
                else
                {
                                printf("\nEnter only even numbers");
                }
                return 0;
}




Output:














Thank You ...

C Code 28 _ Convert a Base 17 number to a Decimal number[TCS NQT Programming Question]


C Code 28 _ Convert a Base 17 number to a Decimal number[TCS NQT Programming Question]

Given a maximum of 4 digit to the base 17,(A -> 10 , B -> 11 , C -> 12 , D -> 13 , E -> 14 , F ->15 , G -> 16 ) as Input , output is a decimal value.
Example : 
input  : 1A
output : 27

solving: A means 10 , so (10 * 17 ^ 0) + (1 * 17 ^ 1) = 27

simillarly,
 input : 1B2 
output : 478

Solving : B means 11 , so  (2 * 17 ^ 0) + (11 * 17 ^ 1) + (1 * 17 ^ 2) = 478 


Program:


#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
                char a[20];
                int i,n,l,j=0,sum=0;
                printf("\nEnter the Input : ");
                scanf("%s",a);
                l=strlen(a);
                for(i=l-1;i>=0;i--)
                {
                                if(a[i]>=65&&a[i]<=90)
                                {
                                                n=a[i]-65+10;
                                }
                                if(a[i]>=48&&a[i]<=57)
                                {
                                                n=a[i]-48;           
                                }
                                sum=sum+n*pow(17,j);
                                j++;       
                }
                printf("\n\nThe Output is : %d",sum);
                return 0;
}





Output:







Thank You ...

Popular Posts