November 2008 Archives

Cisco IOS DHCP with pxeboot

| 0 Comments | 0 TrackBacks

Below is a portion of the Cisco config where pxeboot is defined for the dhcp pool net. You'll notice 192.168.0.250 is defined as the next-server. Therefore you just need to make sure 192.168.0.250 is setup with tftp access and the proper pxelinux config is setup.

ip dhcp pool net
import all
network 192.168.0.0 255.255.255.0
bootfile pxelinux.0
next-server 192.168.0.250
dns-server 192.168.0.5 192.168.0.6
default-router 192.168.0.1
domain-name domain.com
lease infinite

Installing & Configuring SNMP on RHEL or CentOS

| 0 Comments | 0 TrackBacks

The script below was used to install and configure SNMP on a RHEL or CentOS box to act as a SNMP agent. This is a minimal configuration which can be tweaked for more functionality. In summary, the script does the following:

  1. Install net-snmp
  2. Setup snmpd.conf (minimal) configuration file
  3. Enable net-snmp to startup upon bootup
  4. Startup net-snmp



yum install net-snmp -y

cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig




cat > /etc/snmp/snmpd.conf << EOF
rocommunity public
com2sec local localhost public
com2sec network_1 172.16.0.0/24 public
com2sec network_2 192.168.0.0/24 public
group MyROGroup_1 v1 local
group MyROGroup_1 v1 network_1
group MyROGroup_2 v2c network_2
view all-mibs included .1 80
access MyROGroup_1 "" v1 noauth exact all-mibs none none
access MyROGroup_2 "" v2c noauth exact all-mibs none none
EOF

chkconfig snmpd on
service snmpd restart


Installing & Configuring NTP on RHEL or CentOS

| 0 Comments | 0 TrackBacks

The script below was used to configure the RHEL or CentOS host to act as an NTP client to the CentOS NTP pool. In summary, the script below does the following:

  1. Install ntp
  2. Setup the ntp.conf configuration file
  3. Enable ntp to startup upon bootup
  4. Startup ntp
  5. Execute ntpq to verify the box is acting as a ntp client



yum install ntp -y

cp /etc/ntp.conf /etc/ntp.conf.orig




cat > /etc/ntp.conf << EOF
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1

server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org

fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
EOF

chkconfig ntpd on
service ntpd restart
ntpq -p


Installing & Configuring DoveCot for RHEL of CentOS

| 0 Comments | 0 TrackBacks

The following is the script I use to install and configure DoveCot on RHEL of CentOS. In summary, the script is doing the following:

  1. Installing DoveCot
  2. Setup the dovecot.conf configuration file
  3. Enabling dovecot to start upon bootup
  4. Startup dovecot



yum install dovecot -y

cp /etc/dovecot.conf /etc/dovecot.conf.orig
cat > /etc/dovecot.conf << EOF
protocols = imap imaps

protocol imap {
}

protocol lda {
postmaster_address = postmaster@domain.com
}

auth default {
mechanisms = plain
passdb pam {
}
userdb passwd {
}
user = root
}

dict {
}


plugin {
}
EOF

chkconfig dovecot on
service dovecot restart

Once the script is completed, you can go ahead and use your mail client to connect to your server. The configuration file used here is for a IMAP(s) mail server.

Installing & Configuring Postfix on RHEL or CentOS

| 0 Comments | 0 TrackBacks

Below is the script I use to install and configure Postfix. My configuration requires that I use a outbound relay host, a smtp server from Postini. In summary, this script will do the following:

  1. Install Postfix
  2. Setup the main.cf configuration file
  3. Setup the virtual configuration file
  4. Execute postmap on the virtual file
  5. Enable Postfix to start upon bootup
  6. Disable Sendmail
  7. Shutdown Sendmail
  8. Startup Postfix



yum install postfix -y

cp /etc/postfix/main.cf /etc/postfix/main.cf.orig
cat > /etc/postfix/main.cf << EOF
myhostname = mail01.srv.domain.com
myorigin = $myhostname
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 192.168.0.0/24

virtual_alias_domains = domain.com domain2.com
virtual_alias_maps = hash:/etc/postfix/virtual

relayhost = outboundsXXX.obsmtp.com # postini

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix

inet_interfaces = localhost, mail01

unknown_local_recipient_reject_code = 550

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.3.3/samples
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
EOF

cp /etc/postfix/virtual /etc/postfix/virtual.orig
cat > /etc/postfix/virtual << EOF
# postmap /etc/postfix/virtual

postmaster@domain.com user1
user1@domain.com user1
user.one@domain.com user1
@domain.com user1

postmaster@domain2.com user1
@domain2.com user1
EOF

postmap /etc/postfix/virtual

chkconfig --add postfix
chkconfig postfix on
chkconfig sendmail off
service sendmail stop
service postfix restart


Apple Warranty Information

| 0 Comments | 0 TrackBacks

