Thursday, February 2, 2012

Create VLAN for vlan tag

$mkvdev -vlan entx tagid xx
entx is your sea adapter
and tagid xx is your vlan id that you want

Create SEA Failover in VIOS

We need 2 virtual adapters, one for sea and another for ctl_chan
after created two adapters, from the scratch we will have ent2,ent3 as our virtual adapter
now we start with create sea adapter

$ mkvdev -sea ent0 -vadapter ent2 -default ent2 -defaultid 1 -attr ha_mode=auto ctl_chan=ent3
**defaultid is the vlan number of your vios (depends on you)

Now we will have ent4 which will be our sea adapter.
Check it with

$lsdev -dev ent4 -attr

Now we need an ip address for sea adapter.
Start with this

$cfgassist
Then choose for our sea adapter which is ent4 for now.
Provides any information you have, then you done.
Please do the same with VIOS_2, so you can have sea failover operates correctly.

NIM Master Installation

First install the nim's fileset, for master we need nim master, nim client , and nim spot. Let's install aix fileset with this command

#smitty installp

After that we have to configure the nim master ifself with this command.

#smitty nim

choosing the Configure a Basic NIM environment (EZS) and provides any information you need. (all the required fields)

Let's check the nim with this command, which will show you the nim environments you have
#lsnim

If you need to know their object, you can use
#lsnim -l boot
#lsnim -l nim_script

for more info you can check it at /etc/niminfo

Don't forget to check the essential daemon
#lssrc -ls inetd |grep tftpd
#lssrc -ls inetd |grep bootpd
Make sure it has activated already

now check for the lpp_source we have created
#lsnim -l lpp_source1 (this name depends on you when first configure the nim master.)

make sure the simages attribute for the NIM lpp_source is set to yes.

and check the SPOT with
#nim -o lppchk -a show_progress=yes spot1 (this name depends on you when first configure the nim master)

Ok, all things are set for MASTER, we will continue with NIM Client.
I normally use smitty to configure most of the things, so I will start with this command. (we are now going to configure the nim master to know his client)
**But first of all, we need to make sure that both nim master and client are negotiable by their hostname!

If all thing are set, let's get back to smitty.
#smit nim_mkmac

You need a Hostname of nim client to type with the first page.
Then we change the cable type to tp, and that's all

Let's declare client for master
Go to client and type
#smitty nim
choose the first one and provides any information of the client you have
then check whether if the client is know itself by going to
#smitty nim_bosinst
if anything has set up, there will be a client information popup.

Let's define mksysb resource to make an image backup.
#smitty nim_mkres

