Friday 15 July 2011

How to Ping machine using hostname in debian/Linux.

We can ping machine by their hostname rather IP address 

gedit  /hostname

add hostname along with their IP addresses
i.e 192.168.10.200 hostname
In this way you can  ping LAN systems with hostname

How to view TCP or UDP ports open or close at debian/Linux server

netstar -an
This will list all TCP and UDP ports

How to view Kernel IP routing table in debian/Linux

Every kernel makes its own routing table
command 
#  route

What is Arp? How we can view ARP entry and delete ARP entry.

 Arp maps IP address to Mac address 
  arp –a 
 You will see the IP address is mapped against the Mac address of the machine.
             To delete the ARP entry gives 
             arp del IP address

Wireshark


Wireshark is a tool that allows the packet traces to be sniffed, captured and analyzed. It is used for trouble shooting networks problems, examine security issues, and debug protocol implementation and learning protocols internally.

What is Packet Sniffing?

Packet sniffing is the act of capturing packets of data flowing across computer network. You are able to see any bit of information entering or leaving your computer. Normally computer looks at packet addressed to it and ignores the traffic on the network. When a sniffers is set on a computer, it interface is set to promiscuous mode. This means that it looks at everything that comes through. Using packet sniffer it is possible to capture data like passwords, IP addresses, and protocols being used on the network and also other information.  A packet sniffer utility is that it sniffs without modifying the packets in any way. The computer having sniffer installed not only receive the data which is directed to him but also monitor all traffic on the physically connected network. Packet sniffer sees everything. It includes SMTP, POP, IMAP traffic, HTTP, FTP traffic and can read password in clear text etc.
A packet sniffer can be set up in two ways.
a)      Unfiltered
Captures all of the packets
b)      Filtered
Captures only those packets which containing specific data elements.

What is Subnetting?

Subnet is a segment of a network. Subnetting is a technique that allows a network administrator to divide one physical network into smaller logical networks and to limit the scope of broadcast traffic, network security issues, and to separate network segments by function.
Let us take as example of how to do one bit, two bit and three bit subnetting. We purchased network id 201.100.50.0. In subnetting we move a host bit into network and make subnets , formula for calculation of subnetwork is 2n -2 and for host in each subnet is 2n-2 where as n stands for no bits sifted to network portion for subnetwork and n stands for remaining bits of hosts for number of hosts in a network.
Example
200.100.50.0
Network part 24 bits
Host part 8bits
One bit Subnetting
No of subnets­­­ = 2n-2   No of host in each subnet = 2n-2         
                        No of subnets­­­ = 21-2 = 2 subnets (n bits shifted to network)
No of host in each subnet = 27-2 =128-2 =126 (n remaining bit in host)

First Subnet                  200.100.50.0
                        {            .      .     .    .
                                      .      .     .    .
                                    200.100.50.127

Second Subnet            
200.100.50.128
                        {            .      .     .    .
                                      .      .     .    .
                                    200.100.50.255
Two Bit Subnetting
No of subnets­­­ = 2n-2   No of host in each subnet = 2n-2         
                        No of subnets­­­ = 22-2 = 4-2=2 subnets (n bits shifted to network)
No of host in each subnet = 26-2 =64-2 =62 (n remaining bit in host)

First Subnet                  200.100.50.0
                        {             .      .     .    .
                                      .      .     .    .
                                    200.100.50.63

Second Subnet             200.100.50.64
                        {             .      .     .    .
                                      .      .     .    .
                                    200.100.50.127

Third Subnet                200.100.50.128
                        {             .      .     .    .
                                      .      .     .    .
                                    200.100.50.191

Fourth Subnet              200.100.50.192
                        {             .      .     .    .
                                      .      .     .    .
                                    200.100.50.255
Now if we again look at the formula we will see 22-2 = 4-2, here 4 is total no of subnets and -2 means that we will not use first and last subnet. Similarly in hosts 26 -2= 64-2=62, here 64 total no hosts in each subnet and -2 means we will not use first and last address because first address is subnetwork ID and last is broadcast  ID of the subnetwork .Then we will left with 62  usable hosts in each subnet.


Second Subnet             200.100.50.65
                        {             .      .     .    .
                                      .      .     .    .
                                    200.100.50.126

Third Subnet                200.100.50.129
                        {             .      .     .    .
                                      .      .     .    .
                                    200.100.50.190
So finally we will use only second and third subnet and each subnet first and last IP will not be used because they are subnet Ids and Broad cast Ids and you will left with 62 no of usable hosts. Similarly we perform three, four bit etc subnetting.
Note in one bit subnetting I have not done -2 from the network why? Because 21-2= 0, it means that we are left with 0 subnet. So remember that in class C one bit subnetting is not possible.

What is IP?


IP stands for Internet Protocol. Its Unique 32 bit number assigned to every machine, so that it can be distinguished from other machines on the internet. IP work on layer 3 of OSI model i.e. network layer.  Below are some examples of IP.
a)      10.0.0.0
b)      172.16.0.0
c)      192.168.0.0
There are two types of IP addresses, Private IP addresses and Public IP addresses. Private addresses are those which are used in LAN. Whereas Public addresses are those which are used on Internet and are unique for every machine. Different organization can use same private addresses because they are limited to their LAN where as Public addresses are always unique and can never be identical.