To find out if your Apple hardware is covered under warranty. Visit Apple's Online Service Assistant. Just plug in your serial number, select the country and Apple's system will tell you if you're covered.

https://selfsolve.apple.com/GetWarranty.do

Installing & Configuring Cacti on RHEL or CentOS

| 0 Comments | 0 TrackBacks

Below are the contents of a script I use to install cacti on either RHEL or CentOS. In summary, the script does the following.

  1. Configures the rpmforge repository
  2. Updates all the rpms on the box
  3. Removes 1.2.28 of RRDtool (currently broken)
  4. Installs 1.2.27 of RRDtool
  5. Installs Cacti
  6. Installs MySQL
  7. Enables MySQL & Apache to start on bootup
  8. Starts MySQL & Apache
  9. Initialize the Cacti database
  10. Adds the poller job to root crontab
  11. Update the cacti.conf file for Apache

With that said, you can go ahead and login to Cacti and configure Cacti. If you need more help on Cacti, refer to documentation on Cacti's website.

cd /tmp

# Setup rpmforge repo
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum update -y

# rrdtool 1.2.28 is broken - remove 1.2.28 and install 1.2.27
yum remove rrdtool -y
rpm -ivh ftp://rpmfind.net/linux/EPEL/5Client/i386/rrdtool-1.2.27-3.el5.i386.rpm

# install cacti et al
yum install cacti -y
yum install mysql-server -y

chkconfig mysqld on
chkconfig httpd on
service mysqld start
service httpd start

mysqladmin --user=root create cacti
cd /var/www/cacti
mysql cacti < cacti.sql
cat > /tmp/perm.sql << EOF
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser';
flush privileges;
exit
EOF



mysql mysql < /tmp/perm.sql

cat >> /var/spool/cron/root << EOF
*/5 * * * * cacti php /var/www/cacti/poller.php > /dev/null 2>&1
EOF

cat > /etc/httpd/conf.d/cacti.conf << EOF
Alias /cacti/ /var/www/cacti/

DirectoryIndex index.php
Options -Indexes
AllowOverride all
order deny,allow
deny from all
#allow from 127.0.0.1
allow from all
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc on
php_flag track_vars on


EOF

service httpd restart

echo "Login to the server via browser at http://`hostname`/cacti/index.php"
echo "login and password is admin"


Oracle TNS Configuration Examples

| 0 Comments | 0 TrackBacks

The following are examples of the different configuration you can use to connect to an Oracle database. With Load Balancing:


sales.us.acme.com=
(DESCRIPTION=
(ADDRESS_LIST=
(LOAD_BALANCE=on)
(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-server)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=sales2-server)(PORT=1521)))
(CONNECT_DATA=
(SERVICE_NAME=sales.us.acme.com)))
With Connect-Time Failover:

sales.us.acme.com=
(DESCRIPTION=
(ADDRESS_LIST=
(LOAD_BALANCE=off)
(FAILOVER=ON)
(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-server)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=sales2-server)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=sales.us.acme.com)))
With Advanced Connect Data Parameters (SERVICE_NAME defines a service called sales.us.acme.com):

sales.us.acme.com=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=sales.us.acme.com)))

Create a 500g volume with space guaranteed for the volume.

vol create new_vol -s volume aggr0 500g

Resize the volume if needed
vol size new_vol 600g

Offline and destroy volume if a mistake was made
vol offline new_vol
vol destroy new_vol

Create the qtree
qtree create /vol/new_vol/new_qtree

Create the 50g LUNs for Solaris
lun create -s 50g -t solaris /vol/new_vol/new_qtree/new101_lun
lun create -s 50g -t solaris /vol/new_vol/new_qtree/new102_lun
lun create -s 50g -t solaris /vol/new_vol/new_qtree/new103_lun
lun create -s 50g -t solaris /vol/new_vol/new_qtree/new104_lun

Map the LUNs
lun map /vol/new_vol/new_qtree/new101_lun SYSTEM01 101
lun map /vol/new_vol/new_qtree/new102_lun SYSTEM01 102
lun map /vol/new_vol/new_qtree/new103_lun SYSTEM01 103
lun map /vol/new_vol/new_qtree/new103_lun SYSTEM01 104

vtoc
cat > /tmp/vtoc50g << EOF
       0      0    00      16384 104808448 104824831
       2      5    01          0 104824832 104824831
EOF

Label disks and apply layout
fmthard -s /tmp/vtoc50g /dev/rdsk/c10t600xxxxxxd101s2
fmthard -s /tmp/vtoc50g /dev/rdsk/c10t600xxxxxxd102s2
fmthard -s /tmp/vtoc50g /dev/rdsk/c10t600xxxxxxd103s2
fmthard -s /tmp/vtoc50g /dev/rdsk/c10t600xxxxxxd104s2

Update permissions
chown oracle:dba /dev/rdsk/c10t600*d10*
chown oracle:dba /dev/dsk/c10t600*d10*

The DBA can now go ahead with adding the disks underl ASM control.