Search This Blog

Saturday, January 30, 2010

Basics of Networking - Part 2 (Connecting Internet)

For a long time network was an unknown thing, while I was using the network services without knowing how it works....

Have I understood it now? Well the answer is "partially". Yes still it is an unknown mystery for me.

But how could I write about something I don't know?
I would say. I write something that I have learned hard.... spent months and years and found a simple solution may I was in wrong direction, I had no right person behind me to teach. All you see in this blog is not learned from a course... but learned when needed, some through other sources, some through practical experience and what ever worked well after the learning is written but they are not always best.... ;-) You find a better way later or you may know it. If so please correct me when they are wrong.

Going to the topic... Let us start inter-networking (I mean, connect to internet).

What are we going to and not going to discuss in this connecting to internet

We are about to see how can we connect the entire network to internet and we are not going to discuss about single PC internet connection as that will be mostly explained by the ISP.

We assume that we are using a broadband connection to share among our network.

Always an broadband internet connection has to go through a router, also called as ADSL modems. These modems take care of two things
  1. Digital signal transmission through the telephone lines.
  2. Acts as a router and becomes our gateway.
The second point looks odd and we are not clear on what it is going to do. Let us make it clear.

Router is usually a device that is usually used to forward information between two networks, basically to connect networks of different subnet.

To access internet we need an IP address that is matching to the network of the provider (ISP). So the Router gets the IP from the ISP and on the other end it also has a local IP of our network.

Do this means it has two IPs?
Yes, it has two IPs, one end for the internet and other for our local network.
It acts as the gateway for the network. (Read - Basics of networking).
So all the internet requests navigate through this gateway and this gateway contacts the ISP to get our requests answered.

What else it can do?
This router also connects in an other mode called bridging. The bridging is a simple way of only acting as a modem and it translates the computer signals through the ISDN wire while the IP of the provider is directly assigned to the computer to which the router is connected. The bridging is possible if only one computer connects to the internet through the router.

The IP will be assigned dynamically or statically. They become active on boot or using PPPoE (Point to Point Protocol over Ethernet) dial-up.

How do we share the internet from the router?
IP Details
  1. Modem/Router - 192.168.1.1
  2. PC A - 192.168.1.2
  3. Laptop B - 192.168.1.3
  4. PC C - 192.168.1.4
All the above has same subnet and same gateway 192.168.1.1 which means the router is the gateway for all IPs.

All the PC needs DNS Server IP to identify the websites out of its network. The DNS IPs will be provided by the ISP or we can use Google's Public DNS.

Thus the ADSL router makes internet available for all the computers in the network.

While we will discuss on sharing the internet using a proxy in upcoming posts.

Basics of networking - Part 1 (Assiging IPs)

Let us start networking.... ;-) Not social networking

Since the start of the blog, we have been to the topic and this time too we are to the topic.

We are about to connect more than two computers to form a network. This involves various process to make it happen. As this blog is more about configuration management, we expect the readers to know more than basics in the computers. To start with they should know to change IP addresses in the OS.

I assume we are not about to discuss about hardware issues here and the following are correct.

  1. The network cables are properly crimped and they work.

  2. The network switch or hub used to connect is working good.

  3. The NIC (Network Interface Card) is installed properly and is working good.

  4. The OS has necessary drivers and supports TCP / IP (IPv4)

  5. The user has enough rights to change and play with Network Setting in his environment

When most of us know “what is an IP Address” and “how it is useful”. We forget to understand how it really connects to more computers than what we have near us.

Hmmmmmmmmmm.................. What are we going to learn about IP Address now?

Though most of us know what an IP Address is, am adding some simple explanations to go further.

IP Address is like a name to a computer, Which we use to identify the computer, but these are not names with alphabets but with numbers. They are 4 numbers each number separated by a “.” . Each number has a range from 0 – 255 (8 bit). Eg: 192.168.1.1

