Archive

Author Archive

How to configure a switch port to work in Promiscuous mode?


Following are the steps to configure a switch port to work in promiscuous mode.

  1. Connect to console port (using hyper terminal [port com1, speed 9600 bps]).
  2. Run the following commands:

    # configure terminal.

    # no monitor session 1.

    # monitor session 1 source interface fastEthernet 0/1.

    # monitor session 1 destination interface fastEthernet 0/24.

    # encapsulation dot1q.

    # end

    # show monitor session1.

     

    [Note: Promiscuous mode refers to the special mode of Ethernet hardware, in particular network interface cards (NICs), that allows a NIC to receive all traffic to the network, even if it is not addressed to this NIC. In a wider sense, promiscuous mode also refers to network visibility from a single observation point.]

Advertisements

Programming Language C : Part 3

April 27, 2009 2 comments

Last day, I’d ended on the basic structure of the C Programming Language. Today, we shall start to do real programming. It is really fun.

Ok. Lets do a small program to print your name:

c1

This program will give you output like: c2

Now, we shall move to DATA Types.

As we know, there are many types of data in our real world. For example, the Integers, the Floating point numbers, Characters etc.

In case of C, there also exist all of them. In case, we want to use them, we need to “INITIALIZE” them to the Compiler. The method is like this:

c3Here we can see, “int a” declares an integer called ‘a’ without any value. But, “int b = 5” declares an integer called ‘b’ with a value 5 assigned in it. Similarly for floating point numbers, ‘float’ is used and for characters, “char” is used. All these ‘int’ or ‘float’ or ‘char’ are called “keywords” in C.

We shall look further more keywords in C:

c4

All these keywords have their own meanings and jobs to do. We shall look them further, while we will need them in future.

Now, there is a question. I know, I can use int as a keyword to mean the integers. But, how long that integer can be? Int x = 1234567891011121314151617…..??? There should be a limit of this.

char     => a single byte, capable of holding one character in the local character set

int        => an integer, typically reflecting the natural size of integers on the host machine

float     => single-precision floating point

double =>  double-precision floating point

In addition, there are a number of qualifiers that can be applied to these basic types. short

and long apply to integers:

short int sh;

long int counter;

The word int can be omitted in such declarations, and typically it is. The intent is that short and long should provide different lengths of integers where practical; int will normally be the natural size for a particular machine. short is often 16 bits long, and int either 16 or 32 bits. Each compiler is free to choose appropriate sizes for its own hardware, subject only to the the restriction that shorts and ints are at least 16 bits, longs are at least 32 bits, and short is no longer than int, which is no longer than long.  The qualifier signed or unsigned may be applied to char or any integer. unsigned numbers are always positive or zero, and obey the laws of arithmetic modulo 2n, where n is the number of bits in the type. So, for instance, if chars are 8 bits, unsigned char variables have values between 0 and 255, while  signed chars have values between -128 and 127 (in a two’s complement machine.) Whether plain  chars are signed or unsigned is machine-dependent, but printable characters are always positive.  The type long double specifies extended-precision floating point. As with integers, the sizes of floating-point objects are implementation-defined; float, double and long double could represent one, two or three distinct sizes.

C Programming: Part 2

April 16, 2009 1 comment

Hello friends! After a long time, I am back with the Programming Language C.

In regard of the last post and the comments posted by our readers, I must insist you trying all of these in Linux / UNIX also. In Linux / UNIX, you don’t need any 3rd party software line ‘Turbo C’ in Windows. In the OS itself, the ‘gcc’ (GNU’s C Compiler) compiler is preloaded. You just need to call the ‘gcc’ and then compile/run the program.

Now, we will go into the C programming!

Before everything, we will write a C program first.

Windows: Open Turbo C è write this code.

Linux / UNIX: Open terminal ècreate ‘hello.c’ in the VI editor è write this code.


#include <stdio.h>

#include <conio.h>

int main()

{

printf(“ Hello World.”);

getch();

return 0;

}

Now, we will look, what are these lines signify:

Line 1 and 2: These are called “Pre-Processor Directives”. We include these “.h” files rather “header files” in our program to use some of their properties. These properties are called “Functions”. Here, in line 5, 6 and 7, you will see some “printf”, “getch” and “return”…these are those Functions. The “printf” and “return” functions are from the header file “stdio.h” (the ‘stdio’ means STANDARD INPUT OUTPUT and ‘conio’ means CONSOLE INPUT OUTPUT) and the “getch” is from the header file “conio.h”. Remember, other than these Functions, we ourselves can also write Functions as we wish.

