Pages

Saturday, April 30, 2011

SOLARIS NETWORKING

1.The NICS in the system are listed by the following command

# dladm show-dev

2. Information about links on the data-link layer is displayed by

# dladm show-link

3. You also add information to certain configurationfiles to create a persistent network configuration. The most common files are /etc/hostname.interface, where interface is the specific interface that is used on the system, and /etc/hosts.

4. To set IPADDRESS to in Solaris X86 do the following.

# ifconfig rtls0 plumb 192.168.0.20/24

5. To check the ipaddress

# ifconfig -a

6. To make the configuration persist across the reboot do the following.

# echo 192.168.0.20/24 > /etc/hostname.rtls0

Add the corresponding ipaddress and hostname to /etc/hosts

# nano /etc/hosts

192.168.0.20/24 solaris1

7. To add the defaultrouter to the system

# echo 192.168.0.1 > /etc/defaultrouter

8. To enable packet forwarding in Solaris

# svcadm enable ipv4-forwarding

9. To start Routing protocol

# svcadm enable route:default


10. Perform a reconfiguration reboot

# reboot –- -r

11, To check packet forwarding is enabled

# routeadm

12. To disable packet forwarding

# svcadm disable ipv4-forwarding

13. To perfom reconfiguration reboot

# reboot -- -r

14. To view the routing table.

# netstat -rn

15.  To add a purticular route

#  route -p add -net 10.0.5.0/24 -gateway 10.0.5.150/24

15. 

















ADDING A NEWUSER IN SOLARIS

Defult home directory of normal users in Solaris is /export/home/username

Before creating the user you should create a directory in /export/home/username . Add the user using the following command.


# useradd -d /export/home/user user

The following option can be used with the useradd command.


1. -u 1003—Specifies the UID
2. -g 102—Specifies the GID of the primary group
3. -d /export/home/sandy—Specifies the home directory
4. -s /bin/ksh—Specifies the login shell
5. -m—Creates the home directory specified by the -d option
6. -k /etc/skel—Specifies the location of skeleton files, such as .profile
7. username —Specifies the user name of the account
###############################################################################################

# useradd -u 1003 -g 102 -d /export/home/user -s /usr/bin/bash -c "Vasanth" -m -k /etc/skell

#################################################################################################

UID AND GID OF USERS IN SOLARIS

1. A UID for a regular user can be between 100 and 2147483647 (except for
60001, 60002, and 65534).

2. UIDs 0–99, 60001, 60002, and 65534 are reserved for use by the Solaris OS

NOTE: avoid using UIDs over 60000 because they are not compatible with some Solaris features.

DEFAULT USER GROUP IN SOLARIS
##############################

When a new user is created he will be assigned to a primary group called staff.

NOTE: GIDs are assigned from the unused integers between 100 and 60000.

SETTING PASSWORD SECURITY POLICY IN SOLARIS

The Length of the password, Password locking after failed attempts and algoritham used to encrypt the password are define in

# /etc/security/policy.conf

By default in Solaris password length has set to 8 characters. If you set a password with 10
character long 9, 10 are simply ignored.

####### Setting better up a better password in Solaris 10 do the following. ########


# nano /etc/security/policy.conf

change the below lines and save the file


CRYPT_ALGORITHMS_DEPRECATE=__unix__
CRYPT_DEFAULT=2a




The password complexity rules, history, and password-aging defaults are specified
in the

# /etc/default/passwd

Monday, April 25, 2011

LINUX LIKE PINGING IN SOLARIS

Normally in Solaris the output of the ping command contain only one line. That is it gives the out put as given below.

-bash-3.00# ping google.com
google.com is alive


######## To Use ping just Like in Linux##########

# ping -s google.com

SETTING DNS CLIENT IN SOLARIS

# touch /etc/resol.conf

# nano /etc/resolv.conf

nameserver 192.168.1.1

save the above file


# cp /etc/nsswitch.dns /etc/nsswitch.conf

To test the above setup

# nslookup google.com

SETTING DEFAULT ROUTE IN SOLARIS

############ TO ADD A DEFAULT GATEWAY###############

# route add default 192.168.1.1


If you need to make route to be persist across the reboot

# echo 192.168.1.1 > /etc/defaultrouter

NFS SERVER SOLARIS

To enable the NFS service run the following command

# svcadm -v enable -r network/nfs/server

To share /packages directory

# share -F nfs -o rw /packages