To make a machine work in network it needs an IP Address to identify in the crowd and this should be unique within the network.


As we decided to connect more than two computers in a network. We are going with the following example.

The IP Address are differentiated into classes A,B, C. Since we are more into action, I would recommend to read about it more detailed. We are having a sample IP Address 192.168.1.1, Let us use this for our network. Before using we need to ensure that they are connected to each other as in the above diagram.

  1. A – 192.168.1.1

  2. B – 192.168.1.2

  3. C – 192.168.1.3

OK. Is this IP address enough to communicate? No we need to say a subnet to make this work.

Subnet............ What is it?

Subnet is a notatation or a number used to say how many computers do this IP Address can connect and what is the starting IP of this range and ending IP of this range. The subnets are also similar to IP but they have few calculations. I would recommend to try the application in http://www.subnet-calculator.com/ where it explains the change in subnets and the change in ranges for that.

So we choose subnet 255.255.255.248 as it has range of 192.168.1.1 – 192.168.1.6 (6 computers in the network)


What happens when an IP is out of this range? How can we access it?
Here comes a gateway for the network. Which always has the door(gate) to access the other network IP. The gate way will be always the first IP in the subnet range, this is not a rule but this is a best practice to identify the gateway in any network. 192.168.1.1 is the gateway here. Setting this up in all the machines(A, B and C) should make the network accessible within the A, B and C.

So, we should be able to ping 192.168.1.2 from Machine A and C and the rest of IPs from other machines(A,B and C). This confirms the network setup.


Thursday, December 10, 2009

Lets Make this blog interesting

This post is something related to the first post in this blog.

The blog for the five months have been random and was rolling across different topics, not consistent on any topic and now its time to make it organized and more interesting for reader, by bringing a series of topics closely related to each other, helps to learn from it and implement on a run.

Q:Whats gonna be in the series?
A:To be short the series will be for system / server / network administrators.

Q: Whats is the upcoming series?
A: Steps in setting up a small / medium office network.

Q: .....?
A: Hope your further questions will be answered in upcoming posts ;-)

Will make a reliable network with basic services...... Till then keep watching the blog

Monday, November 30, 2009

Adding our own Linux startup scripts

Do we need to start something when Linux system starts?
Its not a service.... But I need to run this command when system starts....

Yes here is a small part which astonished me as I have not learnt this for years and missed it when I need....

Let us take a sample case: We might need to start a SVN daemon on the system.
#svnserve -d /srv/repositories

We need to run the above command on every start-up autiomatically. So we don't need to start this daemon manually.

Simple way is add this along with other startup scripts. Find which runlevel the system runs normally.

[root@sf03 ~]# runlevel
N 3
[root@sf03 ~]#

Our server runs in run-level 3 so lets take that as an example.
The server runs on Fedora Linux 10

The startup scripts for run-level 3 resides in the directory /etc/rc.d/rc3.d/
The scripts for run-level 5 will be at /etc/rc.d/5.d/

The directory contains shell scripts that runs on the ascending order on by one.

The last script that runs is S99local

Which has the content similar to this.
[root@sf03 ~]# cat /etc/rc.d/rc3.d/S99local
#!/bin/sh

#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
[root@sf03 ~]#


Use the vi editor and add the startup command we need to add to this.

Example:

[root@sf03 ~]# cat /etc/rc.d/rc3.d/S99local
#!/bin/sh

#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.


touch /var/lock/subsys/local

# Start SVN Server at startup


svnserve -d /srv/repositories


[root@sf03 ~]#

Restart the server and check the script.

Keep the php-pear up-to-date

PHP has evolved a lot and when we need add-on libraries, we opt for PEAR packages or PECL extentions to add more libraries that resolves our purpose.

Recently in one of our servers CEntOS 5.2, we were about to install phpUnits to run unit tests in it.

Unfortunately phpUnit was not installed on it.

The website gave the following options to install.