Line 3: This line indicates the ‘Return type’ and ‘Name’ of a user written function (as I’d said in last paragraph). Now, to know what is ‘return type’ needs some more knowledge in C. So, we will discuss that later. Now, ‘name’. Here as we can see, after the ‘return type’ called ‘int’, there is the name of this function “main”. Now, a question arises, why ‘main’? The reason is, in any C program, there may exist more than 1 function and all of them are controlled by 1 function. Now, to get rid of the question, among those functions, which one is the 1st one, that controls other functions? The answer is: the main function. It’s like the main door of a building. After traversing through it, you can go anywhere in the building. So, here no other function exists, hence, the main door is the ‘main’ function.

Line 4 and 8: You can see these are nothing but, an opening parenthesis and a closing parenthesis. This opening means the starting of any function and closing means the closing of the same.

Line 5, 6 and 7: “printf” is a function, whose job is to print something. Inside the two brackets, there are two upper commas. Inside those ‘upper commas’, if you write some thing, that will be shown to you in the monitor when that program will run. Similarly, “getch” and “return” has some jobs to do. These jobs will be cleared to us when we will have some more knowledges in C.

One more thing, if you have noticed, you can see there is a semicolon (;) after every line inside the main function. This semicolon indicates the ‘End of the Line’.

Now, to compile:

Windows: (in Turbo C) F2 (to save the program) è Alt + F9.

Linux / UNIX: (after saving the program in VI editor) gcc -c -a hello.c

Now, to Run:

Windows: (after compilation) Ctrl + F9.

Linux / UNIX: (after compilation) ./hello.c

Never Upgrade any Software!


Every year we see that various software companies release several software. Some of those software are so useful, that, we forget that, they will also need to update or upgrade.

For example, Nero. After opening the software in your machine you can see the version of it. It should show 6.x.x or 7.x.x or others. Right? Now, just Google the ‘Nero’. You will find, it is running 9.x.x version in the market.

Take another example, Adobe Acrobat Reader. We use this software for reading the PDF files. Now, open it. What version is it showing? 5? 6? 7? Or 8? Now, again Google the ‘Adobe Acrobat Reader’. It is running version 9 man!! What are you doing?

Go online and upgrade all these software. Open Nero’s website. Just a minute….what is it showing? The setup file of 9.0 version of Nero software is 370.5 MB???  Lol! Are they mad? If the setup is near about 400 MB, then what will be the size, if it installs??? Believe it or not, but it is 1.03 GB!!! Yes, from my personal experience, I am telling you. How horrible!!

In their site, they are saying that this time, Nero has become more user friendly and bla..bla..bla… But, in practical, if you see them, you will be more upset. What had they done? Is this our that Nero? It have become more user ‘foe’ly!  Not only Nero, but take any software.. Adobe Acrobat Reader, DivX, iTunes, Power DVD, Adobe Photoshop etc… you name it! These all are our everyday usable software. Not even software, now a days Operating Systems are also becoming monsters. Windows Vista? The os from Microsoft Corporation? Also have tested Windows 7. The same problem.

Now, lets take a small tour over the cons of these upgrading of softwares.

1. More and more Space: They want more AND more space every day. Previously, I have given an example of the Nero. Now, look at this table:

Name of the Software Previous / Most Used Version with Size Most recent Version with Size
Nero V6.x (<100 MB) V9.x (370.5 MB)
Adobe Acrobat reader V5.0 (<10 MB) V9.0 (>26 MB)
DivX V4.0 (0.7 MB) V6.8 (19.8 MB)
iTunes V4.1 (19.1 MB) V8.0 (65.6 MB)
Power DVD V1.5 (2.6 MB) V8.2 (76 MB)

These are the setup file sizes. Now, after installing, they occupy spaces like this: Nero 9.x = 1.03 GB, Adobe Acrobat Reader 9.0 = 230 MB, DivX 6.8 = 50 MB, iTunes 8.0 = 75 MB (without Quick Time, with Quick Time 100 MB). So, what will you do to your hard disk?

2. Unnecessary Functions: 99.9% of the users of Nero have a primary objective: burning a cd or dvd.  But, in the 9.0 version, you will find several tools that you will never use. For example, the Nero Home. I am sure that, you will never use it, if you have used the Windows Media Center once. More over, they give, a ‘Photoshop’-like software which is much harder in order to use the original Adobe Photoshop. You will find more applications like Nero Media Player. The ‘worst’ media player I (probably, you also!) have seen ever. Some times they provide some more ‘visually’ beautiful user interface (Eg. Nero 9), which looks great but works keen. They not only fail to do the job in time, more over pressures on the hardware of the computer which turns to our next point.

