How to Add and Delete Persistant Routes in AIX

Chatter-phone-300x234Wow, AIX does not like to make anything easy. Nor do they like to make things intuitive. Need to remove a route from AIX, well get ready to have one command to temporariliy remove a route and another command to remove the route for good. Same goes with adding a route. "Quit your bitching, and use Smitty", you say? Well smitty does not make anything any easier, especially since the UI likes to show you fields that you does not necessarily need you to use. Oh, plus they let you type in them. Asking me for a netmask when adding a static route does not seem like a crazy request to me? But jokes on you, you were not supposed to type anything there.

Anyway, I was tasked with cleaning up a few bad routes that were added to a handful of servers. Note that I was not interested in adding the routes temporarily before I added them as persistent routes. These were simple one liners that I felt very comfortable adding to the ODM right out the gate.

So first we need to check the ODM for the routes that we need to remove. In this example we want to delete the route fro 10.11.1.56, so lets find just that route. Note all of these are host routes.

# lsattr -El inet0 | grep 10.11.1.56
route host,-hopcount,0,,-if,en1,,,,-static,10.11.1.56,10.22.13.1 Route True

 

Now lets delete the route above

# chdev -l inet0 -a delroute=10.11.1.56,10.22.13.1

 

We have a second route to delete so lets kill that one too

# chdev -l inet0 -a delroute=10.11.1.57,10.22.13.1

 

Now lets add the correct routes – the format is as shown below

chdev -l inet0 -a route=host,-hopcount,1,-netmask,netmask,network,gateway

 

Now on a few of the servers I was working on I had to remove network routes as well as host routes. You need to know that the syntax is anoyingly different adding network routes. In the example below I first need to remove the network route.

chdev -l inet0 -a delroute="net,-hopcount,0,,,,,,-static,10.11.1.56,10.11.1.254"

 

Now lets add our new and correct route

chdev -l inet0 -a route="host,-hopcount,0,,,,,,-static,10.11.1.56,172.30.150.190"

Related articles

Basic AIX Performance Troubleshooting Commands
How to Add Multiple Routes in Linux Using ip Command Examples
PowerPath, AIX 5.3, and LTG: Solutions

How to Manage Password Aging in Solaris, AIX, and Linux

LogoIts possible that sometime in your short, meaningless life, you may need to create an account that has a password that is set to never expire. This is somethimes the case with headless accounts and specialty accounts such as the type you might have to setup for monitoring or security scanning. You might also find yourself setting up shared headless accounts that have locked passwords in order to block direct logins. This second scenario can be especially troublesome when this is some sort of application or database user with cron jobs, as even an account without a password and expire and lock. If this occurs all of a users cron jobs will fail. All because the account expired.

So today we are going to configure a user password not to expire.

Lets start with Solaris. First lets unlock the account just in case.

passwd -d username

Now you can turn off password aging for a user with the command below.

passwd -x -1 username

You can then verify your config with the following.

passwd -s dmadmin

The output of the command above should look similar to what I have below. In this example our user id is myuser.

#passwd -s myuser
myuser  PS

Compare what you see above to the output below for our example myuser1, which includes the date that the password was last changed, the minimum number of days between password changes, the maximum number of days required between password changes, and the number of days of warning a user is given before a password expires. Standard system password aging and expiration still applies.

#passwd -s myuser1
myuser1  PS    09/30/13     7    28     7

Now lets move on to Linux. First lets ulock. Then we will configure the password to not expire. Then we can verify our work with the chage -l command.

passwd -u username
chage -m 0 -M 99999 -I -1 -E -1 username
change -l username

So now lets take a visit to AIX land. Remember to not stay long. Again, its always best to make sure that the current password is not locked. Then we configure the password to not expire. Finally we step back and admire our work.

chuser account_locked=false username
chuser maxage=0 username
lsuser -f USERNAME | fgrep expires

Related articles

SuperUser in Linux
How to Unlock an account in Linux
How to Reset a Password on Unix
Much Todo About Linux/RHEL Passwords
Enycrypting Passwords Via SSL for Redhat Kickstart Configuration Files
How to disable an user account in Linux

AIX – Check Availiable Memory, Free Memory, and Used Memory in Gigabytes

Dunce-cap-2Dunce Cap… seriously is that a real thing. Have you or someone you know ever have had to wear one? Or is this just something made up for tv and movies… anyway I digress.

Everything is harder in AIX – like looking at memory statstics and viewing them in a normal human readable format (like gigabytes). Because apparently IBM knows best and like to show me free memory in 4k bytes (and filesystem sizes in 512-blocks).

Anyway while I was working on a production server with high memory usage found this nice little blog artice which contains a simple script for viewing availiable memory, free memory, and used memory in gigabtyes.

Link below:

http://karellen.blogspot.com/2012/01/available-used-and-free-memory-in-aix.html

And for my own selfish purposes I copied the script below — just in case the link above dies at somepoint.

#!/bin/ksh
memory=`prtconf -m | awk 'BEGIN {FS=" "} {print
$3/1024}'`
usedmem=`svmon -G | grep memory | awk 'BEGIN {FS=" "} {print
$3/256/1024}'`
freemem=`echo $memory-$usedmem | bc -l`