The above command is mainly used fro temporary sharing and it will not persist on reboot. To make the share persist on the reboot do the following.

# nano /etc/dfs/dfstab

share -F nfs -o rw /packages

save the file

To mount the share from a remote machine.

Login to the client

# mount -t your nfsserver:/package /mnt



##########To restart the NFS server################


# /etc/init.d/nfs.server stop
# /etc/init.d/nfs.server start


######## To disable NFS server#####################


# svcadm -v disable -st network/nfs/server

Installing Nano editor In SOLARIS

-bash-3.00# mkdir /packages

-bash-3.00# cd /packages

-bash-3.00# ftp://ftp.sunfreeware.com/pub/freeware/intel/10/nano-2.0.9-sol10-x86-local.gz

-bash-3.00# gunzip nano-2.0.9-sol10-x86-local.gz

-bash-3.00# pakgadd -d nano-2.0.9-sol10-x86-local

The above steps will help you install nano. nano will be installed inside /usr/local/bin.

Just run

-bash-3.00# /usr/local/bin/nano

Changing The Default shell to Bash in Solaris

Login to the server as root

Run the following command
# passwd -e

It will prompt like below

Old shell: /bin/sh
New shell:

Enter the new shell as

New shell: /usr/bin/bash

Thursday, March 10, 2011

LDAP ERROR

[root@test1 ~]# /etc/init.d/ldap start
Stopping slapd: [ OK ]
Checking configuration files for slapd: bdb_db_open: Warning - No DB_CONFIG file found in directory /var/lib/ldap: (2)
Expect poor performance for suffix dc=example,dc=internal.
config file testing succeeded
[ OK ]
Starting slapd: [ OK ]


If you get error while starting ldap for the first time. Do the following.

[root@fedora ~]# rm -rf /var/lib/ldap/*

[root@fedora ~]# updatedb

[root@fedora ~]# locate DB_CONFIG.example
/usr/share/doc/openldap-servers-2.4.12/DB_CONFIG.example

[root@test ~]# cp /usr/share/doc/openldap-servers-2.4.12/DB_CONFIG.example /var/lib/ldap/DB_CONFIG

[root@fedora ~]# chown -R ldap:ldap /var/lib/ldap


Please restart now the error should be resolved.

[root@fedora ~]# /etc/init.d/ldap restart
Stopping slapd: [ OK ]
Starting slapd: [ OK ]

Sunday, January 30, 2011

Playing with X(X11)

Virtual Terminals


Linux, FreeBSD, and many other modern Unix kernels support a virtual terminal.(VT) (or virtual console ) capability, which provides independent virtual video cards. The monitor, keyboard, mouse, and physical video card are associated with only one VT at a time, and each virtual video card can be in a different display mode—some may be in character mode while others are in graphical mode. This enables multiple X servers and nongraphical sessions to be active at the same time.

When you are connected to a virtual terminal that isn’t running an X server, you can use Alt-LeftArrow to go to the previous VT and use Alt-RightArrow to switch to the next VT. FreeBSD provides a very similar VT capability, except that the VTs are numbered starting at zero, and the key combination to switch VTs when in character mode is Alt-Fx .

NOTE: Although most kernels support more than 12 virtual terminals, this capability is rarely used because you can’t usually use the keyboard to go directly to higher-numbered Vts.


Starting a Raw X Server Manually
1. The simplest way to start an X server is also the least-used technique: simply type the name of the server at a shell prompt:

$ X

You must enter “X” as a capital letter.



2.If an X server is already running on display :0 , you will get an error message, because the network port will already be in use. In that case, you can give the new X server a different display number:


$ X :1


3 .By default, the X server will start on the first unused VT (usually VT8). You can
request a specific VT by specifying it on the command line:


$ X :1 vt10

4. You can also specify that a particular configuration file should be used, or a particular ServerLayout within a configuration file:


$ X :1 -config configFile


$ X :1 -layout layoutName



NOTE: The downside to starting the X server this way is that no clients are started. Until you start some manually, you’ll be left staring at a blank screen with only a mouse pointer to amuse yourself.

4.You can start the X server and a client at the same time like this:

$ X :1 -terminate & sleep 2 ; DISPLAY=:1 xterm

Using a Display Manager to Start the X
Server


5 .Three display managers are in common use. The biggest difference between them is the toolkit upon which they are built:

• GDM: GNOME Display Manager (built on GTK)
• KDM: KDE Display Manager (Qt)
• XDM: X Display Manager (Xt)