3. High Requirements: Windows Vista said that it will require at least 512 – 768 MB of RAM; however, 1GB is the best for the lowest requirement. Windows 7 has raised a step higher. It is demanding minimum 1GB of RAM. However, they said 2GB of RAM will be a good configuration in case of lowest RAM configuration. It was only the demand of RAM. Now, there remains more hardware: Processors, Hard Disk Space, Mother board, Optical Drive etc. Adobe’s latest Photoshop CS4 says of minimum requirement of 512 MB of RAM. But, in practice, I myself found, 1GB works good instead of 512 MB. But, if you guys could remember, the CS2 version had recommended requirement of 512 MB of RAM and, I myself had experienced, 320 MB was more than sufficient for it. My Intel 845GVSR motherboard with P4 2.4 GHz Processor ran the application very fast!

4. Customers are tester: When you buying a software, they will ensure in 1000 ways that, the software has been tested 10,000 times and rated “best value” by some ‘XXX’ magazine! You also look at that and think good of it and become the ‘bakra’. Coming back home, when you start installing it, the lines of problem starts. And until the software company provides a ‘patch’ or ‘update’, the problem persists. I think because of this since 2001 till today the Windows XP is providing ‘Service Pack 3’, ‘security updates’ and other ‘useful updates’. Not only XP, their last OS Vista had received a ‘Service Pack 1’ in 2008 after launching it in mid 2007. So, why will you buy new software, which has not been tested? Why don’t you use the previous versions of those software?? Here comes our last point.

5. Expensive: While Nero’s original burning software initially was used to given away with the CD-Writers at free of cost, the latest Nero 9 will cost you around US$200(probably). If you had purchased Adobe’s Photoshop CS2 or CS3 previously, then also, you have to buy it with near about US$1000(probably) with some US$100 discount. WHY? Why should I buy these software-monsters with 1000 bucks??

So, from the next time, before upgrading any software or OS, think twice. Don’t just follow the crowd of ‘latest versions’ and buy them. Apply your brain, is there really any need to buy a new software version? Can the Nero 9 burn ‘scratched’ discs?? You know the answer: No. Then why do you buy / upgrade it expending both your Income and the Internet Bandwidth??? Rather learn to use alternatives. Open Source Products. For example, In case of Vista os, use Fedora Core / Ubuntu / Cent OS…. These are FREE, OPEN SOURCE and FREELY UPGRADABLE Os which covers the solutions of all the problems stated above. Try to use ‘FoxIT Reader’ v2.3 (current) 2 free of cost with 3MB setup file size having all the features of Adobe Reader 8 and 9. Use VLC media player. This is also another open source media player software that plays nearly all types of files.  Yes, it is true, that, VLC is upgrading every month, but, that does neither require lots of internet bandwidth nor 100s or 1000s bucks as it is free and the latest version 0.9.8a (probably) has the less than 20 MB setup file; which will replace iTunes, DivX and Power DVD. So, apply your brain and think again before any software/os upgradation.

SSL VPN: Architechture of VPN


On my last 2 posts, I had explained the ‘SSL‘ and the ‘VPN‘. What are they, and what is our purpose of using them. Now, we’ll see VPN Architecture. With a simple diagram, I shall try to make you understand.

VPN architectureLet us take our previous example of John. Here, in the figure, the VPN device has 2 Ethernet ports: a Public Port & a Private Port. The Public Port is directly connected to the Internet via firewall and routers. The Private Port is connected to the 30 computers in the XYZ Pvt. Ltd. Now, as we can see, John wishes to connect to VPN; he, using the Internet, can connect to the VPN.

Now, one more thing, we can see, in the figure, over the ‘Internet‘, there is something called “SSL Tunnel Thru Internet“. Remember SSL? This is that tunnel. It is encrypted through several algorithms, which depends on the manufacturer of the device. Some manufacturers uses AES-128 some uses RC4 algorithm.

One more thing, the VPN device looks alike just a normal ’24-port switch‘. It contains more than 1 Ethernet port. It contains all normal hardware components of a CPU: like a Motherboard, a Processor, RAMs, a Hard Disk Drive etc. They also contain some Operating Systems. Generally Linux OS is provided with the devices. The reason is open source, free and its robustness. More over Linux is such a dynamic OS, that, the administrator can perform any type of job there.

