25 Aug, 2008  |  Posted by Danesh  |  in HowTo, Linux

IPCop till today does not have a GUI to add static routes.

The manual method. You will have to do this every time IPCop is rebooted.

root@proxy73:~ # route add -net 10.0.0.0 gw 10.38.24.1 netmask 255.0.0.0

Now let’s make the route persistent across reboots. There are 2 files for this. Use either one depending on your needs.

You can add the route command at the end of the /etc/rc.d/rc.local file. The route will be added every time IPCop is rebooted but not everytime the interface is restarted. Good for a box with minimal changes.

root@proxy73:~ # echo "route add -net 10.0.0.0 gw 10.38.24.1 netmask 255.0.0.0" >> /etc/rc.d/rc.local

The other way would be to add the route command at the end of the /etc/rc.d/rc.netaddress.up file. This will ensure that your routing table gets updated every time the interface is restarted.

root@proxy73:~ # echo "route add -net 10.0.0.0 gw 10.38.24.1 netmask 255.0.0.0" >> /etc/rc.d/rc.netaddress.up

I personally use the latter.

To view your routing table run the “route” command.

root@proxy73:~ # route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
213.27.199.80   *               255.255.255.248 U     0      0        0 eth2
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
10.38.24.0      *               255.255.248.0   U     0      0        0 eth0
10.0.0.0        10.38.24.1      255.0.0.0       UG    0      0        0 eth0
default         213.27.199.81   0.0.0.0         UG    0      0        0 eth2

29 Jul, 2008  |  Posted by dragoncity99  |  in HowTo, Linux

Most of the time, users are having a Windows Machine on their desk or laptop. Normally, we want to perform a full scale data retrieval from our Linux servers in the DC, where we don’t have a trusted Linux server to manage it….the answer to it is use “PLINK” utility.

Plink comes together with the Putty…

A simple example of usage is:

C:\> plink USERNAME@SERVERNAME ‘YOUR-LINUX-COMMAND’

If you have a dozen of servers…then you probably want to write a batch script in Windows to loop through a list of servers and mention the list of commands juz like what i did…..

Here a typical windows batch script:

@echo off

for / f “tokens=*” %%A in (your-server-list.txt) ( C:\path\to\plink.exe user@server -w YOUR-PASSWORD -m linuxcommandscript > YOUR_OUTPUT_FILE.txt)

There you go, i did this for my sar report data collection for root cause analysis and infrastructure load analysis….keying in a password wif every darn login is impractical and yet you dont want to generate a security key for the servers.

24 Jul, 2008  |  Posted by Danesh  |  in HowTo, Linux

Here’s a quick walk through to synchronize your system time through NTP.

Install the NTP package if you don’t already have it installed.

[root@abubu]# yum install ntp

Check your date.

[root@abubu]# date
Thu Jul 24 13:34:24 MYT 2008

Use the ntpdate command to poll from public NTP servers. I this example I’ll use ntp servers provided by the NTP POOL Project. The asia pool is “ntp asia.pool.ntp.org”

NTP POOL PROJECT

NTP POOL PROJECT

[root@abubu]# ntpdate asia.pool.ntp.org
24 Jul 16:02:18 ntpdate[5316]: step time server 202.144.207.222 offset -28647.175440 sec

Check your time again to make sure it’s correct.

[root@abubu]# date
Thu Jul 24 16:02:24 MYT 2008

I’ll cover the ntpd daemon in a future post.

18 Jul, 2008  |  Posted by Danesh  |  in HowTo, Linux

Here’s an easy way to get the pid of a running process.

Running the “pidof” command will return the pid(s) for a running program. See sample below,

danny@pandora:~> pidof syslog-ng
2043
danny@pandora:~> pidof acpid
2045
danny@pandora:~> pidof /usr/bin/firefox
14408
danny@pandora:~> pidof /usr/bin/compiz
27164
danny@pandora:~> pidof /bin/bash
27011 17339 16792 16477 15151 14403

Simple right!?

11 Jul, 2008  |  Posted by Danesh  |  in HowTo, Linux

Here’s a quick way to access your environment variables from the CLI.

User the “%” key in conjunction with your “<tab>” key to auto complete your environment variables.

pandora:/ # echo $J <TAB>
$JAVA_BINDIR  $JAVA_HOME    $JAVA_ROOT    $JDK_HOME     $JRE_HOME
pandora:/ # echo $JAVA_ <TAB>
$JAVA_BINDIR  $JAVA_HOME    $JAVA_ROOT
pandora:/ # echo $JAVA_HOME
/usr/lib/jvm/java

The traditional way is to “env | grep [variable name]