Showing posts with label Solaris. Show all posts
Showing posts with label Solaris. Show all posts

Monday, January 26, 2015

Solaris persitent routes

route -p show

route  -p add -host 204.209.228.134 172.16.64.32

route  -p delete -host 204.209.228.134 172.16.64.32

Monday, October 22, 2012

Solaris host unable to join multicast groups

An IGMPv2 Membership Request packet is described in RFC 3376.

IGMP messages are encapsulated in IPv4 datagrams, with an IP protocol number of 2. Every IGMP message described in this document is sent with an IP Time-to-Live of 1, IP Precedence of Internetwork Control (e.g., Type of Service 0xc0), and carries an IP Router Alert option in its IP header

The Router Alert option is described in RFC 2113.

The option type field is sub-divided into a one bit copied flag, a two bit class field, and a five bit option number.  These taken together form an eight bit value for the option type field.

Copy Class Number Value Name                            Reference
---- ----- ------ ----- ------------------------------- ------------
1    0     20     148   RTRALT - Router Alert           [RFC2113]


In binary: 1 00 10100

In Solaris 10 an IGMP multicast join packet has the IP options section with an hexadecimal  value of:

00 04 00 00

It should be:

94 04 00 00

In Solaris 10, IGMP V2 membership report packets have a) a RFC non-compliant IP options header and b) the IP options header is unnecessary.

When a multicast router sends an IGMP V2 query (normally having IP option 148 (router alert) set), a Solaris 10 box replies with IGMP V2 reports for all multicast groups the box want to receive.

The IGMP packets generated by Solaris 10 contain an IP option header which is in two respects wrong:

a) as there is no "meaningful" option present (only the option "end of option list", abbreviated EOL or EOOL), there should be no IP option header present in the packet

b) If the option header is still present (because of other IP options), the last four bytes should carry the value "00 01 01 01" instead of value "00 04 00 00" , as the option number 00 means "end of options list", is a one-byte value and should be padded with 01 (NOP).

The bug is fixed in Sun's IDR hotfix 123621-01 (requires kernel patch 118833-18). Afterwards, a Solaris 10 box sends IGMP messages with the correct "router alert" IP option set, thats 94 04 00 00.

References:

RFC2236: http://tools.ietf.org/html/rfc2236
RFC2113: http://tools.ietf.org/rfc/rfc2113.txt
IANA IP Options Numbers: http://www.iana.org/assignments/ip-parameters
https://forums.oracle.com/forums/thread.jspa?threadID=1948503&tstart=345

Tuesday, January 17, 2012

dladm and ndd in Solaris 10


show-dev is a dladm subcommand which lists only physical NICs along with their physical link state.

bash-3.00# dladm show-dev
e1000g0         link: up        speed: 1000  Mbps       duplex: full
e1000g1         link: up        speed: 1000  Mbps       duplex: full
e1000g2         link: up        speed: 1000  Mbps       duplex: full
e1000g3         link: up        speed: 1000  Mbps       duplex: full

ndd - get and set driver configuration parameters

To see which parameters are supported by the e1000g driver, use the following command:

# ndd /dev/e1000g2 \?

To set the full 1GB full-duplex negotiation:

ndd -set /dev/e1000g2 adv_1000fdx_cap 1


Tuesday, December 13, 2011

Comparison of Solaris OS and Linux for Application Developers

Comparison of Solaris OS and Linux for Application Developers

http://developers.sun.com/solaris/articles/solaris_linux_app.html

Many developers are writing applications to run under the Linux operating system. With the many new features of the Solaris 10 OS, and with the new emphasis Sun has placed on supporting the Solaris OS on AMD and Intel processor-based machines, developers are becoming interested in being able to develop their applications on the Solaris platform. This article examines similarities and differences in the development environments of both operating systems. Someone responsible for porting applications from Linux to the Solaris OS, or programmers with prior Linux experience that want to learn development on the Solaris OS, should benefit from this article.

In this article, the term "Solaris" refers to the Solaris 10 OS (and OpenSolaris), and "Linux" refers to Linux 2.6. Many of the details covered will also apply to earlier versions of Solaris and Linux. The Linux distribution is meant to be generic, though examples have been tested on SuSe 9.1. Also, the article concentrates on applications written using the C programming language, though C++ should behave the same. Since Java technology-based applications should not be making function calls specific to Linux or the Solaris OS, they should be portable as is.

Monday, August 15, 2011

flex1 uptime


bash-3.00# uptime
 11:17am  up 1367 day(s), 12:33,  2 users,  load average: 1.99, 2.00, 1.99