6.You may be able to recognize the display manager used on your system by its appearance, since each toolkit has a distinctive look. Alternately, you can search the process table to see what’s running, using the following:

$ ps -e | grep '[gkx]dm'


7. When you boot into any runlevel that does not start X automatically, you can start
the display manager manually by typing the command name at a root shell prompt:


# gdm

NOTE: By default, Debian-based systems (including Ubuntu) start the display
manager in all runlevels. You can easily disable the startup of the display
manager in runlevel 3 by executing these commands:



# update-rc.d -f gdm remove
# update-rc.d gdm start 31 2 4 5 . stop 31 1 3 .



Started Directly by init


In some Linux distributions, the display manager is directly started by init . For example, in Redhat based systems /etc/inittab, you will find this entry:


# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon

The script /etc/X11/prefdm will execute /usr/sbin/autologin to automatically log in one user if that feature has been set up. Otherwise, it will start one of the display managers (GDM, KDM, or XDM) depending on the specification in /etc/sysconfig/desktop . If that file does not exist, then the first display manager found in alphabetical order will be used.

Since init has been set up to respawn the display manager automatically, it is relatively easy to load and test changes to the display manager configuration file—just kill the display manager! If you’re using XDM or KDM, you can kill the display manager by name:


# killall xdm

NOTE: Killing the display manager will also kill all the display manager’s child processes, including X serversso if you do this through the graphical interface, expect your session to disappear!


GDM is a wrapper script for gdm-binary, so if your system uses GDM , you’d have to kill the display manager with the following:

# killall gdm-binary


You can restart GDM immediately using its restart script:

# gdm-restart


you can specify that a restart should take place as soon as everyone is logged out:


# gdm-safe-restart

On a SUSE system, the display manager is started by

/etc/rc.d/rc5.d/S17xdm
(which is a symbolic link to /etc/rc.d/xdm ).


Similar to the prefdm script used by Fedora, this script finds your preferred display
manager using a configuration file—in this case,

/etc/sysconfig/displaymanager
(or it uses XDM if that file is missing.)

Since this is a regular init script, it is executed only once at startup; when the display manager terminates, it will not be restarted. After editing the display manager configuration file, you can reinvoke the XDM init script using the restart option to put your changes into effect:

# /etc/X11/xdm restart

Or you can use the SUSE shortcut:

# rcxdm restart

Starting Multiple X Servers Using a Display
Manager

Starting Multiple X Servers Using XDM

XDM and older versions of KDM (pre-3.4) use the Xservers file to configure the number of servers started by the display manager.

Open /etc/X11/xdm/Xservers, /opt/kde3/share/config/kdm/Xservers

To start additional X servers, simply add lines at the bottom of this file:


:0 local /usr/bin/X // This is the default line.

Add the lines

:1 local /usr/bin/X :1 vt8
:2 local /usr/bin/X :2 vt9




If you wish to specify a different configuration file for one of the X servers, you can
add a -config argument to the command:

:3 local /usr/bin/X -config configgile :3 vt10

Starting Multiple X Servers Using KDM

If you’re using KDE 3.4 or higher, the local X server configuration is controlled by
the kdmrc file

# /usr/share/config/kdm/kdmrc


In the [General] section of that file, you can specify a list of local displays to be started by adding a StaticServers key:

StaticServers=:0,:1,:2

If this line is missing, the default is to start only display :0 .


Starting Multiple X Servers Using GDM

GDM is configured using two files; the first specifies default values, which may be
overwritten when GDM is updated, and the second provides local values, which are
never overwritten.

/usr/share/gdm/defaults.conf - Defaults

/etc/gdm/custom.conf – Local Values


# vi /usr/share/gdm/defaults.conf

Go to the section

[servers]
0=Standard
1=Standard // Thsi will start second X in

If you wish to use a different configuration for a specific display, you can add a new
configuration section to the local configuration file:
[server-LowRes]
name=Low-Resolution Server
command=/usr/bin/X -config /etc/X11/xorg.conf-lowres
flexible=false


Then specify that configuration for one of your displays:

[servers]
0=Standard
1=Standard
2=Standard
3=LowRes

Recent versions of both GDM and KDM are capable of starting additional X servers
on demand. This is useful when you occasionally want to use multiple X servers but
don’t want the extra overhead when a single X server only is in use. The GNOME
developers call these additional servers flexible servers; the KDE folks call them
reserve servers.


$ gdmflexiserver

