Friday, September 14, 2007

Create PS1 in Solaris 8

Sometime when you are already like shell environment like BASH (Bourne Again SHell), you will have problem on some old shell like csh, ksh, or even sh. In this section I will show you how to create a user and their user environment using BASH. I will use Solaris 8 as example since Solaris 8 doesnt give you BASH as your default environment.

As root , create a normal user with this command, here I will use Jackie as example

useradd -d /export/home/jackie -m -s /usr/bin/bash -c "Jackie" jackie passwd jackie

then on the /export/home/jackie/.profile add this 2 lines:

PS1="[\u@h \w]\$"
export PS1

save it. Then let the user log in using their jackie and his new password.

He will see the environment like this:
[jackie@myserver jackie]$

try to logout and login again if the result is not like expected.

Easy Syslog-ng configuration

Syslog-ng have been the successor of the well-known Syslog which have many enhacements in features and easiness to configure. Here I will show you the basic configuration of the Syslog-ng with some examples in filter.
Although Syslog-ng is supported in Linux, Solaris, All BSD variants, AIX, HP-UX, Tru64 Unix, Irix, etc, I will only give the example in Linux only.
I assume that you already have syslog-ng installed in your machine, otherwise you can consult the vendor or distro of your Linux website or documentation.

Setting the Router, Firewall and Switches:

CISCO Router & Switch (IOS):
service timestamps log datetime localtime
no logging console
no logging monitor
logging facility local4

info-center enable
info-center loghost facility local4 language english

The configuration file of syslog-ng located at /etc/syslog-ng/syslog-ng.conf:

# /etc/syslog-ng/syslog-ng.conf options { long_hostnames(off); sync(0); perm(0640); stats(3600); };

source src { internal(); udp(ip("") port(514)); };

## Filter for facility type or device
filter f_router { facility(local4);};
filter f_firewall { facility(local5);};
filter f_switch { facility(local6);};

## Filter for IP address
filter f_ROUTER01 { host(""); };
filter f_FIREWALL01 { host(""); };
filter f_FIREWALL02 { host(""); }; filter f_SWITCH01 { host(""); };

#Destination files
destination ROUTER01 { file("/var/log/ROUTER01.log"); };
log { source(src); filter(f_router); filter(f_
ROUTER01); destination(ROUTER01); };

destination FIREWALL01 { file("/var/log/FIREWALL01.log"); };
log { source(src); filter(f_firewall); filter(f_
FIREWALL01); destination(FIREWALL01); };

destination FIREWALL02 { file("/var/log/FIREWALL02.log"); };
log { source(src); filter(f_firewall); filter(f_
FIREWALL02); destination(FIREWALL02); };
SWITCH01 { file("/var/log/SWITCH01.log"); };
log { source(src); filter(f_switch); filter(f_
SWITCH01); destination(SWITCH01); };

save it, then execute these command to make the log files.

touch /var/log/ROUTER01.log
touch /var/log/FIREWALL01.log
touch /var/log/FIREWALL02.log
touch /var/log/SWITCH01.log

To START/STOP the Syslog-ng service:

service syslog start and service syslog stop or service syslog reload

try to log in to the router, and do some command like to show the cpu, then on the linux excute this command:

tail -f

You will see some log will write to the log file.

Thursday, September 6, 2007

Running Apache, MySQL and PHP in Windows

At my early days learning NETWORKING, I did not know the difference between Linux and PHP, Server and HTML, PHP and Database and many networking terms. I just go to a local training center at my city to be a WEBMASTER.
I still did not know the meaning of webmaster ( in that time I thought it is a degree like in martial arts hehe) until the instructor said that it was a common nickname for a guy who update and maintain a website (correct me if I am wrong !).
So then I taken the wrong class to study Networking :( .
But from that day, I learns that it is very good to learn networking by web development, so I can know how the server and the process done. Since then in my spare time I asked many questions to the instructor about servers (web, mysql, ftp, dns) and also networking (IP, network operating system, etc). Thank God they very helpful to answer them.
Then to help many newbie and also Windows Lover (who do not know many things about Linux and UNIX) to create a web product using PHP, I share about an application that running on Windows (NT, 2000, XP, 2003, Vista) that also used in many Linux and UNIX OS. It is called WAMP (Windows Apache MySQL and PHP) server alias . This application use PHP 5, MySQL 5 and Apache 2 so will be updated to with the version.
With this WAMP, you can turn your Windows to be a powerful dynamic web server + database server. Just do the install and follow the manual ...and then...HOOPLA... status OK ...

Tuesday, September 4, 2007

NTP client setting in Windows 2000 and Windows XP in command prompt

NTP stand for Network Time Protocol, which is used for Time synchronization across computer networks or equipment so the computer or equipment always has the correct and accurate time. This protocol use User Datagram Protocol (UDP) port 123. The computer or network equipment usually synchronize their local time with one or more NTP server that connect to them by LAN, WAN or Global Internet. NTP server usually get the time from an accurate time source, like GPS (Global Positioning System) or other very accurate time sources.

For some computer that run Windows XP and Vista , Linux, UNIX, Mac OS, etc, the NTP client already install default in the Operating System and have an interface to setting the NTP client. There is also some 3rd party software that can be freely to download and simple to use like TimeTools SNTP client , SP Time Sync.
But actually for Windows XP there is already some setting to use the NTP directly without use 3rd party application.

For Windows XP using GUI:
You can directly navigate START --> Control Panel --> Date and Time, klik for Internet Time, choose the time server and then klik Update Now
If success, you will see a result like this.

For Windows 2000 and Windows XP (using command):
Go to START  Run  type cmd (a command prompt will be open)
on the command prompt, type as follow, assume the NTP server is or you can use your server IP address.

C:\ net time /

C:\ net stop w32time

C:\ net start w32time

Hola… you already set your Windows 2000 NTP sync without 3rd party application. Then check using this, should be no error is generated.

C:\ net time /querysntp

Good luck!!

Networking is easy

Who said that networking is difficult, need many time to study it, need complicated configuration and need special trained person to do it? The answer is NO !! This time you and everybody else can do it easily, as you want to learn it with some efforts, a newbie like me even also can do it.
OKAY, enough with the explanations. Let us start to do it EZY-ly (easily).