Thursday, September 2, 2010

Listing Multicast group memberships

In Windows XP:

C:\>netsh interface ip show joins


Interface Addr   Multicast Group
---------------  ---------------
172.17.17.223    224.0.0.1
172.17.17.223    239.255.255.250

In Solaris and other UNIXes:


$ netstat -gn
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      224.0.0.1
eth0            1      224.0.0.1
lo              1      ff02::1
eth0            1      ff02::1:ff09:ac30
eth0            1      ff02::1

Friday, June 19, 2009

bootadm

bootadm– manage bootability of GRUB-enabled operating system

The bootadm command manages the boot archive and, with x86 boot environments, the GRUB (GRand Unified Bootloader) menu.

The set-menu subcommand allows you to switch the auto-boot timeout and default boot entry in the GRUB menu.

The list-menu subcommand displays the location of the GRUB menu and the current GRUB menu entries. While the typical location of the GRUB menu is /boot/grub/menu.lst, depending on the install method used the active GRUB menu might be located somewhere else. Use the list-menu subcommand to locate the active GRUB menu. For example, if a system was installed using Live Upgrade, the GRUB menu might not be located in the current boot environment. See the EXAMPLES section for typical output from the list-menu option.

Note that OpenBoot PROM (OBP)-based machines, such as SPARC systems, do not use GRUB and have no boot menu manageable by bootadm.

The bootadm command has the following subcommands:

set-menu

Maintain the GRUB menu. The current GRUB menu is boot/grub/menu.lst, relative to root. Do not depend on this location, because it is subject to change. Applies to x86 platforms only.

list-menu

Lists the location of the active GRUB menu, as well as the current GRUB menu entries. This includes the autoboot-timeout, the default entry number, and the title of each entry. Applies to x86 platforms only.

key=value

Possible values are:

default=entrynum

The item number (for example, 0, 1, or 2) in the GRUB menu designating the operating system to boot when the timer expires.

timeout=seconds

The number of seconds before the operating system designated by the default item number is booted. If the value is –1, auto boot is disabled.

Examples

Example 1 Updating the Current Boot Archive

The following command lists the installed operating system instances in a GRUB menu:

# bootadm list-menu

default=0
timeout=10
(0) Solaris10
(1) Solaris10 Failsafe
(2) Linux

Example 2 Switching Default Boot Entry

The following command refers to the menu displayed in the previous example. The user selects Linux (item 2).

# bootadm set-menu default=2

Thursday, September 18, 2008

PCP - Show open ports and PIDs on Solaris

Ayer me encontré este script que me pareció muy bueno para Solaris.

El sitio del autor es: http://www.unix.ms/pcp/

#!/usr/bin/ksh
#
# PCP (PID con Port)
# v1.07 20/05/2008 sam@unix.ms
#
# If you have a Solaris 8, 9 or 10 box and you can't
# install lsof, try this. It maps PIDS to ports and vice versa.
# It also shows you which peers are connected on which port.
# Wildcards are accepted for -p and -P options.
#
# The script borrows Eric Steed's excellent "getport.sh" script.
#
if [ $# -lt 1 ]
then
echo >&2 "usage: $0 [-p PORT] [-P PID] [-a ALL ] (Wildcards OK)"
exit 1
fi
while getopts :p:P:a opt
do
case "${opt}" in
p ) port=${OPTARG};;
P ) pid=${OPTARG};;
a ) all=all;;
[?]) # unknown flag
echo >&2 "usage: $0 [-p PORT] [-P PID] [-a ALL ] (Wildcards OK) "
exit 1;;
esac
done
shift `expr $OPTIND - 1`
if [ $port ]
then
# Enter the port number, get the PID
#
port=${OPTARG}
echo "PID\tProcess Name and Port"
echo "_________________________________________________________"
for proc in `ptree -a grep -v ptree awk '{print $1};'`
do
result=`pfiles $proc 2> /dev/null grep "port: $port"`
if [ ! -z "$result" ]
then
program=`ps -fo comm -p $proc tail -1`
echo "$proc\t$program\t$port\n$result"
echo "_________________________________________________________"
fi
done
elif [ $pid ]
then
# Enter the PID, get the port
#
pid=$OPTARG
# Print out the information
echo "PID\tProcess Name and Port"
echo "_________________________________________________________"
for proc in `ptree -a grep -v ptree grep $pid awk '{print $1};'`
do
result=`pfiles $proc 2> /dev/null grep port:`
if [ ! -z "$result" ]
then
program=`ps -fo comm -p $pid tail -1`
echo "$proc\t$program\n$result"
echo "_________________________________________________________"
fi
done
elif [ $all ]
then
# Show all PIDs, Ports and Peers
#
echo "PID\tProcess Name and Port"
echo "_________________________________________________________"
for pid in `ptree -a grep -v ptree sort -n awk '{print $1};'`
do
out=`pfiles $pid 2>/dev/null grep "port:"`
if [ ! -z "$out" ]
then
name=`ps -fo comm -p $pid tail -1`
echo "$pid\t$name\n$out"
echo "_________________________________________________________"
fi
done
fi
exit 0