gdmflexiserver can also start a nested X server (using Xnest) and present a session
login prompt there:


$ gdmflexiserver -n


Starting Additional X Servers Using KDM

To start multiple KDE desktop on boot open kdmrc file and enter the following.

ReserveServers=:3,:4,:5


The xinit utility can be used to start an X server with specified clients, but the startx wrapper script provides a friendlier interface. After logging in at a character-based login prompt, simply execute:

$ startx

You can explicitly specify a client to be started:

startx /usr/bin/xterm -bg yellow -geometry 180x50

Switching VTs from the Shell Prompt

xdpyinfo
We can switch the virtual terminals using one of the following command.

$ switchto 7
Or:
$ chvt 7

We can also use this command Remotely.




Starting X Within X

To start Xnest on the current display, use the following:


$ Xnest :1

To start Xnest with a particular client, you can use the startx script:

$ startx /usr/bin/startkde -- /usr/bin/Xnest :1

To start Xnest with two screens of 600 * 400 pixels, use the following:

$ Xnest -scrns 2 -geometry 600x400 :1

For many applications it’s desirable to have the X server exit when the last client disconnects. This is configured by adding the -terminate option to the X command line:

$ X -terminate

Let the X Server Configure Itself

The X.org server can, in most cases, probe, guess, and assume enough about the display configuration to start without a configuration file. Even better, it can generate a basic configuration file, if you specify the -configure option on the server command line:

# X -configure

If you’re already running the X server, you can specify an alternate display number
(such as :1 ) on the command line:

# X -configure :1

The X server will gather as much information as possible by probing the hardware,
and will then write the configuration file to /root/xorg.conf.new .
You can test the configuration file by manually specifying it on the command line:

# X -config /root/xorg.conf.new


If the server appears to start and then immediately exits, while displaying
the message Fatal server error: failed to initialize core devices, then
your configuration may be fine except for the pointer device. Try telling
the X server to continue even if the pointer cannot be opened:


# X -config /root/xorg.conf.new -allowMouseOpenFail

Wednesday, January 12, 2011

Monday, January 3, 2011

LInux Advanced Routing

# ip link list // List al our local interfaces.

# ip address show // Shows our all Local interfaces

# ip route show // List all our routes.

# ip neigh show // To lsit current ARP cache

# ip neigh delete 192.168.0.229 dev eth0 // To delete an entry from arp cache.

# ping -c 1 192.168.0.229 // To add 192.168.0.229 to ARP cache.

#

Tuesday, November 23, 2010

ATTACK

A quick and useful command for checking if a server is under ddos:
netstat -anp |grep ‘tcp\|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

That will list the IPs taking the most amounts of connections to a server. It is important to remember that ddos is becoming more sophisticated and they are using fewer connections with more attacking ips. If this is the case you will still get low number of connections even while you are under a DDOS.

Another very important thing to look at is how many active connections your server is currently processing.

netstat -n | grep :80 |wc -l

netstat -n | grep :80 | grep SYN |wc -l

The first command will show the number of active connections that are open to your server. Many of the attacks typically seen work by starting a connection to the server and then not sending any reply making the server wait for it to time out. The number of active connections from the first command is going to vary widely but if you are much above 500 you are probably having problems. If the second command is over 100 you are having trouble with a syn attack.

To Block a certain IP address that on server .Please use following commands

—————–command——————————

route add ipaddress reject

for example route add 192.168.0.168 reject

You can check whether given IP is blocked on server by using following command

route -n |grep IPaddress

—————–command——————————

OR

use follwoing command to block a ip with iptables on server
—————–command——————————
iptables -A INPUT 1 -s IPADRESS -j DROP/REJECT

service iptables restart

service iptables save

—————–command——————————

Then KILL all httpd connection and restarted httpd service by using following command

killall -KILL httpd

service httpd startssl


additionally you can check the connection ports here


lsof | grep ESTABLISHED
lsof | grep LISTEN

lsof -p PID

Friday, November 19, 2010

POSTGRESQL ERROR

IF you get an error given below

FATAL 1: IDENT authentication failed for user "postgres"'

Do the following to fix it.

# vi /var/lib/pgsql/data/pg_hba.conf


Add the line

host all 127.0.0.0 255.255.255.255 trust

:wq // save the file


The /var/lib/pgsql/data/pg_hba.conf will look like this.

# TYPE DATABASE USER CIDR-ADDRESS METHOD

#local all all ident sameuser
host all all 127.0.0.1/32 trust