#
Conclusion
echo "Avai Mem: $memory GB"
echo "Free Mem: $freemem
GB"
echo "Used Mem: $usedmem GB"

 

Anyway.. AIX sucks and I hate it.

 

Related articles

New IBM servers meet Energy Star 2.0 guidelines
Sudosh Make Me a Sandwich: Install and Configure Sudosh in Solaris 9/10
IBM Power Systems with POWER7 and AIX & Linux Technical Sales Skills – v2 (000-225)

Basic AIX Performance Troubleshooting Commands

600px-Orange_x.svgWow, today I logged into my first AIX Server in about 4.5 years. It was a horrible experience. I’ve been working with Redhat/CentOS pretty much exculsively for so long, I was mostly helpless to do anything of importance on the CLI other than create a few users and move some files around.  None of the common commands that I am so used to using even exist in AIX.

Figured I would do a bit of homework and figure out how to do some basic troubleshooting before I was in a server down situation with no idea how to troubleshoot.

Checking Free Memory

To check free memory on a box use the svmon command.

svmon -G

Overall System Status

For this you will probably want to use topas, which is pretty simiar to top. Topas gives you a quick and dirty overview of what is going on on a system. Here you can find CPU usage, top processes, disk utililization. Check out the fancy screen shot below.

Top-ass1

List Volume Groups

Wow, Linux has really confused me on this one. Anyway, use lsvg

# lsvg -o
rootvg
crsrdb_bin
crsprdb_data
crsprdb_index
crsprdb_arch
crsprdb_rman

List Info About a Volume Group.

# lsvg rootvg

Display Names of all Logical Volumes in a Volume Group.

# lsvg -l rootvg

Display Physical Memory

# lsattr -El sys0 -a realmem

Finding Disk I/O Issues

Sar appears to be a fine option here. Especially since I am looking for percent busy. Iostat also exists on AIX, btw.

# sar -d 1 2

Show Network Throughput

The more I poke around the internet trying to figure out how to actually use AIX the more I keep running into topas. Anyway this one is a good one

#topas -E

I plan to have more of these one liners documented here in the future, but for now this is going to have to do.

Favorite Commands on Least Favorite Os

Aixlogo3dHey, take a look at the ugly AIX image that I just stole. Since I ran into the image thought that I would take a bit of time to get my AIX notes together and put my new image to good use.

Here are some of my favorite commands and other info.

prtconf

Shows system config

prtconf
System Model: IBM,9113-550
Machine Serial Number: blahblah
Processor Type: PowerPC_POWER5
Number Of Processors: 4
Processor Clock Speed: 1656 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
LPAR Info: 1 hostname
Memory Size: 15808 MB
Good Memory Size: 15808 MB
Platform Firmware level: SF230_143
Firmware Version: IBM,SF230_143
Console Login: enable
Auto Restart: true
Full Core: false

ipcs -mob

Shows shared memory config

IPC status from /dev/mem as of Fri Dec 28 10:52:23 EST 2007
T        ID     KEY        MODE       OWNER    GROUP NATTCH     SEGSZ
Shared Memory:
m   4194304 0xffffffff --rw-rw----     root   system      1      4096
m   6291457 0xffffffff --rw-rw----     root   system      1      4096
m   6291458 0xffffffff --rw-rw----     root   system      1      4096
m   9437187 0xdd9369d4 --rw-r-----  dbpcomf      dba     47 1090523136
m  6291460 0xf6e89580 --rw-r-----   dbpisv      dba    104 8640286720v

Memory and Paging

lsattr  -E  -l  sys0  |  grep  realmem

To determine how much physical memory resides on the hardware, use the
AIX following command to determine the amount of physical memory:

lsps –a
To determine how much paging space is
installed; use the command above.
To increase Paging Space; use the following AIX path in SMIT (System
Management Interface Tool)
Physical and Logical Storage -> Paging Space -> Change/Show
Characteristics of Paging Space
Do not add a new paging logical volume. Add specified PP’s (as needed)
to the existing paging logical volume. Select logical volume and press
return. Type 1 for the Number of additional logical partitions.

Networking

netstat -v | grep Speed

Show NIC speed

Collect System Dump on an AIX System

  • Verify dump size by typing sysdumpdev –L at the command line.
  • Find a repository large enough for the dump.
  • Type snap –r at the command line to remove any previous dumps.
  • Type snap  -gfkDGL at the command line to create the new dump.
  • Type snap –c to compress into the pax file.

Intro to SMIT/SMITTY

  • System Management Interface Tool
  • smit will run GUI version if $DISPLAY is set, text version otherwise
  • Use smitty to force use of text version
  • Important keystrokes (If you don’t have function keys, use ESC+n for Fn):

Function Keys

F3 > Cancel (go back to previous screen)

F4 > List options for a given field

F6 > Show command that SMIT is executing

F7 > Tag item from list (e.g., when selecting software to install)

F10 > Exit SMIT

Useful files:

smit.log >Logs what you’ve done (menu selections, command output, etc)

smit.script > listing of all commands SMIT has executed for you (same as shown by F6)

Command prefix naming conventions:

o ch (change)

o ls (list)

o mk or cr (make or create)

o rm (remove)