Showing posts with label AIX. Show all posts
Showing posts with label AIX. Show all posts

Subnetmask in HEX



Overview of common subnets and masks

Mask Hosts  Usable Netmask          Hex Mask
/30  4      2      255.255.255.252  fffffffc  this is 1/64 of a Class C net
/29  8      6      255.255.255.248  fffffff8  this is 1/32 of a Class C net
/28  16     14     255.255.255.240  fffffff0  this is 1/16 of a Class C net
/27  32     30     255.255.255.224  ffffffe0  this is 1/8 of a Class C net
/26  64     62     255.255.255.192  ffffffc0  this is 1/4 of a Class C net
/24  256    254    255.255.255.0    ffffff00  this is a Class C net
/23  512    510    255.255.254.0    fffffe00  these are 2 Class C net
/22  1024   1022   255.255.252.0    fffffc00  these are 4 Class C net
/21  2048   2046   255.255.248.0    fffff800  these are 8 Class C net
/20  4096   4094   255.255.240.0    fffff000  these are 16 Class C net
/19  8192   8190   255.255.224.0    ffffe000  these are 32 Class C net
/18  16384  16382  255.255.192.0    ffffc000  these are 64 Class C net
/17  32768  32766  255.255.128.0    ffff8000  these are 128 Class C net
/16  65536  65534  255.255.0.0      ffff0000  these are 256 Class C net = Class B net

md5sum csum fciv

LINUX: md5sum fileName

In Linux, the md5sum utility can be used:
aemtux1:/ % md5sum binary.file
0c4627e70d168f7f78257e6dd01fdb60 binary.file

This utility is provided by the following rpm package (the package name is the key element, because the version number depends on your Linux installation)
% rpm -qf /usr/bin/md5sum
coreutils-5.2.1-23.13


AIX: csum -h MD5 fileName

In AIX, there is no native "md5sum" but the MD5 hash function is provided by csum (provided and supported in AIX 5.3 and later):
csum -h MD5

aemaix1:/ % csum -h MD5 binary.file
0c4627e70d168f7f78257e6dd01fdb60 binary.file

Note: You may need to apply fixes to AIX for csum to handle files larger than 2 GB. For example:
IV03170: csum to support files more than 2GB APPLIES TO AIX 6100-07


Solaris: digest -a md5 -v fileName

In Solaris there is no native "md5sum", but "digest" can be used:

aemsun4:/ % digest -a md5 -v binary.file
md5 (binary.file) = 0c4627e70d168f7f78257e6dd01fdb60


HP-UX: md5sum fileName

HP-UX MD5 Secure Checksum 
Product details & specifications 
Overview 
The HP-UX MD5 Secure Checksum A.01.01.02 bundle (bundle name MD5Checksum) provides a file integrity utility and API based on the standard Message Digest 5 (MD5) algorithm. The MD5Checksum bundle consists of the following two components that can be installed independently: 
- HP-UX MD5sum (md5sum checksum command) 
- HP-UX LibCryptX (libcryptx libraries providing MD5 APIs) 
The md5sum command is based on the MD5 algorithm and generates 128-bit message digests. The md5sum command enables you to verify the integrity of files downloaded over a network connection. You can also use the md5sum command to compare files and verify the integrity of files. 


HP NonStop Server (NSS): md5sum fileName

In HP NonStop Server, the md5sum command is available in OSS.


Windows: md5sum fileName 
fciv -md5 fileName

Microsoft does not offer a supported tool for generating the MD5 hash.

There are 2 choices:

a) The md5sum utility can be found within the following package of useful utilities that were developed to mimic their corresponding peer in Unix. The UnxUtils.zip and UnxUpdates.zip packages contain such utilities. For details on the utilities that are provided in these packages and download links see:

GNU utilities for Win32

Example run:
H:\> md5sum binary.file
0c4627e70d168f7f78257e6dd01fdb60 *binary.file

b) Microsoft offers a NON-supported utility called "fciv":

Availability and description of the File Checksum Integrity Verifier utility
The File Checksum Integrity Verifier (FCIV) is a command-prompt utility that computes and verifies cryptographic hash values of files. FCIV can compute MD5 or SHA-1 cryptographic hash values. These values can be displayed on the screen or saved in an XML file database for later use and verification.

Example run:
H:\62570,379,000\2011-01-21> fciv -md5 binary.file
//
// File Checksum Integrity Verifier version 2.05.
//
0c4627e70d168f7f78257e6dd01fdb60 binary.file

Caveat:
During the writing of this technote, we found that the fciv utility worked fine in some Windows systems but failed in other systems with the following error. We could not find a way to overcome it. Thus, use this unsupported tool at your own risk.
Error during CryptAcquireContext.
Error msg : An internal error occurred.