Resource Type: mksysb
Server of Resource: master
Location of Resource: /export/images/mksysb (don't forget to allocate the directory for mksysb)

CREATE system backup image: yes
NIM CLIENT to backup: maz-aix (your nim client's name)

Now wait for the copying, then check whether if you got mksysb in hand.
#lsnim -l mksysb_aix6 (this is the mksysb's name)

If there was an error, talk about some limitation of file size, please reconfig the ulimit of the root account by this command.
#smitty user

change kernel parameter

#no -o tcp_ephemeral_low=9000 -o udp_ephemeral_low=9000 -o tcp_ephemeral_high=65500 -o udp_ephemeral_high=65500

To create image.data from mksysb in order to edit mirror

#restore -xvqf /export/images/Node1.mksysb ./image.data

NPIV

To show fcs adapter with vhost in vios
$lsmap -all -npiv

To map vhost with fcs
$vfcmap -vadapter vfchost14 -fcp fcs0

Mirror rootvg

Make sure you have an empty disk, in this example its hdisk1
Add the disk to the vg via "extendvg rootvg hdisk1
#extendvg rootvg hdisk1

Mirror the vg via: "mirrorvg rootvg"
#mirrorvg rootvg

Adapt the bootlist to add the current disk, the system will then fail to hdisk1 is hdisk0 fails during startup
#bootlist -o -m normal

this will list currently 1 disk, in this exmaple hdisk0
#bootlist -m normal hdisk0 hdisk1

Run a bosboot on both new disks, this will install all software needed for boot on the disk
#bosboot -ad hdisk0
#bosboot -ad hdisk1

How to mount iso on AIX

First create cdlv with mklv or smit, the size must be large enough to hold iso's data file.
Then use dd to write the data from iso to LV
#dd if=/path/to/file.iso of=/dev/cdlv (my LV's name is cdlv)
Then mount the LV
#mount -v cdrfs -o ro /dev/cdlv/ /mnt/iso

To remove the mount point
#umount /mnt/iso

Virtual Media Library

Check whether if media library is existed.
$lsrep

If not, create it using (Or using HMC to handle this)
$mkrep -sp rootvg -size 20G

Then FTP .iso to VIOS, import .iso into media library with (Or using HMC to handle this)
$mkvopt -name xxx.iso -file /home/padmin/xxx.iso

Then use this command to show all mapped virtual adapters
$lsmap -all

Next, create virtual optical using
$mkvdev -fbo -vadapter vhostx

you will get vtoptx interface.

Assign the image to the optical device
$loadopt -vtd vtopt0 -disk xxx.iso(or the name you choose in the first)

Check with
$lsmap -vadapter vhostx

To switch or unload CD,
$unloadopt -vtd vtopt0

Make vscsi to client partition

1. Create Virtual Adapter as SCSI adapter to both VIOS (as server adapter) and LPAR (as client adapter)
make sure their ID match each other (Server and Client adapter ID)

2. Now go to VIOS and look for vhost id that indicate our lpar. You can grep from PhyLoc
( the last C character with number defines the server adapter id )
#lsmap -all |grep -p C26 (example, mine is 26)

SVSA Physloc Client Partition ID
--------------- ------------------------------ ------------------
vhost11 U8204.E8A.069D955-V1-C26 0x0000000b

3. Before the creation of vscsi, you need to know which hdisk that represent to VIOS you want to use.
Example, mine will be using hdisk25
#mkvdev -vdev hdisk25 -vadapter vhost11

4. Now check if you have a virtual scsi attaches to your virtual adapter.
#lsmap -vadapter vhost11

SVSA Physloc Client Partition ID
--------------- --------------------------- ------------------
vhost11 U8204.E8A.069D955-V1-C26 0x0000000b

VTD vtscsi24
Status Available
LUN 0x8300000000000000
Backing device hdisk25
Physloc U78A0.001.DNWHM0W-P1-C2-T1-W50060E80104AF4A0-L19000000000000
Mirrored false

SSH pair key with RSA.

1. From local machine, create the private and public keys

#ssh-keygen -t rsa

*Any prompt just passed as default.

2. Copy the public key to the remote machine (need to enter the password for the first time)

#cat ~/.ssh/id_rsa.pub | ssh user@server "cat - >> ~/.ssh/authorized_keys"

That's all

Troubleshooting
If you get a connection refused message
You probably have a server problem, check sshd is running "netstat -nlp" and there is no firewall rule in place blocking port 22 "iptables -nL".

You still get prompted for a password
Try to ssh to the server with verbose output:

#ssh -vv user@server

If you get a line like this, not containing "publickey":
debug1: Authentications that can continue: password,keyboard-interactive
Then check sshd_config on the server and remove the line "PubkeyAuthentication no" if it exists then restart sshd.

If you don't get a line like:
debug1: try pubkey: /home/rossy/.ssh/id_dsa
Then check "ssh_config" on the client and if it exists, remove "PubkeyAuthentication no" if it exists.
If you still don't see that line then make sure that "~/.ssh/id_dsa" exists on the client.

If you get a line like:
debug2: we sent a publickey packet, wait for reply
Check that "~/.ssh/authorized_keys" exists on the server and contains a line the same as "~/.ssh/id_dsa.pub" on the client.