# service postgresql restart

INSTALLING MAVEN

# cd /opt


# wget -c http://www.eng.lsu.edu/mirrors/apache//maven/binaries/apache-maven-3.0-bin.tar.gz

# tar xvzf apache-maven-3.0-bin.tar.gz

# vi /etc/profile

Add the following lines to the end of the file

M2_HOME=/opt/apache-maven-3.0
export M2_HOME
PATH=$PATH:$M2_HOME/bin

:wq // save the file


# source /etc/profile

Apache maven is installed and ready to use.

Monday, November 1, 2010

Tux blog: INSTALLING OPENNMS

Tux blog: INSTALLING OPENNMS: "OpenNMS is the world's first enterprise-grade network management system developed under the open source model. As with any complex and power..."

INSTALLING OPENNMS

OpenNMS is the world's first enterprise-grade network management system developed under the open source model. As with any complex and powerful system, getting it installed and configured can take a little effort.

Minimum Requirements
--------------------

* A 1 GHz Pentium III (or equivalent processor) or better. OpenNMS can also take advantage of multiple processors.

* A minimum of 256 MB of RAM, although 512 MB is strongly recommended. The OpenNMS Java Virtual Machine benefits from large amounts of memory, up to 2 GB, and more if using a 64-bit processor.

* OpenNMS requires about 200 MB of disk space for the program files. In addition, each data variable collected requires, by default, a little under 300 KB of disk space.


Configure RPM-based Distributions with Yum
-------------------------------------------

[root@localhost ~]# yum install yum-fastestmirror


Install the OpenNMS Repository RPM
-----------------------------------

rpm -Uvh http://yum.opennms.org/repofiles/opennms-repo-snapshot-fc7.noarch.rpm

Or, to install the latest unstable release on CentOS or RHEL 5, you would run:

rpm -Uvh http://yum.opennms.org/repofiles/opennms-repo-unstable-rhel5.noarch.rpm

Installing Java on RPM-based Distributions Using Yum
----------------------------------------------------

[root@localhost ~]# yum install jdk


Installing PostgreSQL on RPM-Based Distributions Using Yum
----------------------------------------------------------

[root@localhost ~]# yum -y install postgresql-server


Configure PostgreSQL
--------------------

Locate the Postgres "data" directory. Often this is /var/lib/pgsql/data. You should then find the two files we need to modify in that directory.

First we need to make sure PostgreSQL is listening on an IP socket, and not just a local unix socket.


Edit postgresql.conf File and add the following.

listen_addresses = 'localhost'

max_connections = 256

max_connections = 256



Customizing the pg_hba.conf File
--------------------------------

Add the below lines.

# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust


Creating the PostgreSQL Database
---------------------------------


# /etc/init.d/potgresql start


Installing JICMP on RPM-Based Distributions Using YUM
-----------------------------------------------------


[root@localhost ~]# yum install jicmp



Installing OpenNMS
------------------
------------------


[root@localhost ~]# yum install opennms-*

Configure Java for OpenNMS
--------------------------

[root@localhost ~]# /opt/opennms//bin/runjava -s


The desired outpu is given below:


runjava: Looking for an appropriate JRE...
runjava: Checking for an appropriate JRE in JAVA_HOME...
runjava: skipping... JAVA_HOME not set
which: no java in (/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/opennms/bin:/root/bin)
runjava: did not find a JRE in user's path
runjava: searching for a good JRE...
runjava: found a good JRE in "/usr/java/jdk1.5.0_18/bin/java"
runjava: value of "/usr/java/jdk1.5.0_18/bin/java" stored in configuration file
You have new mail in /var/spool/mail/root


Configure a specific JRE
-------------------------


If you need to configure specific JRE do the following:

[root@localhost]# /opt/opennms/bin/runjava -S


Run the OpenNMS Installer Application
-------------------------------------

[root@localhost ~]# /opt/opennms/bin/install -l /usr/local/lib -dis




Login to the Web Application
-----------------------------

By default, OpenNMS's built-in web server listens on port 8980, so point your browser at http://:8980/opennms/


The initial user name is "admin" and the password is "admin".

Enjoyyyy...............


If you need any further assistance. Ping me

Email: vasanth462@gmail.com

Thursday, October 28, 2010

To Speed up the installation using YUM

You may want to install the yum-fastestmirror RPM if your distro supports it. This can often speed up downloads of large packages. See the CentOS Wiki

# yum install yum-fastestmirror