Tuesday, September 16, 2008

Apache in Solaris 10

Does not configure Apache 1

/etc/apache
/etc/init.d/apache


The web server is Apache2

/var/apache2
/etc/apache2


Copy /etc/httpd-std.conf to /etc/httpd.conf

If you want the server to listen in a port different than 80, you could use the following directive:

Listen 192.168.1.1:8181

Where 192.168.1.1 is the IP of the server and 8181 is the port.

Then enable the server with svcadm enable apache2

Check the logs at /var/apache2/logs/error_log and /var/apache2/logs/acess_log

Friday, September 5, 2008

Algunos comandos para lidiar con procesos en Solaris

ps - informa sobre el estado de los procesos

# ps -ef grep java

-e Devuelve información sobre cada proceso en ejecución.
-f Genera un listado con todas las columnas.

La tubería con grep filtra por los que contienen java.

svcs - informa sobre el estado de los servicios

# scvs -p less

-p Lista los procesos asociados con cada instancia de servicio.

La tubería con less para poder buscar y ver las líneas múltiples.

pargs - imprime los argumentos de un proceso, variables de entorno.

# pargs

fuser - muestra los PID de los procesos que están usando los archivos que se especifican como argumento.

# fuser ...

pfiles - muestra los archivos abiertos por un determinado proceso.

# pfiles ...

# prstat - equivalente a top (más o menos).

# prstat

Friday, July 18, 2008

Cambiar el hostname en Solaris 10

Cambiar el hostname en los siguientes archivos:

/etc/nodename
/etc/hostname.*interface
/etc/inet/hosts
/etc/inet/ipnodes

Renombrar el directorio debajo de /var/crash.

# cd /var/crash
# mv oldname newname

Ejecutar el comando dumpadm -s /var/crash/

Ejecutar el comando hostname

Reiniciar el servidor.

Configurar la red en Solaris 10

Configurar la red en Solaris 10:

1. Añadir el nombre del host a /etc/nodename.
2. Añadir el nombre y la IP a /etc/hosts.
3. Añadir el hostname que se añadió a /etc/hosts al archivo /etc/hostname.interface. Donde interface es el nombre de la interfaz de red.

Por ejemplo, el contenido de mi /etc/hostname.bge0 es solaris-devx.

4. Añadir la información correspondiente a /etc/resolv.conf.
5. Añadir la IP del gateway (default router) a /etc/defaultrouter.
6. Reiniciar el servicio mediante svcadm restart svc:/network/physical:default.

Thursday, July 17, 2008

Activate NTP Service in Solaris

In our particular case we just need that the machine has its time synchronized:

At /etc/inet directory we have two files:

ntp.client
ntp.server


Copy the /etc/inet/ntp.client file into /etc/inet/ntp.conf.

The content of that file is as follows:

# ident "@(#)ntp.client 1.3 00/07/17 SMI"
#
# /etc/inet/ntp.client
#
# An example file that could be copied over to /etc/inet/ntp.conf; it
# provides a configuration for a host that passively waits for a server
# to provide NTP packets on the ntp multicast net.
#

multicastclient 224.0.1.1


This should work but the routers generally drops this kind of multicast messages, so we must do some changes in the file.

driftfile /var/ntp/ntp.drift
restrict 127.0.0.1
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
statsdir /var/ntp/ntpstats/


Make sure the /var/ntp/ntp.drift file exists (touch /var/ntp/ntp.drift).

Make sure the directory /var/ntp/ntpstats/ exists.

Start the service with svcadm enable ntp.

You could check /var/adm/messages and /var/svc/log/network-ntp:default.log logs.

You could query the service with ntpq –p.

remote refid st t when poll reach delay offset disp
==============================================================================
smtp.housefront enigma.wiredgoa 3 u 865 1024 377 105.15 10.086 0.43
*time.nist.gov .ACTS. 1 u 75 1024 377 110.12 0.315 1.59
+dnscache1.izoom ntp2.twc.weathe 2 u 160 1024 377 68.21 -32.835 11.49


The ntpdate host command could be used for a one time updating of the system time.