Monday, September 17, 2012

Configuring sub interfaces in RHEL6.

In the ‘Configuring IP on RedHat‘  post we considered about how to configure an ip-address to an interface in RHEL6. Now let’s move another step further and configure a sub interface. Sub interface is a logical interface which usually allows you to create VLANs.

In the below exercise I will create sub interfaces for the interface “eth0”.  I should provide that the file ‘ifcfg-eth0’ is already in my system, configured properly and given the ip-address ‘10.1.1.1’.
First you have to create a file in the same directory “/etc/sysconfig/network-scripts/” named in a specific format.

Format of the file (if the interface is eth0):
<Interface name> :  <sub interface number>
 Ex:          eth0:100

How to do that?

First go to the director ‘network-scripts’
#cd /etc/sysconfig/network-scripts/

Now you need to copy the ifcfg file you have for eth0 and rename it as ‘ifcfg-eth0:100’.
#copy ifcfg-eth0 ifcfg-eth0:100

Now you should do tiny adjustments to the newly created file in order to configure it as a sub-interface.

How to do that?

First open the file in vi editor,
#vi ifcfg-eth0:100
In my case file looks something like below,

DEVICE="eth0"HWADDR="08:00:27:4F:CF:22"NM_CONTROLLED = "no"ONBOOT="yes"IPADDR=10.1.1.1NETMASK=255.255.255.0

First rename the device into “eth0:100”
Then, modify the ip-address.

File will ultimately looks like this.

DEVICE="eth0:100"HWADDR="08:00:27:4F:CF:22"NM_CONTROLLED = "no"ONBOOT="yes"IPADDR=10.1.2.1NETMASK=255.255.255.0

Now save and quit.

Good, you have successfully configured the sub-interfaces and now it’s time to restart the network adapters. 

This can simply done by the command,
#/etc/init.d/network restart

Now check what you have done by using the ‘ifconfig’ command.
Make sure that you have an entry for the sub-interface ‘eth0:100’.

Thanks.

Thursday, August 30, 2012

Scheduling a task using 'crontab'

Suppose you want to schedule a task in Linux and you want it to run periodically, then 'crontab' command is what you are looking for. I've just learned this, so I still don't know much details about it, but following is what I've learnt.

Syntax:

To create a 'crontab' entry,

                      #crontab -e 

To get a list of crontab entries you have,

                      #crontab -l

The way that you should edit the crontab file, (vi editor will be used)

                       'min' 'hr' 'day' 'mon' 'day-of-week' <command>

min - minute of the hour.(ex: 15)
hr - hour of the day(ex: 3)
day - day of the month(ex: 29)
mon - month of the year(ex: 5)
day-of-week - As name implies.(ex: 0)   0 is sunday.
command - This is the command you want to execute.


Example:

Following will write "Crontab is working" to 'abc.log' file in /home/pradeepa directory. (use your username instead of pradeepa) 

                * * * * * echo "Crontab is working" >> /home/pradeepa/abc.log

And the star mark is used to tell "every".

There is a great article on crontab in wikipedia,


This is just an introduction to 'crontab', what you can do from this is up-to your innovative mind.

Cheers.

Saturday, August 25, 2012

Installing java on rhel6

Recently I was trying to install java on my rhel6 o/s. But there were so many links in the internet which i couldn't understand. But finally i found a great wiki site which helped me accomplishing this task.

http://wiki.rosalab.ru/en/index.php/Howto_install_proprietary_Java_from_Oracle#JDK_7u6_64bit

Going through this will solve all the problems.
But 'javaws' is not working for me.

:)

Thursday, August 16, 2012

Adding a static route in RedHat

This post gives a step by step guide on how to setup a static route. This post will not have any in-depth details, so it is just for newbies just like myself.

First step is going to the root

#su -l

Then you have to go to the following directory which contains details about interfaces as well as about the routes,

#cd /etc/sysconfig/network-scripts/

You can use the 'Tab' key to autofill the commands in linux cli as well as the directory names :) which often makes your life easier.

Now since we are in the correct location what we have to do is adding the route to a special file with the name 'ifcnfg-route'. I will use the 'vi editor' for this task.

#vi route-eth0

This file can be blank if your linux os does not have any routing configured.

Now you need to know basic commands in 'vi editor' in order to edit this document and save it. When I first use the 'vi editor' it was pretty confusing, but going googling 'vi commands' gave me enough insight about this editor. After getting to know all the commands it will be a pretty easy editor to use. :)

So there we just need to put a small entry,

<destination network> via  <gateway to be used>

example:

                     10.1.60.0 via 10.1.1.254

But make sure that the gateway ip-address is available in your networks.

Then save the editor and exit.

Make sure you restart your interfaces after doing any modification.

 #/etc/init.d/network restart

Finally, check your configuration by typing

#route -n

If your entry is displayed in the output, then you did it correctly :)

Thank you.
Pradeepa






Tuesday, August 14, 2012

Configuring IP on RedHat