pear channel-discover pear.phpunit.de


and

pear install phpunit/PHPUnit


But the installation failed........ Oops it was odd to understand why?

The real cause was the pear module has not been upgraded to latest version the the new standard packages were not installed with this.

It would be better to do
pear upgrade pear
before we start any pear installations. Keep the pear up-to-date to make it work with latest library packages.

Friday, October 30, 2009

Integrated Project Tracking Tools

Project Management is an art in software development. When too many requirements, bugs and more falls into the project with parallel releases and more. Things become hectic to manage them separate with tools.

  1. Commits goes in after code freeze
  2. Commits in cruical areas
  3. Bugs are added. Count jumps more than accepted limit.
When we have tools like SVN or CVS or any other version control system we could track the changes in it. We have tools like websvn, fisheye and more to see the SVN commits. Bugzilla and more to track the bugs

But things are tough when we need to use too many tools to look into to get our final data for management.

Integration of these tools is a good option and getting all the data at one place would be better solution.

Let us look into the existing tools to do those.
1. Trac - A cool python based lightweight Project management tool.
2. Redmine - A RoR based project management tool
3. Indefero - PHP based project management tool

Integrates well with Version Control system RSS/Atom Feeds are available, with multiple project support. Helps to track bugs and manage releases with features and sprints.

We have the above offline applications which can be downloaded and configured to integrate with our environment tools and serve our network.

We have providers like.
sourceforge.net - Open source projects support
code.google.com - Open source projects support
indefero.net - Open source and private projects support
kenai.com - Open source projects support
and more............

Each tool has its own pros and cons but all of these helps in having control of the project from planning to delivery and to post delivery support.

Thursday, October 22, 2009

Web SVN Repository Browser

The need for a Source Control System in a development environment often increases but they are not just the Versioning system they need to do more...

A developer using SVN has many options with his IDE to work with SVN like diff between revisions, comparing and browsing histories etc., but will the IDE fill the complete usage requirement of the SVN?

How about a config manager or a project manager looking into the code base to get some information, do they need to check out the code and use IDE?

Our previous USVN gave few options to browse through the code but it supports only the view for latest version. In the scenarios like this we often require more tools to do this.

Now we are about to explore the WebSVN a tool to browse the repository at different revisions, get a RSS feed intimation when a new checkin happens, also to tar and archive the repository from the branch we need.

Lets look into it.

WebSVN is provided by Tigris the famous SVN tool provider.

What do we need to install WebSVN?
1. PHP Hosted Server ( I prefer a Fedora Linux as it could install all dependencies)
2. PECL and PEAR support to install few modules required by PHP
3. SVN

Installing WebSVN
Login as root or use sudo to perform yum installation

#yum install websvn

It installs all dependencies with WebSVN.

Making WebSVN accessible for external world.

Make the installed directory of WebSVN a sub directory in the existing web server.
#ln -s /usr/share/websvn /var/www/html

Edit the config.php

add the following line before the LOOK AND FEEL Section in the config file.

$config->addRepository('NameToDisplay', 'URL (e.g. http://path/to/rep)', 'group', 'username', 'password');

For Example
$config->addRepository('HR App', 'http://svnserver.local/repository/hrm/', NULL, 'admin', 'admin');

Access the website matching the path we could see WebSVN working as below.



We can add more projects/repositories by adding similar config lines as explained above. The details of the project will look as shown below.


The RSS Feeds can be subscribed and the new check-in and repository changes can be accessed via RSS updates.

The WebSVN also alows to make tar and download repositories by changing more configuration in the config.php.


The WebSVN solves problems like version comparison, change notifications and more.

To conclude its a good utilility for SVN, with few drawbacks.
1. The repository addtion requires config file change - Better if we could do in front end.
2. Has no authentication system so if a repository is added every one who has access to the WebSVN can see all repositories.

Soon we will look into more tools similar to this.