How to Enable a DNS Client on Solaris 11.2


  1. Become an administrator.
    For more information about obtaining the appropriate rights to perform specific tasks, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.2 .
  2. Configure the DNS domain.
    First, list the domains to search and the IP addresses for the DNS name servers. Then, update the SMF repository.
    # svccfg -s dns/client
    svc:/network/dns/client> setprop config/search = \
    astring: ("example.com" "sales.example.com")
    svc:/network/dns/client> setprop config/nameserver = \
    net_address: (192.168.1.10 192.168.1.11)
    svc:/network/dns/client> select network/dns/client:default
    svc:/network/dns/client:default> refresh
    svc:/network/dns/client:default> quit
  3. Update name service switch information to use DNS.
    The first command updates the DNS configuration information in the SMF repository.
    # svccfg -s system/name-service/switch
    svc:/system/name-service/switch> setprop config/host = astring: "files dns"
    svc:/system/name-service/switch> select system/name-service/switch:default
    svc:/system/name-service/switch:default> refresh
    svc:/system/name-service/switch:default> quit
  4. Start the services needed to run the DNS client.
    # svcadm enable network/dns/client
    # svcadm enable system/name-service/switch

How to show my NIC MTU value, and how do I change it to use Jumbo Frame?

How to show my NIC MTU value, and how do I change it to use Jumbo Frame?

list current value
$ lsattr -E -l en0 -a mtu                     

With the chdev command, the interface cannot be changed while it is in use. Change is effective across reboots.
$ chdev -l en0 -a mtu=9000                          

An alternate method is as follows: ifconfig interface_name mtu NewValueThis changes the MTU size on a running system, but will not preserve the value across a system reboot.
$ ifconfig en0 mtu 9000

Use SMIT to change permanent, and does not requires restart.
$ smit chif

Note:
Some application that uses persistent connection requires a restart in order to work properly after the change of MTU.


For the Gigabit Ethernet adapter, use the device attribute jumbo_frames=yes to enable jumbo frames (just setting MTU to 9000 on the interface is not enough).

AIX wtmp, utmp, failedlogin file

utmp, wtmp, failedlogin File

/etc/utmp                                Contains a record of users logged into the system.

/var/adm/wtmp                      Contains connect accounting information.

/etc/security/failedlogin         Contains a record of invalid login attempts.

fwtmp

To convert a binary record in wtmp format to an ASCII record called dummy.file
$ /usr/sbin/acct/fwtmp < /var/adm/wtmp > dummy.file

To convert an ASCII dummy.file to a binary file in wtmp format called /var/adm/wtmp

$ /usr/sbin/acct/fwtmp -ic < dummy.file  > /var/adm/wtmp

AIX network route


show routing table
$ netstat -rn

add static route
$ route add -net 172.20.9.0 -netmask 255.255.255.0 172.20.8.67
$ route add -net 10.1.38.0 -netmask 255.255.255.0 172.22.1.128 -if en2

delete static route
$ route delete -net 172.20.9.0

Make persistent route

$ smitty tcpip
$ smitty route

AIX compression with TAR, COMPRESS, GZIP, ZCAT

tar

tar in AIX by default does not support compression. You will need to incorporate with gzip command to have it tar and compress at the same time.
$ tar cvf test.tar test                             # pure tar only
$ tar cvf - test | gzip > test.tar.gz        # tar and compress together

gzip / gunzip

$ gunzip -c test.tar.gz | tar tvf -           # list compress files
$ gunzip -c test.tar.gz | tar xvf -           # decompress files

compress / uncompress

http://poweritpro.com/aix/use-aix-tar-command-archive-large-files
native AIX compression tool
$ compress test.tar                                 # compress file with .Z extension
$ uncompress test.tar.Z                          # decompress .Z file

zcat


$ zcat test.tar.Z | tar tvf -                        # list compress files

How to show my current memory usage in AIX?

How to show my current memory usage?


Because of AIX memory handling, it will used up all the available memory, allocating for program usage and file caching. Hence, you can't use the “inuse” figure as the program used memory.
A = total memory in block
B = total allocated virtual memory in block
C = page size / block size
Calculation:
Total memory = (4014080 * 4KB) / 1024KB = 15680.00MB
Total used memory = (1645299 * 4KB) / 1024KB = 6426.94MB
Total used memory in % = (1645299 / 4014080 ) * 100 = 40%

Total free memory = 15680.00MB – 6426.94MB = 9253.06MB

Showing my time zone info with zdump

How do I show my time zone info? does it has any Daylight Saving Time? What is the detailed info?

You can find the binary zone file at /usr/share/lib/zoneinfo, browse around, and you can use the directory and file name as reference with command below.

From here, if the isdst=0 means Daylight Saving Time is OFF, and if isdst=1 means Daylight Saving Time is ON.