So, in a nutshell, this was a brief architecture of VPN devices. If you guys face any problem, just post them in comments or contact us. We shall try to help you.

Thank you.

SSL VPN: Part2(Secured Socket Layer)


Now, we come to SSL.
SSL is a type of protocol; like other protocols: TCP protocol or UDP protocol etc. SSL stands for Secured Socket Layer.

So, what is this secured socket layer?
It is an internet protocol for secure, end to end exchange of information between a browser and a web server. It is sandwiched between the TCP/IP and the application layer. It was developed by Netscape Corporation in 1994. It is supported by all major browsers in the WWW. Conceptually, SSL is visualized as an additional layer in the TCP/IP protocol suite. It provides security in two ways, in terms of confidentiality and authenticity at an application level. TCP/IP provides reliable packet transfer but SSL provides secure packet transfer. The SSL is preceded by the TCP/IP and the data link layer, which means that applications that use SSL will automatically avail the services of TCP/IP and DLL. Since SSL resides above the TCP/IP layer, so it can ensure secure communication between numerous application level protocols on the internet.
However, SSL only secures web sessions and not the e-mail or file transfer sessions. This is one of the reasons why confidential information like credit card numbers is not exchanged via e-mail. In case of SSL, since the packet data is encrypted, so it can be viewed by the viewer while transit, but can not be deciphered. The SSL ensures secure data transfer, but it is not responsible for security of data residing in the web client or server. Thus only the application layer data is encrypted by SSL. Logically, SSL acts as a pipe between the web browser and a server.
OK. Everything fine. So, what it the connection of ‘SSL’ with ‘VPN’?
It is very easy and the answer is in the last paragraph. SSL only secures web sessions and not the e-mail or file transfer sessions. So, as we need to secure our communication, we have to use SSL.

Now, consider the example of John. He wants to connect to the NPN in his office. Here is the step by step connectivity of SSL-VPN:

1.     John opens a web-browser and enters the URL (Uniform Resource Locator).
2.    Then a login screen comes from the VPN where, John has to put his credentials (username & password).
3.    After that, the VPN will try to authenticate John as a registered user. If, successful, the user console will be opened else an error message will be showed.
4.    After successful authentication, in the user console, John will do his job. For example, file sharing service (FTP Service) with his own computer.
5.    Then John will log out from the user console. All these steps 1 to 5, the data will be sent and received in an encrypted form (thanks to SSL!).

So, today, I end here… too much of ‘Gyan’ were given…

On Next Post: Architecture details of VPN

SSL VPN: Part 1


Hello Friends!
This time I am here with SSL VPN. That means, here I will share with you the basic concepts of “SSL VPN: What is it and What it does?”
First of all, we need to know, what is VPN?
VPN is Virtual Private Network.
Again what is “Private Network”, and how is it “Virtual”?
A “network” is defined as the interconnection between computer systems, terminals or data communication facilities.
For example, this Internet, via which, right now, you are reading this article, is a network.
Now, what is “Private Network”?
This word “private” means something that is not licensed to access all users but some authorized users. Now, this “something” may be anything: some documents or some services or some tools – any thing. Large corporate houses, uses their own private network.

Let us clear this with a small example. Consider a corporate house XYZ Pvt. Ltd. They have an IP, say, ‘205.124.12.89’. Now, in their office, they have 30 computers. Now, they want to put them in a LAN (Local Area Network). So, what will they do? They will use some ‘class – C’ based address-based IP network ‘192.168.10.0’ and at their gateway, using a NAT (Network Address Translation). So, they will have 30 computers with an arrangement like this:
Computer 1: IP => 192.168.10.2
Computer 2: IP => 192.168.10.3 …. Etc.
So, now, this network will be called a private network that belongs to XYZ Pvt. Ltd. And unless licensed, none from outside can access this network.

Now, we will look why “Virtual”?
As we all know, the word “virtual” refers to some “state” that is not real, but is possible.
So, Virtual Private Network is a kind of network, which seems to be private but virtually. Here, an authorized remote user can access some resources of the private corporate network on a service provider’s shared network infrastructure, as if he is present in the private network.

Let’s take our previous example of XYZ Pvt. Ltd. Now, think of the situation. An employee, John, of the XYZ Pvt. Ltd., is in a holiday. Suddenly, he receives a phone, that, from his computer, he has to find some important presentation and mail the same to his boss who is also in other country, far from office. Now? If, john wants to do so, he has to use a secured channel over internet, via which he can access his computer that is situated in his office. This “secured channel over internet” is generally called the VPN.