Month: September 2009


Service name : dhcpd
file /etc/dhcp.conf : file cau hinh
[root@localhost /]# cat /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
DHCPARGS=eth1; //Card mang dùng để chạy dhcp
subnet netmask {
# — default gateway
option routers;
option subnet-mask;
option domain-name "";
option time-offset -18000;         //
option broadcast-address;
option domain-name-servers;
option netbios-name-servers;
range dynamic-bootp;
default-lease-time 315360000;
max-lease-time 315360000;
host cl1 {
hardware ethernet 00:1d:72:09:72:19;
host cl2 {
hardware ethernet 00:1d:72:09:72:19;
option domain-name-servers,;
option routers;
[root@localhost /]#
Case No1 : Nếu hệ thống có 3 mạng LAN muốn cấu hình DHCP cho 3 mang LAN thì phải cấu hình dhcpd.conf như thế nào ? Giả sử 3 mạng đó cùng connect đến 1 Switch Layer 3.
Solution :
Trên DHCP server sử dụng 3 NIC, cấu hình mỗi NIC nhận "bootp request" từ đó mỗi eth sẽ tiếp nhận và xử lý các request từ các LAN trên switch. chú ý trên switch phải cấu hình VLAN.
Bai tap :
1. Tao 3 card mang :
a. Lang nghe SSH
b. Lang nghe web
c. Lang nghe FTP
1.1 Cau hinh SSH Server dung private key
1.2 Cau hinh FTPD chroot cho tat ca user
1.3 Tao virtual host cho 2 domauin,
Theo template /home.www.<domain>/httpdocs : Documanent Root
Theo template /home.www.<domain>/logs : Thu muc chua access_log vaf error_log
Tao 2 user ten la co thu muc $HOME la /home/www/
Tao 2 user ten la co thu muc $HOME la /home/www/
Cấu hình server sao cho 2 user này được quyền ftp và dung lượng tối đa dc sử dụng là 512MB


How to Display General System Information

How to Display General System Information

To display general system information, use the showrev

Examples–Displaying General System Information

The following example shows the showrev command output.
The -a option displays all available system information.

$ showrev -a
Hostname: starbug
Hostid: nnnnnnnn
Release: 5.9
Kernel architecture: sun4u
Application architecture: sparc
Hardware provider: Sun_Microsystems
Kernel version: SunOS 5.9 May 2002

OpenWindows version:
X11 Version 6.6.1 5 April 2002

No patches are installed

You can also use the uname command to display system
information. The following example shows the uname command
output. The -a option displays the operating system name as
well as the system node name, operating system release, operating system version,
hardware name, and processor type.

$ uname
$ uname -a
SunOS starbug 5.9 Generic sun4u sparc SUNW,Ultra-5_10

How to Display a System’s Host ID Number

To display the host ID number in hexadecimal format, use the hostid command.

Example–Displaying a System’s Host ID Number

The following example shows sample output from the hostid

$ hostid

How to Display a System’s Installed Memory

To display the amount of memory installed on your system, use the prtconf command.

Example–Displaying a System’s Installed Memory

The following example shows sample output from the prtconf command. The grep Memory command selects output from the prtconf
command to display memory information only.

# prtconf | grep Memory
Memory size: 128 Megabytes

How to Display the Date and Time

To display the current date and time according to your system clock,
use the date command.

Example–Displaying the Date and Time

The following example shows sample output from the date

$ date
Thu May 31 17:44:58 MDT 2003

Changing System Information

This section describes commands that enable you to change general system

ProcedureHow to Set a System’s Date and Time Manually

  1. Become superuser.

  2. Enter the new date and time.

    # date mmddHHMM[[cc]yy]


    Month, using two digits.


    Day of the month, using two digits.


    Hour, using two digits and a 24-hour


    Minutes, using two digits.


    Century, using two digits.


    Year, using two digits.

    See date(1)
    for more information.

  3. Verify that you have reset your system’s date correctly by using the date command with no options.

Example–Setting a System’s Date and Time Manually

The following example shows how to use the date command
to manually set a system’s date and time.

# date
Thu Jun 21 13:59:15 MDT 2003
# date 0621141003
Thu Jun 21 14:10:00 MDT 2003

ProcedureHow to Set Up a Message-of-the-Day

Edit the message-of-the-day file, /etc/motd, to
include announcements or inquiries to all users of a system when they log
in. Use this feature sparingly, and edit this file regularly to remove obsolete

  1. Become superuser.

  2. Edit the /etc/motd file and add a message of your

    Edit the text to include the message that will be displayed during user
    login. Include spaces, Tabs, and Returns.

  3. Verify the changes by displaying the contents of the /etc/motd file.

    $ cat /etc/motd
    Welcome to the UNIX Universe. Have a nice day.

Example–Setting Up a Message-of-the-Day

The default message-of-the-day, provided when you install Solaris software,
contains SunOS version information.

$ cat /etc/motd
Sun Microsystems Inc. SunOS 5.9 Generic May 2002

The following example shows an edited /etc/motd
file that provides information about system availability to each user who
logs in.

$ cat /etc/motd
The system will be down from 7:00 a.m to 2:00 p.m. on
Saturday, July 7, for upgrades and maintenance.
Do not try to access the system during those hours.
Thank you.

ProcedureHow to Change a System’s Host Name

A system’s host name is specified in several different locations.

Remember to update your name service database to reflect the new host

Use the following procedure to change or rename a system’s name.

  1. Become superuser.

  2. Change the system’s host name in the following files:

    • /etc/nodename

    • /etc/hostname.xxy

    • /etc/inet/hosts

    • /etc/net/ticlts/hosts

    • /etc/net/ticots/hosts

    • /etc/net/ticotsord/hosts

  3. (Optional) If using a name service, change the system’s host name in the hostfile.

  4. Reboot the system to activate the new host name.

    # init 6


How to get Physical Memory and CPU speed using unix commands?

$ /usr/sbin/prtconf |grep -i "Memory size"
$ swap -s
$ df -k
$ /usr/local/bin/top
$ vmstat 5 100
$ sar -u 2 100
$ iostat -D 2 100
$ mpstat 5 100
a. HP-UX 11.0:
$ grep Physical /var/adm/syslog/syslog.log
$ df -k
$ sar -w 2 100
$ sar -u 2 100
$ /bin/top
$ vmstat -n 5 100
$ iostat 2 100
$ top
b. AIX:

$ /usr/sbin/lsattr -E -l sys0 -a realmem
$ /usr/sbin/lsps -s
$ vmstat 5 100
$ iostat 2 100
$ /usr/local/bin/top # May not be installed by default in the server

c. Linux http://RedHat 7.1 and RedHat AS 2.1:
$ dmesg | grep Memory
$ vmstat 5 100
$ /usr/bin/top


OS Specific Commands:
/usr/sbin/lsattr -E -l sys0 -a realmem
/usr/sbin/lsps -s

grep Physical /var/adm/syslog/syslog.log
/usr/sbin/swapinfo -t

cat /proc/meminfo | grep MemTotal
/sbin/swapon -s

/usr/sbin/prtconf | grep "Memory size"
/usr/sbin/swap -s

vmstat -P| grep -i "Total Physical Memory ="
/sbin/swapon -s

On linux you dont have prtdiag but you can download a bunzip prtdiag file just google up you will find the download url.

file: prtdiag-1.2.tar.bz2
bunzip2 prtdiag-1.2.tar.bz2
tar xvf prtdiag-1.2.tar