$ zdump -v Australia/West
Australia/West  Mon Jan 27 11:09:51 2014 CUT
Australia/West  Fri Dec 13 20:45:52 1901 GMT = Sat Dec 14 04:15:52 1901 CUT isdst=0 gmtoff = 27000
Australia/West  Sat Dec 14 20:45:52 1901 GMT = Sun Dec 15 04:15:52 1901 CUT isdst=0 gmtoff = 27000
Australia/West  Sat Oct 26 17:59:59 1974 GMT = Sun Oct 27 01:29:59 1974 CUT isdst=0 gmtoff = 27000
Australia/West  Sat Oct 26 18:00:00 1974 GMT = Sun Oct 27 01:30:00 1974 CUT isdst=0 gmtoff = 27000
Australia/West  Sat Mar  1 17:59:59 1975 GMT = Sun Mar  2 01:29:59 1975 CUT isdst=0 gmtoff = 27000
Australia/West  Sat Mar  1 18:00:00 1975 GMT = Sun Mar  2 01:30:00 1975 CUT isdst=0 gmtoff = 27000
Australia/West  Sat Oct 29 17:59:59 1983 GMT = Sun Oct 30 01:29:59 1983 CUT isdst=0 gmtoff = 27000
Australia/West  Sat Oct 29 18:00:00 1983 GMT = Sun Oct 30 01:30:00 1983 CUT isdst=0 gmtoff = 27000
Australia/West  Sat Mar  3 17:59:59 1984 GMT = Sun Mar  4 01:29:59 1984 CUT isdst=0 gmtoff = 27000
….

Am I using Daylight Saving Time (DST)?
We could say if the time zone variable ends in DT (or in our case DFT), DST is enabled.


$ grep -i /etc/environment                 # or
$ echo $TZ
TZ=NFT-1DFT-2,M3.5.0,M10.5.0        # DST is used
TZ=CUT                                                   # DST is not used

What are those files under /var/preserver/Exaa*** ?

These are left over files after a vi session has exited unexpectedly.
$ $ ls -ltr /var/preserve
total 156032
-rw------- 1 slist staff 163840 Dec 21 10:45 Exaaa29510
-rw------- 1 slist staff 163840 Dec 21 10:45 Exaaa24238
-rw------- 1 slist staff 196608 Jan 15 18:39 Exaaa24142
-rw------- 1 slist staff 196608 Jan 15 18:39 Exaaa24140
-rw------- 1 slist staff 66584576 Mar 21 14:57 Exaaa66134
-rw------- 1 slist staff 163840 May 13 21:26 Exaaa96366

You may recover the file via “-r” option from vi editor. 

You can get the file name by grepping the first line.
For example, it has the checkapp.sh from the grepping.

When we use the "-r" option, it will search for any file named checkapp.sh from this /var/preserve directory and recover from it, and when you save it, it will be saved from the current directory or you may specify where to save it.

Once it was saved, the temp file will be removed from /var/preserve directory.
$ vi -r checkapp.sh



AIX CPU Info

There are number of commands to show what are the current number of processors and their information.

1. show processor multithreading capacibility, number of processor, and how many "core" they have. run smtctl below without any options with ROOT user.

$ smtctl
This system is SMT capable.

SMT is currently enabled.

SMT boot mode is not set.
SMT threads are bound to the same physical processor.

proc0 has 2 SMT threads.
Bind processor 0 is bound with proc0
Bind processor 1 is bound with proc0

proc2 has 2 SMT threads.
Bind processor 2 is bound with proc2
Bind processor 3 is bound with proc2

2. show processor model and their clockspeed

$ lsconf|grep Processor
Processor Type: PowerPC_POWER6
Processor Implementation Mode: POWER 6
Processor Version: PV_6
Number Of Processors: 2
Processor Clock Speed: 3826 MHz
  Model Implementation: Multiple Processor, PCI bus
 proc0                                        Processor
 proc2                                        Processor

3. show processor clock speed

$ pmcycles -m
CPU 0 runs at 4204 MHz
CPU 1 runs at 4204 MHz

4. show processor related to your lpar
$ lparstat -i
Node Name                                  : webserver
Partition Name                             : 06-759DA
Partition Number                           : 1
Type                                       : Dedicated-SMT
Mode                                       : Capped
Entitled Capacity                          : 2.00
Partition Group-ID                         : 32769
Shared Pool ID                             : -
Online Virtual CPUs                        : 2
Maximum Virtual CPUs                       : 2
Minimum Virtual CPUs                       : 1
Online Memory                              : 15680 MB
Maximum Memory                             : 16384 MB
Minimum Memory                             : 256 MB
Variable Capacity Weight                   : -
Minimum Capacity                           : 1.00
Maximum Capacity                           : 2.00
Capacity Increment                         : 1.00
Maximum Physical CPUs in system            : 2
Active Physical CPUs in system             : 2
Active CPUs in Pool                        : -
Shared Physical CPUs in system             : 0
Maximum Capacity of Pool                   : 0
Entitled Capacity of Pool                  : 0
Unallocated Capacity                       : -
Physical CPU Percentage                    : 100.00%
Unallocated Weight                         : -