Sunday 20 April 2008

Command Reference

Command Reference for IPCONFIG MS-DOS Command


Ipconfig is a MS-DOS command-line tool used to display and manage the network settings of your computer. Ipconfig is available on Windows machines, and it displays the current network connection details and DHCP client settings.

Ipconfig is an external MS-DOS command, and is available on Windows 95, Windows 98, ME, NT, 2000, XP and Windows Vista Operating Systems. On Windows 9x machines, a graphical tools such as "winipconfig" or "winipcfg" may be used instead. On Linux machine, the ifconfig command performs equivalent function.

C:> ipconfig /?

USAGE:
ipconfig [/? | /all | /renew [adapter] | /release [adapter] |
/flushdns | /displaydns | /registerdns |
/showclassid adapter |
/setclassid adapter [classid] ]

where
adapter Connection name
(wildcard characters * and ? allowed, see examples)

Options:
/? Display this help message
/all Display full configuration information.
/release Release the IP address for the specified adapter.
/renew Renew the IP address for the specified adapter.
/flushdns Purges the DNS Resolver cache.
/registerdns Refreshes all DHCP leases and re-registers DNS names
/displaydns Display the contents of the DNS Resolver Cache.
/showclassid Displays all the dhcp class IDs allowed for adapter.
/setclassid Modifies the dhcp class id.

The default is to display only the IP address, subnet mask and
default gateway for each adapter bound to TCP/IP.

For Release and Renew, if no adapter name is specified, then the IP address
leases for all adapters bound to TCP/IP will be released or renewed.

For Setclassid, if no ClassId is specified, then the ClassId is removed.

Examples:
> ipconfig ... Show information.
> ipconfig /all ... Show detailed information
> ipconfig /renew ... renew all adapters
> ipconfig /renew EL* ... renew any connection that has its
name starting with EL
> ipconfig /release *Con* ... release all matching connections,
eg. "Local Area Connection 1" or
"Local Area Connection 2"

C:>ipconfig /all

Windows IP Configuration

Host Name . . . . . . . . . . . . : topwebhosts
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Wireless Network Connection:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) PRO/Wireless LAN 2100 3B Mi
ni PCI Adapter
Physical Address. . . . . . . . . : 00-0C-F1-65-5B-70
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 192.168.1.100
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
DHCP Server . . . . . . . . . . . : 192.168.1.1
DNS Servers . . . . . . . . . . . : 192.168.1.1
Lease Obtained. . . . . . . . . . : Thursday, February 08, 2007 2:27:17
PM
Lease Expires . . . . . . . . . . : Thursday, February 15, 2007 2:27:17
PM

Ethernet adapter Local Area Connection:

Media State . . . . . . . . . . . : Media disconnected
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Mobile Connecti
on
Physical Address. . . . . . . . . : 00-0D-60-FB-4E-E9


To learn the names of ethernet adapters that you can optionally specify with "ipconfig" command, you may simply type ipconfig command by itself. The command output displays all adapters by name that are available on your computer: e.g. "Local Area Connection", "Wireless Network Connection".

Ipconfig command is most often used to diagnose network problem on a Windows machine. If you're using DHCP, you may try releasing and renewing IP address by performing "ipconfig /release" and "ipconfig /renew" commands shown below.
C:> ipconfig /release
Windows IP Configuration

No operation can be performed on Local Area Connection while it has its media di
sconnected.

Ethernet adapter Wireless Network Connection:

Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 0.0.0.0
Subnet Mask . . . . . . . . . . . : 0.0.0.0
Default Gateway . . . . . . . . . :

Ethernet adapter Local Area Connection:

Media State . . . . . . . . . . . : Media disconnected

C:> ipconfig /renew

Windows IP Configuration

Ethernet adapter Wireless Network Connection:

Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.1.100
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1


To workaround DNS caching issue, you may perform "ipconfig /flushdns" to clear DNS cache value on your computer. DNS uses TTL (Time-To-Live) value which let the intermediate name servers to cache DNS information. If you changed your DNS settings, and your computer doesn't see the change immediately, you may perform "ipconfig /flushdns" to clear the DNS cache.

C:> ipconfig /flushdns

Windows IP Configuration

Successfully flushed the DNS Resolver Cache.

Steps how to install Cacti on CentOS 5.2 + DirectAdmin

First of all, I'm not an Linux/DirectAdmin expert. I just played around with them and found the way to do it. I tried to install Cacti on my server but I couldn't find a complete instruction to do it. So, I just gathered all information I found into one place so that it is easier for many others. I hope it can help someone that needs the same thing that I did.

The software I use:

- CentOS 5.2 - 64-bit
- DirectAdmin 1.323 - Custombuild 1.1.13
- PHP 5 - CGI
- Apache 2.2
- MySQL 5
- Cacti 0.8.7b
Package Required by Cacti :

* RRDTool 1.0.49 or 1.2.x or greater
* MySQL 3.23 or greater, 4.0.20d or greater highly recommended for advanced features
* PHP 4.1 or greater, 4.3.6 or greater highly recommended for advanced features