This post will give you step by step guide to configure a static ip address to an interface in the RedHat operating system. Since I am also a newbie this post will not be that hard to understand.

First go to the root, 

#su -l

Then open the file which contains details about the interface.

#vi /etc/sysconfig/network-scripts/ifcfg-eth0

This will open that file in the vi editor. Now all you have to do is adding some entries to the file.

Following web site will contain details about the vi editor,

                  http://www.cs.rit.edu/~cslab/vi.html

Entries that should be added,

DEVICE="eth0"
HWADDR="08:00:27:4F:CF:22"
NM_CONTROLLED = "no"
ONBOOT="yes"
IPADDR=10.1.1.1
NETMASK=255.255.255.0

Above entry is to add ip address 10.1.1.1 with a mask of 24 to the ethernet0 interface.

After that make sure you save the vi file and exit.

Finally restart the interfaces,

#/etc/inti.d/networks restart

To verify the configuration you can simply type,

#ifconfig 

Then check under the eth0 interface and verify all the configuration.

Thank you,
Pradeepa.

Monday, June 25, 2012

Moving on with Ubuntu


It's the second day of linux, and now I am getting use to all its general interfaces. The quick launch, the dash, multiple workspaces, the small e-mail button in the upper right corner(i don't know what it is called) and the terminal.

Another problem I faced with ubuntu is related to it's music player (Rhythmbox). I should provide that it's very easy to access Rythmbox in Ubuntu, and that's through the speaker icon appearing in the upper right corner of the workspace. However, the problem is that I have to import my music files to Rythmbox each time I run the application. That is sure a pain in the a**. The pain becomes severe due to the fact that I have plenty of songs in my 'songs' folder and it gets quite a long time to import them all to the application.

I'm beginning to understand the reason for this; I think linux is treating each of the partitions as one single disk which can be mounted and ejected from the root. In that way, if I have not mounted my disk partition where the songs have been stored in Windows, I have to go through all the trouble just to play my music. It is just like playing music from a CD. But I might be wrong, or there can be an easy way.

Still it's pretty hard to type long articles in Ubuntu because the touch-pad does not get switched off when I'm typing and when ever my palm touches it the cursor goes to somewhere else. :D I hope I will be able to find a patch for that.

The next problem I faced was regarding the applications which I wanted at the start-up. Specifically skype. The solution was easy. Just click on the upper right corner where you have the power off icon, and select 'Start-up Applications' from the drop down menu. For the command just type 'skype' (if you go to the terminal and directly type 'the name of the software' you can access it, that's the logic behind the entry under command label). Problem solved.

That's all for now.  

Saturday, June 23, 2012

Migrating from Windows to Ubuntu.


I've been using computers for a quite a long time now, approximately 15 years. All these years I've been living with windows. I've been working in platforms,

MS-DOS
Windows 3.1
Windows 95
Windows 98
Windows Me
Windows 2000
Windows xp
Windows vista
Windows 7

That's the evoultion of windows. :)

But now due to the evolution of IT and due to the field that I'm working in, which is Engineering, I found it is necessary to start learning how to use Linux.

So I googled, whcich is the default way of learning new thing (anything) nowadays. So I learnt that the best version to start using is Ubuntu.

I downloaded Ubuntu and installed it as another OS. So now I have both Windows and Ubuntu. I feel very safe this way, coz Ubuntu is all new for me and I prefer to swim in the shallow befor moving into the deep.

Basically, installation was far more easier than on Windows, just had to run the file, and reboot. Logging on to the system was also very quick compared to Windows. The screen was cool. :)

But since it was my first time in Ubuntu I wanted to read some articles, so I read about the 'terminal' and felt kinda cool to be typing commands in a geeky manner rather than using the GUI. I had to install softwares and drivers also.

I installed Google chrome, Skype, VLC player to start with; and the installation process was also very much different. You have a separte option called a Ubuntu Software Center where you can install stuff, and the installation process is also very simple. But I really don't know where they are on the disk :D.

Later I started noticing the cons,

First of all, my hp touchpad driver was not seemed to be working. Actually the right click is not working. So as everyone else, I googled it and downloaded a patch. Then I had to use the command line or the terminal; after a long time I used the command line in an OS, but it was cool, techy and I liked it. But still I can't switch my touch pad off like I did in Windows, which makes typing long articles harder.

The next problem was 'my bluetooth' is not working, same issue, I could not find compatible drivers yet. It is really not an issue with Ubuntu, rather an issue regarding hp. They announced that they may not be releasing drivers for Linux for there hp pvillion notebooks, sadly which is my case.

Apart from uncompatibility issues, I really like working in that new environment. It is quick, not user friendly and techy. One of the gratest feature it adds is, it has multiple worksapces, if I say it in Windows language, many desktops. So organizing work, and multitasking is pretty easy.

Currently, I am in the process of learning Ubuntu, and right now I can do almost all the general things I can do on windows in Ubuntu.

We'll see.

Pradeepa