Sunday, November 29, 2009

Networking with Linux : Understanding IP Addressing and need of IPv6 (Part II)

In my last post I talked about different IP classes. Now let us see a few point of netmask. Netmask decides the class actually and the number of nodes. Unless you are using CIDR (Classless Interdomain Routing) netmasks have a fixed value for each class. The default values are :-
  • Class A : 255.0.0.0
  • Class B : 255.255.0.0
  • Class C : 255.255.255.0
Netmask has a unique property, the bits of netmask has be a stream of continuous 1s followed by continuous 0s. Even CIDR follows this property.

Each network of nodes has a network address of its own which is decided by the netmask the IP has. Now let us see that how this netmask helps us in deciding or finding the network address. Well since we are not discussing CIDR, its pretty simple. You can just convert IP Address and Netmask in binary and do the AND operation bit by bit. What you get is Network Address. Following is an illustration for the same :-

Consider IP address of a node 192.168.154.7 and the netmask 255.255.255.0. This is a class C IP Address used for private networks. Now we are interested in knowing the network IP. For this we just have to convert the IPs and netmask to binary form.
    IP Address : 11000000.10101000.10011010.00000111
    Netmask : 11111111.11111111.11111111.00000000
Now we do binary AND of these bit by bit and we get :-
Network IP : 11000000.10101000.10011010.00000000
i.e 192.168.154.0 and this is the network IP indeed. Network IP is the first IP of the Network and in the similar sense Broadcast IP is the last IP of the network.

Now let us talk a bit about CIDR and its advantage. CIDR as the name suggest is classless. There is nothing like Class A, B or C. While this makes it a bit difficult to understand, it increases its efficiency many folds. You might have observed that class C cannot have more that 256 IPs which might be too less to large organizations. Another alternative is to switch to Class A or B IPs but then its possible that the organization has more than a network to maintain.
To cater this problem we use the concept of CIDR. In CIDR the netmask is not fixed to 255.255.255.0. We can have netmasks like 255.255.248.0. This allows us to create sub networksn or super networks. For example if my IP is 192.168.154.7 and the netmask is 255.255.248.0, my IP configuration will be able to have 2048 IPs in one network. Earlier it had only 256 IPs in one network. So this is what a CIDR can do.

My next post will be regarding Domain Names. Hold tight ! :)

Saturday, November 21, 2009

Networking with Linux : Understanding IP Addressing and need of IPv6

Let me start with a very basic question. What is IP address?
IP Address is a unique address which identifies a node on network uniquely. No two nodes can have same IP address on a single network. That said, now let me tell you that most commonly we use IPv4 to identify nodes on the networks. IPv4 is of the format xxx.xxx.xxx.xxx. IP Addressing scheme consist of a node address, a network address, a broadcast address and a netmask. Let us look about these topics in some details.
  • Node Address : It is a 32 bit or 4 bytes address which identifies a node within a network uniquely. Addresses are classified into five types.


    1. Class A : This Address is of the form NNN.HHH.HHH.HHH where N type of bits represent network address and H type of bits represents node address. To put it in simple term we can say that all the addresses from 0.0.0.0 to 127.255.255.255 belongs to this class.
      This class has two special IP series. 10.HHH.HHH.HHH belongs to local networks only. They cannot be distributed as public IP Addresses. 127.HHH.HHH.HHH is used for localhost i.e. node uses this IP to refer to itself.
    2. Class B : This Address is of the form NNN.NNN.HHH.HHH. We can say that IP belonging to the range 128.0.0.0 to 191.255.255.255 comes under this category.
      This class also has two special IP series. 172.16.0.0 to 172.31.255.255 belongs to local networks. Also 169.254.HHH.HHH is the IP given if DHCP client is not able to get an IP from the DHCP server.
    3. Class C : The Address type is NNN.NNN.NNN.HHH. IP range is from 192.0.0.0 to 223.255.255.255 and 192.168.NNN.HHH is used for local networks.
    4. Class C and D are used for multicast and research purpose. These are normally unavailable for general purposes.


      IPv4 can provide only a finite number of IPs which is not enough to cater to the needs of increasing network nodes. Here IPv6 comes in picture. Unlike IPv4 it consits of 16 bytes (not 6). But since the hardware is costly to implement for IPv6, its use is still not wide spread.

       I will update this post with info about Network and Broadcast address and Netmask. Also I will give a brief introduction to CIDR or Classless Interdomain Routing.


    Monday, November 16, 2009

    Networking with Linux : Setting up a Linux Server

    Usually people think that to set up a server some special kind of distribution is needed and most of the people tend to download the server editions of the distros. But let me tell you one thing, downloading server edition might ease your task a bit but then you will never be able to know what is going on at the back. Also distros like Ubuntu Server Edition does not even have a GUI which makes the work of a beginner much tougher.
    Here are few packages which you need to turn your regular desktop edition into a server OS.
    • Apache2 (Web Server)
    • BIND (Domain Name)
    • FTP server (I recommend ProFTP)
    • MySQL Server (If you want a data base)
    • Telnet (for remote login, old fashioned but good for learning)
    Taking Ubuntu as the desktop installed the command will be :- 

    sudo apt-get install apache2 bind9 proftpd mysql-server telnet

    This configuration is good to go for beginners. We will install more packages as we move ahead. These packages create services which can be started and stoped at any point of time. Now first step is to learn how to start and stop the services and the service names.
    sudo /etc/init.d/service_name start/stop/restart

    So to start apache2 you will write :-
    sudo /etc/init.d/apache2 start


    Similarly to stop the Apache server you have to write :-
    sudo /etc/init.d/apache2 stop


    Rest of the service names are :-
    • proftpd
    • bind9
    • mysql

    Monday, November 9, 2009

    Networking Season Begins

    Starting now I will write some posts on "Networking on Linux". I plan to write about networking from the very basics. I have thought of  the following topics :-
    • Setting up of a Linux Server
    • Understanding IP Addressing and need of IPv6
    • The Domain Names
    • Web Servers like Apache and Tomcat.
    • Mail Servers like Squirrel Mail
    • Load Balanced Clusters
    • Virtualization
    I will try to write one post per topic but some might take more than a post. Also the last two topics are kind of advanced in networking sense. So the journey will start from the next post.