Apache, PHP and MySQL are already installed by DirectAdmin. However, there are 2 required packages which are net-smtp and RRDTool that I need to install.

1. Install net-snmp with this command :

shell> yum install net-snmp net-snmp-utils


2. RRDTool, to compile or using RPM is not easy. It required many other packages. So, what I did is to follow this instruction : Installing RRDTool Using Yum

2.1 Create a file dag.repo under /etc/yum.repos.d :

shell> nano /etc/yum.repos.d/dag.repo

2.2 Then, copy and paste the following code :

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1


2.3 Save and run :

shell> yum install perl-rrdtool rrdtool

3. I, then, follow steps from Here. Extract the distribution tarball. Then, move to /var/www/html/cacti

shell> tar xzvf cacti-version.tar.gz
shell> mv cacti-version cacti
shell> mv cacti /var/www/html


4. Create the MySQL database: (Check MySQL Root password from /usr/local/directadmin/scripts/setup.txt)

shell> mysqladmin --user=root --password=password create cacti

5. Import the default cacti database: (cacti.sql is under cacti directory)

shell> cd /var/www/html/cacti
shell> mysql --user=root --password=password cacti < cacti.sql


6. Optional: Create a MySQL username and password for Cacti.

shell> mysql --user=root --password=password
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
mysql> flush privileges;

7. Edit include/config.php and specify the MySQL user, password and database for your Cacti configuration.

shell> cd /var/www/html/cacti/include
shell> nano -w config.php


Change information below :
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "somepassword";

8. Set the appropriate permissions on cacti's directories. In DirectAdmin, I tried a few users and got 500 Internal Server Error. So, I end up using user webapps and it works great.

shell> cd /var/www/html
shell> chown -R webapps:webapps cacti


9. Add a line to your /etc/crontab file similar to:

shell> nano -w /etc/crontab

Copy and paste following code:

*/5 * * * * webapps /usr/local/php5/bin/php-cgi /var/www/html/cacti/poller.php > /dev/null 2>&1


10. Edit your PHP Config File at /usr/local/etc/php5/cgi/php.ini for DirectAdmin CGI mode to allocate sufficient memory for Cacti:

shell> nano /usr/local/etc/php5/cgi/php.ini

By default, DirectAdmin comes with 128Mb, so, no need to do anything here.

memory_limit=128m


11. If you need to use SNMP with PHP, then, follow these steps :

If you don't have net-snmp-devel installed. Chec it by using "rpm -q net-snmp-devel"

If it's not installed, it will show :
shell> rpm -q net-snmp-devel
package net-snmp-devel is not installed

If it's already installed, it will show :
shell> rpm -q net-snmp-devel
net-snmp-devel-5.3.1-24.el5_2.1
net-snmp-devel-5.3.1-24.el5_2.1


If you want to install, use this command -> "yum install net-snmp-devel" After you've done installing net-snmp-devel, go through steps below to compile it into PHP.

shell> nano -w /usr/local/directadmin/custombuild/configure/suphp/configure.php5

Add a following line :

"--with-snmp"


Then recompile PHP :

shell> cd /usr/local/directadmin/custombuild
shell> ./build php n

12. Point your web browser to:

http://your-server/cacti/


Log in with a username/password of admin. You will be required to change this password immediately. Make sure to fill in all of the path variables carefully and correctly on the following screen.

Below is the Path I used in Cacti :

snmpwalk Binary Path : /usr/bin/snmpwalk
snmpget Binary Path : /usr/bin/snmpget
snmpbulkwalk Binary Path : /usr/bin/snmpbulkwalk
snmpgetnext Binary Path : /usr/bin/snmpgetnext
RRDTool Binary Path : /usr/bin/rrdtool
PHP Binary Path : /usr/local/php5/bin/php-cgi
Cacti Log File Path : /var/www/html/cacti/log/cacti.log

If you use CLI Mode, Configuration is below


shell> nano -w /usr/local/directadmin/custombuild/configure/ap2/configure.php5

Add "--with-snmp" into the file. You have to check that it's last line or not. All other lines will end with "" except last line. It will look like below :

.
.
.
--enable-magic-quotes
--enable-sockets
--enable-mbstring
--with-snmp

Monday 14 April 2008

Unable to update Centos 5.3

Unable to update Centos 5.3 using the command, "yum -y update." When doing so, I receive the long message below. I have also tried "yum clean all,"yum clean metadata" and "yum update kernel." The server has 256 MB and my only interest is keeping up with security updates before I get hacked

yum clean metadata
Loaded plugins: fastestmirror
12 metadata files removed
8 sqlite files removed
0 metadata files removed
> yum update kernel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Excluding Packages in global exclude list
Finished
Setting up Update Process
No Packages marked for Update
> yum update kernel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Excluding Packages in global exclude list
Finished
Setting up Update Process
No Packages marked for Update

Here is the fix:-
--------------
yum clean all
yum update glibc*
yum update yum* rpm* python*
yum clean all
yum update
shutdown -r now