SSH, FTP 접속 딜레이가 생길때...

Posted 2009. 5. 22. 16:36

처음 설치후 한동안 SSH, FTP 등 접속을 할때 빠르게 로그인창이 떳었는데 요즘은 계속 딜레이가 5초 이상이 발생하여
이에 대한 대처 방법을 적도록 하겠습니다.


1. SSH

SSH의 경우 대개 config 를 수정하면 해결이 되더군요
일단 sshd_config 를 수정해야하니 find 명령어로 찾도록 하겠습니다.

# find / -name sshd_config
/usr/local/etc/sshd_config

위의 디렉토리에 있네요.
그럼 수정을..
# vi /usr/local/etc/sshd_config

--------------------
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
-----------------------------

맨밑으로 가시고 #UseDNS yes 부분이 있습니다.  이부분을 주석 제거하고 yes를 no로(DNS Server 일 경우 yes 그대로) 하시면 됩니다.

UseDNS no

이렇게 수정하고 저장한다음 SSHD를 재시작 해주시면 됩니다.


2. FTP

FTP의 경우는 대부분(?) resolv.conf 부분에서 딜레이가 발생합니다.

# vi /etc/resolv.conf

제일 첫번째줄에 nameserver 168.126.63.1 (KT DNS) 로 해 보세요.
순서를 바꾸는거죠. ^^;
그리고 /etc/hosts 여기에 접속할 ip 를 추가하면 딜레이 되는 부분이 어느정도 해결이 될겁니다.


출처 : http://cafe.naver.com/solatech/174



** 하우투 솔라리스에서 퍼온 글 입니다. 
 
 
 
솔라리스의 1 sector 는 1 block 이고 512 bytes 입니다.  
 
가끔 fsck 를 시도시 다음과 같이 cannot read 라는 메세지와 함께 fsck 상태가  
멈추어 버리는 경우가 있습니다.  
이경우는 전혀 mount를 할수 없습니다.  
여러번 fsck를 시도해 보아도 같은 현상이 나오곤 합니다.  
 
다음은 fsck 시도시 위와 같은 현상이 나오는 예제 입니다.  
 
# fsck /dev/rdsk/c0t1d0s0  
** /dev/rdsk/c0t1d0s0  
** Last Mounted on /  
** Phase 1 - Check Blocks and Size  
 
CANNOT READ: BLK 2036256  
CONTINUE? y  
 
** Phase 2 - Check Pathnames  
** Phase 3 - Check Connectivity  
** Phase 4 - Check Reference Counts  
** Phase 5 - Check Cyl groups  
 
FREE BLK COUNT(S) WRONG IN SUPERBLK  
SALVAGE? y  
 
THE FOLLOWING SECTORS COULD NOT BE READ: 2036256 2036257 2036258 2036259  
 
fsck is incapable of fixing sector errors.  
 
fsck is incapable of of fixing sector erros 라는 메시지를 뿌리고 작업이 중단 되거나  
/var/adm/messages 파일에 다음과 같이 뿌려주는 경우도 있습니다.  
 
 
Error for command 'read(10)' Error Level: Retryable  
Requested Block 2422272, Error Block: 2422283  
Sense Key: Media Error  
Vendor 'SEAGATE':  
ASC = 0x11 (unrecovered read error), ASCQ = 0x0, FRU = 0x0  
 
 
위와 같은 현상이 나타나는 이유는 sector의 formating 정보의 손실이나 전기적  
현상에 의한 sector의 문제인 경우가 많습니다.  
 
 
대부분의 경우 이런 현상이 나오게 되면 newfs 하거나 format하여 사용하면 정상적으로 사용 할수 잇습니다.  
그러나 중요한 정보나 데이타가 있다면 newfs 나 format의 경우 모두 없어지게 됩니다.  
그래서 평소에 백업을 충실히 해두라는 말입니다...  
나중에 후회 하지 말구여...  
 
희망이 없는것은 아닙니다... 한번 해보자구여...  
 
 
에러현상은 다음과 같이 크게 SOFT ERROR과 HARD ERROR로 들수 있습니다.  
 
SOFT ERROR  
----------  
soft에러 발생시 데이타는 영향을 받는 블럭(Affacted block)은 영향을 받지않는(alternate block)으로  
이동하게 됩니다. 그리고 이 불안정한 블럭은 repaired되거나 flawed sector(손상된섹터)  
라는 꼬리표를 달게 됩니다.  
 
 
HARD ERROR  
----------  
하드웨어적인 에러는 디스크의 I/O나 SCSI의 문제일수도 있다..  
물리적 전기적 충격을 가하지 않았다면 디스크는 왠만해선 고장 나지 않는다.  
위의 soft error일 경우가 많은데 Hard error로 간주한다면  
여러분의 귀중한 데이타는 없어질지도 모릅니다.  
정말루 확실한 Hard error라고 판명이 되면 수리센타에 의뢰하는 것이 좋습니다.  
format명령어를 실행했을 경우 Hard error은 디스크타잎을 모르거나 인식이 되지 않는  
경우 입니다.  
 
그런데 디스크타잎과 정보는 정상적인데 fsck시 나타나는 현상이 생기면  
일단은 다음과 같이 해 봅시다...정말 몇천만원 짜리 데이타라면 중요하므로  
전문 복구센타에 의뢰하셔야지 제가 하는데로 하시다간 저만 나쁜놈 됩니다.  
그래도 밑져야 본전 중요한 데이타가 아니라면 일단 한번 해보시죠...  
혹시 압니까.. 제덕에 돈벌런지....ㅋㅋ  
 
 
자그럼 지금 부터 하는 내용을 잘 따라 하시면됩니다.  
 
 
format 명령어를 칩니다.  
 
증상이 나타나는 디스크의 번호를 선택 합니다.  
 
블럭에러가 하나인 것은 다음과 같은 예로 하시면 됩니다.  
 
일단은 error bolck number를 아셔야 합니다.  
 
예)  
 
# format  
AVAILABLE DISK SELECTIONS:  
0. c0t0d0 <IBM-DDYS-T18350M-SA2A cyl 14970 alt 2 hd 6 sec 399>  
/sbus@1f,0/SUNW,fas@e,8800000/sd@0,0  
1. c0t1d0 <SUN4.2G cyl 3880 alt 2 hd 16 sec 135>  
/sbus@1f,0/SUNW,fas@e,8800000/sd@1,0  
2. c0t2d0 <IBM-DCAS-34330-S65A cyl 8203 alt 2 hd 6 sec 171>  
/sbus@1f,0/SUNW,fas@e,8800000/sd@2,0  
3. c0t4d0 <IBM-DORS-32160-WA6A cyl 6701 alt 2 hd 5 sec 125>  
/sbus@1f,0/SUNW,fas@e,8800000/sd@4,0  
Specify disk (enter its number)[3]: 3 ----> block error가 난 디스크선택  
selecting c0t4d0  
[disk formatted]  
format> repair  
Enter absolute block number of defect: 4080544 ---> 에러 block number  
Ready to repair defect, continue? y  
(at this point, format will indicate how and if the block was repaired)  
format> q  
 
이런식으로 하시면 됩니다. 에러 블럭이 하나라면 위와 같은 식으로 하시면 되겠죠..  
그다음 raw device를 fsck 시켜 줍니다. 그럼 아무문제 없이 fsck될 것입니다.  
그담엔 mount 하시면 됩니다.... 성공하면 방명록에 고맙다는 리플 다시는거  
잊지마셈...  
 
 
자 그럼 두개 이상의 block error 을 reoair하려면 어떻게 하는지  
 
다음 예를 들어 봅니다.  
 
예)  
AVAILABLE DISK SELECTIONS:  
0. c0t0d0 <IBM-DDYS-T18350M-SA2A cyl 14970 alt 2 hd 6 sec 399>  
/sbus@1f,0/SUNW,fas@e,8800000/sd@0,0  
1. c0t1d0 <SUN4.2G cyl 3880 alt 2 hd 16 sec 135>  
/sbus@1f,0/SUNW,fas@e,8800000/sd@1,0  
2. c0t2d0 <IBM-DCAS-34330-S65A cyl 8203 alt 2 hd 6 sec 171>  
/sbus@1f,0/SUNW,fas@e,8800000/sd@2,0  
3. c0t4d0 <IBM-DORS-32160-WA6A cyl 6701 alt 2 hd 5 sec 125>  
/sbus@1f,0/SUNW,fas@e,8800000/sd@4,0  
Specify disk (enter its number)[3]: 3  
selecting c0t4d0  
[disk formatted]  
 
format> analyze  
 
analyze> setup  
analyze> setup  
Analyze entire disk[yes]? no  
Enter starting block number[0, 0/0/0]: 2036240  
Enter ending block number[2052287, 2035/13/7]: 2036270  
Loop continuously[no]? no  
Enter number of passes[2]: 1  
Repair defective blocks[yes]? yes  
Stop after first error[no]? no  
Use random bit patterns[no]? no  
Enter number of blocks per transfer[126, 0/2/0]: 1  
Verify media after formatting[yes]? yes  
Enable extended messages[no]? no  
Restore defect list[yes]? yes  
Restore disk label[yes]? yes  
 
analyze> read  
Ready to analyze (won't harm SunOS). This takes a long time,  
but is interruptible with CTRL-C. Continue? y  
 
pass 0  
 
Error during read: block 2036256 (0x5da1c0) (2003/5/3)  
Repairing soft error on 2036256 (2003/5/3)...ok.  
 
Error during read: block 2036257 (0x5da1c1) (2003/5/4)  
Repairing soft error on 2036257 (2003/5/3)...ok.  
 
Error during read: block 2036258 (0x5da1c2) (2003/5/5)  
Repairing soft error on 2036258 (2003/5/3)...ok.  
Error during read: block 2036259 (0x5da1c3) (2003/5/6)  
Repairing soft error on 2036259 (2003/5/3)...ok.  
 
2035/13/7  
 
Total of 4 defective blocks repaired.  
(0x5da1c0) (2003/5/3)  
(0x5da1c1) (2003/5/4)  
(0x5da1c2) (2003/5/5)  
(0x5da1c3) (2003/5/6)  
 
analyze> quit  
format> quit  





출처 : http://blog.naver.com/navy_han?Redirect=Log&logNo=70024449636



### 시스템 점검 및 장애복구 방법 ###

 

Hardware 점검

hoony[root:/#]format
nSearching for disks...done nAVAILABLE DISK SELECTIONS:       
0. c0t0d0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>          
/sbus@1f,0/SUNW,fas@e,8800000/sd@0,0 n      
1. c0t1d0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>         
/sbus@1f,0/SUNW,fas@e,8800000/sd@1,0

hoony[root:/#]iostat -En
c0t0d0          Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: SEAGATE  Product: ST39236LC        Revision: 0005 Serial No:
Size: 9.19GB <9185582592 bytes> n
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0 n
c0t6d0          Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: TOSHIBA  Product: XM6201TASUN32XCD Revision: 1103 Serial No:
Size: 0.00GB <0 bytes> nMedia Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
n* -En option은 5.6 이상에서만 지원됨

 

LAN Port 점검

점검목적 nsystem 에 장착되어 있는 LAN card 의 Port 및 cable 의 연결상태를 점검하여
network의 장애 요소를 제거

hoony[root:/#]netstat -i
Name Mtu Net/Dest Address Ipkts Ierrs   Opkts      Oerrs Collis Queue
lo0 8232 loopback localhost 231473 0        231473   0       0       0
hme1 1500 ns ns 1450055 0        1296494  0       0       0
Ierrs : Input error ( 0.025% 까지는 정상 ), Oerrs : Output error( 0.025% 까지는 정상 )
Queue : 10% 까지는 정상.
* 시스템을 부팅한지 오래된 경우에는 맞지 않을 수 있음

Software 점검

hoony[root:/#]df -k
파일시스템                 K바이트         사용      가용    용량    설치지점
/dev/dsk/c0t0d0s0    6196234   5893082  241190    97%    /
/proc                                  0             0           0     0%    /proc
fd                                       0             0           0     0%    /dev/fd
mnttab                                0             0           0     0%    /etc/mnttab
swap                        2222704           24 2222680     1%    /var/run
/dev/dsk/c0t0d0s5     9136141  7682616 1362164    85%    /users1
/dev/dsk/c0t1d0s6   17413250 13630019 3609099    80%    /mnt
swap                        2223784        1104 2222680     1%    /tmp 
Core file 및 lost+found file 정리(find 명령어 사용)
90%이상 넘는 부분이 있을 시 일단 data 영역에서 필요 없는 파일들을 제거
core file 등과 같은 size 가 크고 불필요한 파일을 제거하여 90% 이하 수준으로 유지

 

Network 점검

점검목적 nNetwork를 구성하는 configuration file 과 table들을 점검하여 외부와의 서비스에
장애요소가 있는지 점검

점검방법 nNetwork 관련 해당 파일 확인
system booting시에 network configuration이 정상적으로 설정됨을 점검
(/etc/hosts, /etc/hostname*,  /etc/inet/*)

현재 Network 환경 설정 확인
ifconfig –a 와 netstat –nr 명령어를 이용하여 network device 의 설정 및 routing table 이
정상인지 점검 nNetwork 외부 연동 확인

외부 system 과의 ping , telnet 여부 확인
snoop ,arp 로 protocol 이 정상인지 확인

 

Administration File 점검
hoony[root:/#]who -b 

       system boot   8월  9 15:55
hoony[root:/#]who -r 

       run-level 3   8월  9 15:55     3      0  S
/var/adm/message file중 WARNING , Error 가 포함되어 있는지  점검하여 과거와 현재
장애 component 의 교체 여부를 결정
hoony[root:/#]grep WAR /var/adm/messages*
hoony[root:/#]grep Err /var/adm/messages*
hoony[root:/#]grep panic /var/adm/messages*

 

계정관리 File 확인

/etc/passwd , /etc/shadow, /etc/group file들을 점검, 운영에 불필요한 계정이 있는지 확인
hoony[root:/#]more /etc/passwd
root:x:0:1:Super-User:/:/bin/ksh
daemon:x:1:1::/: nbin:x:2:2::/usr/bin:
sys:x:3:3::/:
… … …
listen:x:37:4:Network Admin:/usr/net/
ls: nnobody:x:60001:60001:Nobody:/:
noaccess:x:60002:60002:No Access User:/:
nobody4:x:65534:65534:SunOS 4.x Nobody:/:
* passwd 파일은 7개의 필드로 구성 
 (login ID : x : UID : GID : comment : home directory : login shell)

hoony[root:/etc/inet#]more /etc/shadow
root:1OTpM5zTYsnJ6:12660:7:49::::
daemon:NP:6445::::::
bin:NP:6445:::::: nsys:NP:6445::::::
… … … nlisten:MZu2Kz2foRU.g:::::::
nobody:NP:6445:::::: nnoaccess:NP:6445::::::
nobody4:NP:6445::::::
* shadow파일은 9개의 필드로 구성(password가 암호화되어 있는 file)
(login ID : passwd : lastchg : min : max : warn : inactive : expire : )

 

패스워드 정책 설정 값 확인
/etc/default/passwd file에 MAXWEEKS=4 , PASSLEGTH=6 으로
설정하여 4주마다 한번씩은 password를 변경하고, 6자리 이상으
로 하여 Password의 유출을 최대한 방지

주기적인 job 정상운용 여부 확인 ncron이 정상적으로 설정되어 있는지 crontab -l 로 확인
실행 후 log file 인 /var/cron/log or olog 를 점검하여 cron 수행시 nerror 발생 여부 확인

DISK I/O 사용율 niostat 혹은 vmstat 명령어를 사용하여 system disk 및 data disk 의 I/O
performance를 측정. solaris 8 일 경우 iostat –xnt option 을 사용하여
I/O 에 error 가 발생하는지를 점검
hoony[root:/etc#]iostat -xnt 2 100
extended device statistics       ---- errors ---
r/s    w/s   kr/s   kw/s wait actv wsvc_t asvc_t  %w  %b s/w h/w trn tot device
17.1   13.1   76.3   97.4  0.2  1.2    7.5   41.3   0  18   0   0   0   0 c0t0d0
0.0    0.0    1.2    0.0  0.0  0.0    0.0    5.7   0   0   0   0   0   0 c0t1d0
0.7    0.0    1.5    0.0  0.0  0.0   19.5   10.2   0   0   0   0   0   0 c0t6d0
0.0    0.0    0.0    0.0  0.0  0.0    0.0    0.6   0   0   0   0   0   0 hoony:vold(pid305)

 

Memory 및 swapping 사용율
sar 나 swap 명령어를 사용, 현재 free memory 값 점검 및 확인
vmstat 값에서 page 의 sr 이 값이 200 이 넘는 경우가 있는지를 점검
hoony[root:/etc#]swap –s
총: 39824k 바이트 할당 + 21152k 예약 = 60976k 사용, 2223800k 사용 가능
hoony[root:/etc#]vmstat 2 100
procs     memory            page            disk          faults      cpu
r b w   swap  free  re  mf pi po fr de sr s0 s1 s6 --   in   sy   cs us sy id
2 0 0 2208584 146352 2  18 71  0  0  0  0 30  0  1  0  411  282  138  1 25 74
0 0 0 2223728 157592 0   2  0  0  0  0  0  0  0  0  0  307   99   91  0  0 100
0 0 0 2223728 157592 0   0  0  0  0  0  0  0  0  0  0  304   81   86  0  0 100
0 0 0 2223728 157592 0   0  0  0  0  0  0  0  0  0  0  308   77   75  0  0 100
0 0 0 2223728 157592 0   0  0  0  0  0  0  0  0  0  0  305   86   86  0  0 100

 

Disk 장애
장애 유형 및 복구 절차
장애 현상
WARNING:/pci@1f,4000/scsi@3/sd@1,0(sd1):
Error for command: write     Error Level: Retryable
Requested Block: 90722224    Serial Number: 3HZ62CT3
Sense Key: Hardware Error nWARNING: /pci@1f,4000/scsi@3/sd@1,0(sd1):
SCSI transport failed: reason ‘reset’ : retrying command
WARNING: /pci@1f,4000/scsi@3/sd@1,0(sd1):
SCSI transport failed: reason ‘incomplete’ : retrying command
WARNING: /pci@1f,4000/scsi@3/sd@1,0(sd1):
Disk not responding to selection
장애 복구 절차
Hard disk 의 불량으로 hardware 교체. 같은 용도로 사용중인 양호한 장비의 disk로부터 데이터 copy or reinstall

장애 현상
정전이나 부적절한 방법으로 시스템 종료로 file system 이 깨졌을 경우
부팅 시 multi user 모드로 부팅되지 않을 수 있다.
장애 복구 절차
부팅 시 multi user 모드로 부팅 하지 못하고 single user 모드에서
멈췄을 때(maintenance) root 암호를 입력하여 single user 모드로 들어간다.
# fsck 를 실행
(주의) fsck –y 명령을 실행하면 진행되는 동안 inode를 삭제할 수 있기 때문에 복구가 안될 수도 있다.
fsck 명령 실행 시에는 –y 옵션을 빼고 실행할 것.

 

CPU 장애
장애 유형 및 복구 절차
장애 현상
panic[cpu0]/thread=0x3001fec0: BAD TRAP: cpu=0 type=0x31 rp=0x3001bb00 addr=0x0
mmu_fsr=0x0 nBAD TRAP occurred in module "sd" due to an illegal access to a user address.
sched: trap type = 0x31
pid=0, pc=0x601aa4b0, sp=0x0, tstate=0x3001bb9000000000, context=0x1e03
g1-g7: 0, 30002, 112c000000000000, 7fff, abb5d55900000000, 0, 3001bec0
장애 복구 절차
cpu panic 현상이 발생하면 /var/crash/hostname 디렉토리에 이미지 파일이 생기게 된다.
adb 유틸리티나 기타 방법으로 이미지 파일을 분석한 후 hardware교체 여부를 판단

Memory 장애
장애 유형 및 복구 절차
장애 현상
May 22 11:09:50 eprjdb2 SUNW,UltraSPARC-II: [ID 362078 kern.info] [AFT0] Corrected Memory Error
detected by CPU11, errID 0x001dd49c.d54e5a7b nMay 22 11:09:50 eprjdb2 SUNW,UltraSPARC-II: [ID 589262 kern.info]
[AFT0] errID 0x001dd49c.d54e5a7b Corrected Memory Error on Board 5 J3101 is Persistent
장애 복구 절차 n먼저 /var/adm/messages 파일에 발생된 메시지에서
CE (Correctable memory Error)인지 UE (Uncorrectable memory Error)
인지 판단하여 다음의 용어를 참조 하여 교체 여부를 판단한다.

Intermittent : data에 오류가 있어 다시 해당 word를 read할 시 error가
없는 경우로 memory module 교체는 필요 없다.
* Persistent  : data에 오류가 있어 다시 해당 word를 read할 시 또 오류가
있는 경우로 memory scrub operation으로 해당 bit를 fix를
수정한 경우로 한 module에서 계속적인 error가
(24시간 내 4번 이상) 없을 경우 memory 교체는 필요 없다.
* Sticky : persistent error로 bit를 수정한 이후에도 error가 fix되지 않는
경우로 이 error가 발생하면 즉시 memory를 교체해 주어야 한다

 

File System Full
Root, VAR 등의 File System이 Full
/ 화일시스템에 사용자가 임의로 만들어 준 디렉토리, 파일 여부 확인
/dev 디렉토리 밑에 일반 파일이 있는지 조사
# find /dev  -type f -exec ls -l {} \;
일반 파일이 있을 경우, 모두 삭제. 특히 테이프에 백업을 받을 경우에 사용자가 디바이스명을 잘못 지정하여,
테이프에 백업되지 않고 파일에 저장하는 경우가 있다.
시스템에 있는 core 화일을 제거

core 화일을 찾아 보려면 다음과 같은 명령어를 사용한다.
# find / -name core –print

core 화일을 찾아서 자동으로 지우려면 다음과 같은 명령어를 실행
# find / -name core -exec rm {} \; -print


/var 디렉토리 밑을 조사한다.
# du -sk /var/* | sort –nr
/var 밑에 있는 디렉토리 별로 그 서브 디렉토리까지 포함하여 KB단위로
크기를 출력. 정상적인 시스템에 문제가 될 디렉토리는 다음과 같다.
/var/adm, /var/mail, /var/log, /var/preserve, /var/spool
/var/adm/messages*, wtmp, wtmpx, pacct
시스템이 운용 중에 발생하는 메세지나 기타 정보들이 누적 보관되는 곳.
messages : 시스템에서 발생되는 메세지를 보관하는 파일
wtmp, wtmpx : 시스템에 접속한 사용자에 대한 정보
pacct : accounting 정보를 가지고 있는 파일
# cp /dev/null messages # cp /dev/null wtmp
# cp /dev/null wtmpx # cp /dev/null pacct

/var/mail
메일 데이터가 보관되는 곳(해당 사용자에게 그 메일을 정리하도록 권고)
※ 파일을 지울 때, 그 파일이 어떤 파일인지 숙지한 후에
지울 것인가 아닌가를 결정
/ 파일 시스템에 있는 1 MB 이상 되는 파일을 조사하여, 파일 크기순으로 sort하여 그 내용을 조사한다.
# find / -mount -size +1024k -ls > /tmp/find.list
# sort -nr +6 /tmp/find.list > /tmp/find.list.s
find.list.s 파일에서 비정상적인 큰 파일이 있는지 조사한다

 

[스크랩] Solaris 시스템 현황보기

Posted 2009. 2. 24. 18:55

[출처] Solaris 시스템 현황보기|작성자 튤립정원



#prtdiag -v | more : 시스템 상태 보기 (H/W 고장 여부 포함)

#prtconf    : instance 간략 보기

#psrinfo    : processor 간략 보기, 부팅 시간도 표시

#prstat      : process 상태 보기

#/usr/platform/`uname -i`/sbin/prtdiag -v

#showrev  : 모델 등

#iostat -nE: disk 등

 

 

#w           : uptime+whodo요약

#uptime    : show how long the system has been up

#whodo    : 계정별(터미널별) 실행 프로세스

#who -b    : 부팅 일시

 

#swap -l   : swap 상태 보기

 

--------------------------------------------------------

* script로 보기

 

echo "The System-Hostname=`hostname`"
echo "The System-Uptime= `uptime|awk '{ print $3,$4,$5 }'`"
sm=`prtconf -pv|grep banner-name|awk -F"'" '{ print $2 }'`
echo "The system-make=$sm"
mm=`prtconf -pv|grep Mem|awk ' { print $3,$4 }'`
echo "The system-memory=$mm"
ps=`psrinfo|grep on-line|wc -l`
echo "The Sytem-process-count=,$ps"
mc=`ifconfig  -a|awk '/ether/ { print $2 }'`
echo "The System-MacAddress=$mc"
bt=`isainfo -kv`
echo "The System- kernel-type=$bt"

--------------------------------------------------------

 

  * HOST 이름
# uname -n    : whiteeye
# hostname    : whiteeye
# showrev     : Hostname: whiteeye
# sysdef      : whiteeye node name (NODE)


   * OS의 종류, 버젼
# uname -s    : SunOS
# uname -r    : 5.6
# uname -v    : Generic
# showrev     : Release:  5.6
# Kernel version:   SunOS 5.6 Generic August 1998
# sysdef      : 5.6 release (REL)
# SunOS system name (SYS)
# Generic version (VER)

   * 파티션 구성
# df -k       : Filesystem kbytes used avail capacity Mounted on
        /dev/dsk/c0t3d0s0 38383 19392 15161 56% /
        ...........

   * 패치 정보
# showrev -p  : Patch:  101331-03 Obsoletes:  Packages:  SUNWcsu.7
        11.5.0,REV=2.0.18,PATCH=35
        ........

   * 로드 되어 있는 모듈
# sysdef      : * Loadable Objects
        strmod/bufmod
        strmod/connld
       ......

   * 소프트웨어 패키지 구성
# pkginfo     : system      AXILvplr       Axil platform links
        system      AXILvplu       Axil usr/platform links
        ..............

 
2)   네트워크에 관한 정보는 다음과 같은 코맨드가 이용 가능하다.

   * IP Address, NetMask, Broadcast Address
# ifconfig -a : inet 129.158.153.162 netmask ffffff00 broadcast 120.158.153.255
 
 
 
3)   하드웨어의 구성 요소에 관한 상세한 정보는 다음과 같은 코맨드가 이용 가능하다.

   * 아키텍처 타입
# prtconf     : System Configuration: Sun Microsystems sun4m
# arch -k     : sun4m

   * Workstation 모델
# prtconf  : SUNW,SPARCstation-5
# prtconf -vp : ......
model: 'SUNW,501-2572'
clock-frequency: 0510ff40
name: 'SUNW,SPARCstation-5'
# dmesg       : root nexus = SUNW,SPARCstation-5

   * CPU 타입
# dmesg       : cpu0:  SUNW,UltraSPARC (upaid 0 impl 0x10 ver
0x22 clock 143 MHz)
# prtconf -vp :    ....
sparc-version: 00000008
mask_rev: 00000020
device_type: 'cpu'
name: 'FMI,MB86904'
# ok cpu-info : VPU FMI,MB86904 Rev. 2.0: 85Mhz
(EEPROM 코맨드)

   * 메모리 용량
# dmesg       : mem = 32768k (0x2000000)
# prtconf     : Memory size: 32 Megabytes
 
   * 시리얼 포트 디바이스
# dmesg       : zs0 at obio0: obio 0x1000000 sparc ipl 12
zs0 is /obio/zs@0,1000000
# sysdef      : zs, instance #0
zs, instance #1

   * 디스크
# dmesg       : sd3 at esp0: target 3 lun 0
sd3 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/
esp@5,8800000/sd@3,0
# sysdef      : sd, instance #2 (driver not attached)
sd, instance #3

   * 프레임 버퍼
# prtconf     : cgsix, instance #0
# prtconf -F  : /iommu@f,e0000000/sbus@f,e0001000/cgsix@2,0
# dmesg       : cgsix0 at sbus0: SNus slot 3 00 SBus level 5 sparc ipl 9
cgsix0 is /iommu@0,10000000/sbus@0,10001000/cgsix@3,0
cgsix0: screen 1152x900, single buffered, 1M mappable, rev 11
# sysdef      : cgsix, instance #0

 
 
4)   Root 디바이스와 Swap 디바이스 등의 정보는 /etc/vfstab 화일을 확인 하거나 다음의 코맨드의
   이용이 가능 하다.

   * Root 디바이스
# dmesg       : root on /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/
esp@5,8800000/sd@3,0:a fstype ufs

   * Swap 디바이스
# dmesg       : dump on /dev/dsk/c0t3d0s1 size 131532K
# swap -l     : swapfile dev swaplo blocks free
/dev/dsk/c0t3d0s1 32,25 8 263080 209312
# sysdef      : swapfile dev swaplo blocks free
/dev/dsk/c0t3d0s1 32,25 8 263080 209312

   * 시스템 보드 구성의 정보
# prtdiag(Sun4d, Sun4u 아키텍처만 가능)
PS. # /usr/platform/sun4u/sbin/prtdiag -v | more 플랫폼 정보를 한번에 확인
 
  * 로그 화일 : /var/sadm/system/logs/install_log
   OS의 인스톨 개시부터의 로그 정보가 화일에 기록 되어 있다. 이 화일에는 이하의
   내용이 있다.

    - 화일 시스템의 구성
    - 인스톨된 패키지의 종류
    - 인스톨된 소프트웨어의 총용량
    - 부트 디바이스

4) 로그 화일 : /var/sadm/system/logs/sysidtool.log
   OS를 인스톨할 때에 새로운 시스템에 관한 몇가지의 정보를 입력 한다. 이것은 sysidtool라고
   하는 일련의 프로그램에 따라 자동적으로 처리 된다. sysidtool의 로그 정보가 화일에 기록 된다.
    
    - Ethernet의 인터페이스 이름
    - 인스톨시에 설정한 IP 어드레스
    - 인스톨시에 설정한 Netmask의 값
    - 타임존
    - 선택한 네임 서비스의 종류

 

http://www.databaser.net/solaris/solaris_performence.htm
성능 측정...
일단 시스템 관리자라면 시스템의 성능에 신경쓰지 않을 수 없습니다...
물론..보안등등의 관리도 해줘야 겠지만요...헐헐~
그러나 시스템을 평가한다면...거의 두가지 측면에서 바라보게 됩니다...
안정성과 성능...
이 두가지중 여기서 살펴볼것은 성능측정입니다..
시스템 관리자는 다음과 같은 사항들을 중점적으로 검토해야 합니다..
- cpu 사용량
- 버퍼의 사용량
- 디스크와 백업의 i/o의 액티비티
- 터미널 디바이스의 액티비티
- 시스템 콜의 액티비티
- context switching
- file access
- queue activity
- kernel table
- interprocess communication
- 페이징
- free memory and swap sapce
- KMA(Kernel Memory Allocation)
- RFS(Remote File Sharing)
관리자는 이러한 사항들을 cron(일정주기로 작업을 명령)을 이용해서 주기적으로 
측정/검토하여 그 리포트를 작성하도록 해야합니다..
그러면 성능측정에 대한 명령어를 하나씩 살펴보기로 하겠습니다..
양이 좀 많네여..헐헐~
일단 전에도 나온 ps(프로세스 상태 측정) 명령어를 다시한번 살펴봅시다..
보통의 사용에서 -l 옵션만 주면 프로세스의 자세한 사항을 나열해 줍니다..
각 필드의 의미는 다음과 같습니다..
 
F    : 프로세스 플래그
S    : 프로세스의 상태
       O : 실행중인 프로세스
       S : Sleeping 상태의 프로세스
       R : Run Queue 에 있는 프로세스
       Z : Zombie 상태의 프로세스
       T : Job control signal에 의해 정지된 프로세스
UID   : 프로세스 소유자인 user ID 수
PID   : 프로세스 ID
PPID  : 부모프로세스 ID
C     : 스케줄링을 위한 프로세스 사용량
CLS   : 스케줄링 클래스
PRI   : 프로세스의 우선순위
NI    : 프로세스의 우선 순위 사용된 값
ADDR  : 프로세스의 메모리 주소
SZ    : 가상 메모리에서 프로세스의 전체 크기, 데이타와 스택 세그먼트 크기
WCHAN : Sleeping 상태에 있는 프로세스의 이벤트 주소
STIME : 프로세스의 시작시간
TTY   : 프로세스의 실행 터미널
TIME  : 프로세스의 실행 누적시간
COMMAND : 명령어
또 -o 옵션을 사용하면 사용자가 특정 포멧을 정의하여 모든 프로세스의 상태를 점검함으로써
각각의 프로세스가 사용하고 있는 시스템 리소스등을 측정할 수 있습니다...
각 필드의 의미는 다음과 같습니다..
위에서 나온 필드는 생략하겠습니다..

user   : 프로세스 사용상의 user ID
ruser  : 프로세스 실질적인 user ID
group  : 프로세스 사용상의 group ID
rgroup : 프로세스 실질적인 group ID
pid  
ppid
pgid   : 프로세스의 group ID
pcpu   : 같은 시간대에 CPU 사용시간에 대한 비율(%)
vsz    : 가상메모리에서 프로세스 전체 크기
nice   : 프로세스의 시스템 스케줄링에 대한 우선순위에 대한 십진수값
dd     : 요일
hh     : 시간
mm     : 분
ss     : 초
tty
comm
args   : 모든 아규먼트를 포함하고 있는 명령어
======================================================================
# ps -l
 F S   UID   PID  PPID  C PRI NI     ADDR     SZ    WCHAN TTY      TIME CMD
 8 S     0  9421  9415  0  51 20 e173e0e0     61 e173e14c pts/4    0:00 sh
 8 O     0  9422  9421  0  51 20 e16717f8    354          pts/4    0:00 ps
# ps -efl | more
 F S      UID   PID  PPID  C PRI NI     ADDR     SZ    WCHAN    STIME TTY      TIME CMD
19 T     root     0     0  0   0 SY fec16d9c      0           11월 26 ?        0:03 sched
 8 S     root     1     0  0  40 20 e0e1a750    162 e0e1a97c  11월 26 ?        0:01 /etc/init -
19 S     root     2     0  0   0 SY e0e1a008      0 fec397bc  11월 26 ?        0:01 pageout
19 S     root     3     0  0   0 SY e0e14758      0 feca0564  11월 26 ?       28:41 fsflush
 8 S     root   323     1  0  40 20 e0e14010    359 e0e0dc9c  11월 26 ?        0:00 /usr/lib/saf/sac -t 300
 8 S     root   268   267  0  44 20 e0e72760    627 e128972c  11월 26 ?        0:00 htt_server -port 9010 -syslog -mess
 8 S     root   154     1  0  41 20 e0e72018    540 e0f12782  11월 26 ?        0:00 /usr/sbin/rpcbind
 8 S     root    63     1  0  57 20 e0f48768    322 e0f48994  11월 26 ?        0:00 /usr/lib/sysevent/syseventd
 8 S     root    65     1  0  57 20 e0f48020    270  8062f54  11월 26 ?        0:00 /usr/lib/sysevent/syseventconfd
 8 S     root   223     1  0  44 20 e10f9770    733 e10f999c  11월 26 ?        0:02 /usr/sbin/nscd
 8 S     root   140     1  0  40 20 e10f9028    395 e0f127c2  11월 26 ?        0:00 /usr/lib/inet/in.ndpd
 8 S     root   206     1  0  47 20 e10f6778    763 e0f12482  11월 26 ?        0:00 /usr/sbin/syslogd
 8 S     root   197     1  0  41 20 e10f6030    642  807fd1c  11월 26 ?        0:00 /usr/lib/autofs/automountd
                            
                                  .
                                  .
                                  .
                                  .
                                  .
                                  .
                                  .
 # ps -ef -o 'user group pid ppid pcpu pmem vsz rss time stime tty args' | more
    USER    GROUP   PID  PPID %CPU %MEM  VSZ  RSS        TIME    STIME TT      COMMAND
    root     root     0     0  0.0  0.0    0    0        0:03  11월_26 ?       sched
    root     root     1     0  0.0  0.1  648  116        0:01  11월_26 ?       /etc/init -
    root     root     2     0  0.0  0.0    0    0        0:01  11월_26 ?       pageout
    root     root     3     0  0.1  0.0    0    0       28:41  11월_26 ?       fsflush
    root     root   323     1  0.0  0.2 1436  140        0:00  11월_26 ?       /usr/lib/saf/sac -t 300
                                   .
                                   .
                                   .
                                   .
                                   .
                                   .                            
======================================================================
다음은 vmstat 명령에 대해서 살펴봅니다...
이 명령어는 프로세스, 가상 메모리, 페이징, 디스크, CPU 등의 상태를 측정할 수 있습니다..
멀티프로세스인 경우는 모든 프로세서 사용량의 평균값으로 나타냅니다..
옵션은 다음과 같습니다..
c : cache flushing 통계치
i : 디바이스당 인터럽트 수
s : 부팅 이후부터 시스템에서 발생된 전체 이벤트
S : 페이징 대신에 스와핑을 표시. 페이징의 re와 mf를 스와핑 출력의 입/출력으로 나타낸다.

각 필드를 살펴보겠습니다...
procs: 프로세스의 수와 그에 해당하는 데이타를 나타낸다.
  - r : 실행 가능한 상태로 대기 큐에 쌓인 프로세스의 수. 숫자가 크면 프로세스의 사용이 원할치 못한 것을 의미.
        이 수치가 3 이상을 넘어 같다면 CPU는 바쁜 것으로 보면 된다..
  - b : 입/출력 자원을 할당받지 못해 블록된 프로세스
  - w : swap-out된 프로세스수. 실행 가능한 대기 큐에는 쌓이지 않고
      swap-out된 프로세스가 많다는 것은 physical memory가 부족하다는 뜻
memory : 가상메모리와 Phygical 메모리의 사용량.. 
         free메모리가 인스톨된 메모리의 6% 보다 계속적으로 작으면 가용 메모리가 부족한 경우이고,
         잠재적인 병목현상
page : 초 당 발생하는 fault page 수와 실행중인 페이징 표시
  - re : page reclaim
  - mf : minor fault
  - pi : page in(KB)
  - po : page out(KB)
  - fr : free(KB)
  - de : short-term 메모리 부족분, 즉, swap-in을 막기 위해서 swap-out시에 설정된 인공적인 메모리의 부족분이다.
  - sr : clock 알고리즘에 의한 페이지 scanned. sr 은 가용 메모리 부족시에 활성화도니 페이지 데몬의 수를 나타낸다.
         즉, sr 이 크다는 것은 사용 가능 메모리가 부족하다는 것이다. 이 수치가 약 300 이상을 넘어 갈때는 사용가능 메모리 부족상태
disk : 초당 디스크 조작수
faults : 초당 trap/interrupt 비율
  - in : device interrupt(non clock)
  - sy : 초당 system fault
  - cs : CPU context switch 율
CPU : CPU 사용시간에 대한 백분율(%)
 - us : 사용자 사용 시간
 - sy : 시스템 사용 시간
 - id : idel time      
         
=======================================================================
# vmstat 3                               -- 3초주기로 시스템의 성능측정
 procs     memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr cd f0 s0 --   in   sy   cs us sy id
 0 0 0 402156 24052   0   2  1  1  1  0  0  2  0  0  0  124  124  233  0  1 99
 0 0 0 326372  2764   0   2  2  0  0  0  0  1  0  0  0  139  100  232  0  0 100
 0 0 0 326372  2764   0   0  0  0  0  0  0  1  0  0  0  137   99  229  0  0 100
# vmstat -s                            -- 시스템이 부팅한 이후 지금까지 발생한 모든 이벤트를 나타낸다.
        0 swap ins
        0 swap outs
        0 pages swapped in
        0 pages swapped out
  1338611 total address trans. faults taken
    79572 page ins
    94967 page outs
   264645 pages paged in
   235797 pages paged out
   522758 total reclaims
   522751 reclaims from free list
        0 micro (hat) faults
  1338611 minor (as) faults
    66710 major faults
   275034 copy-on-write faults
   269827 zero fill page faults
   207534 pages examined by the clock daemon
        7 revolutions of the clock hand
   258255 pages freed by the clock daemon
     8612 forks
      817 vforks
     7357 execs
131379033 cpu context switches
126398988 device interrupts
  1806843 traps
 70023420 system calls
  3482588 total name lookups (cache hits 97%)
    44446 user   cpu
   339472 system cpu
 55847698 idle   cpu
    78465 wait   cpu
# vmstat -S 3                                  
-- 페이징에 대한 내용...si/so가 추가됨...(si: 초당 swap-in수, so: swap-out된 전체 프로세스 수)
 procs     memory            page            disk          faults      cpu
 r b w   swap  free  si  so pi po fr de sr cd f0 s0 --   in   sy   cs us sy id
 0 0 0 402040 24016   0   0  1  1  1  0  0  2  0  0  0  124  124  233  0  1 99
 0 0 0 326340  2692   0   0  0  8  8  0  0  1  0  0  0  134   97  230  0  0 100
 0 0 0 326340  2692   0   0  0  8  8  0  0  1  0  0  0  133   99  229  0  0 100
# vmstat -i
interrupt         total     rate
--------------------------------
clock          56339497      100
fdc0                 55        0
--------------------------------
Total          56339552      100
    
=======================================================================
다음은 디스크와 관련된 성능측정의 명령어와 방법을 살펴보겠습니다...
iostat는 각 디스크에서 받는 로드를 측정할 수 있는 명령어 입니다..
옵션은 다음과 같습니다..
c : user mode, system mode, I/O를 위한 waiting, idle 등에 사용된 사용 시간에 대한 백분율
D : 초당 디스크의 read, write와 utilzation에 대한 백분율
t : 초당 터미널에서 사용된 read, write의 character 수
x : 추가된 모든 디스크들의 상태 표시
다음은 각 필드의 의미 입니다..
tin  : 터미널 입력큐의 문자수
tout : 터미널 출력큐의 문자수
bps  : 초당 블록
tps  : 초당 트랜잭션
serv : 서비스 시간의 평균값(단위:ms)
us   : 사용자 모드
sy   : 시스템 모드
wr   : 입출력 wating
id   : idle
r/s  : 초당 읽기수
w/s  : 초당 쓰기수
kr/s : 초당 읽기수(KB)
kw/s : 초당 쓰기수(KB)
wait : 서비스를 위한 트랜잭션 waiting 평균값
actv : 실질적으로 서비스된 트랜잭션의 평균값
svc_t: 서비스 시간 평균값(단위: ms)
%w   : 큐가 비어있지 않는 시간의 백분율
%b   : 디스크가 busy 상태인 시간의 백분율
=======================================================================
# iostat 3
   tty       cmdk0          sd0           nfs1          nfs2           cpu
 tin tout kps tps serv  kps tps serv  kps tps serv  kps tps serv   us sy wt id
   0    7  14   2   40    0   0    7    0   0    1    0   0    0    0  1  0 99
   0   78   8   1    2    0   0    0    0   0    0    0   0    0    0  0  0 100
   0   27   8   1    2    0   0    0    0   0    0    0   0    0    0  1  0 99
# iostat -xtc 3                                                                       
--  30간의 평균 사용량이 30%를 넘는 디스크 서비스 시간은 점검할 필요가 있다.
                  extended device statistics                      tty         cpu
device       r/s    w/s   kr/s   kw/s wait actv  svc_t  %w  %b  tin tout  us sy wt id
cmdk0        0.2    1.4    2.5   11.4  0.1  0.0   39.5   0   1    0    7   0  1  0 99
fd0          0.0    0.0    0.0    0.0  0.0  0.0   95.7   0   0
sd0          0.0    0.0    0.0    0.0  0.0  0.0    7.0   0   0
nfs1         0.0    0.0    0.0    0.0  0.0  0.0    0.7   0   0
nfs2         0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
                  extended device statistics                      tty         cpu
device       r/s    w/s   kr/s   kw/s wait actv  svc_t  %w  %b  tin tout  us sy wt id
cmdk0        0.0    1.0    0.0    8.0  0.0  0.0    2.4   0   0    0  172   0  0  0 100
fd0          0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
sd0          0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
nfs1         0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
nfs2         0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
# iostat -D 3                                                                   
-- 시스템의 디스크 입출력이 가장 활발할때 측정...util이 65% 이상이면 과부하로 판단할 수 있다.
   cmdk0          sd0           nfs1          nfs2
rps wps util  rps wps util  rps wps util  rps wps util
  0   1  0.6    0   0  0.0    0   0  0.0    0   0  0.0
  1   1  1.4    0   0  0.0    0   0  0.0    0   0  0.0
  0   1  0.2    0   0  0.0    0   0  0.0    0   0  0.0
 
=======================================================================
다음은 시스템의 여러 리소스들의 성능을 측정할 수 있는 명령어로 
sar(System Activity Reporter)를 알아보겠습니다..
이 명령어를 사용하면 운영중인 상태에서 자동으로 데이타를 수집할 수 있으며, 특정 파일을 사용하여 일정한 주기에
의해 데이타를 파일로 정리할 수 있습니다..
첫번째 포멧
t초의 간격을 주기로 하여 n번 반복적으로 실행.
-o 옵션으로 특정파일에 저장할 수 있다. 바이너리 형태로 저장
두번째 포멧
주로 전에 이미 sar명령을 통해 기록해 두었던 파일이 존재할 경우에 이 포멧을 사용
-f 옵션을 사용하여 불러올 파일을 정의한다.
-s, -e 옵션을 사용하여 시작과 끝나는 시간을 정의할 수 있다.
-i 옵션은 일정한 주기(초)를 나타낸다.
옵션 
-a : Check file access operation
-b : Report buffer activity
-c : Report system calls
-d : Report block device activity
-g : Report paging activity( page-out & memory freeing)
-k : Report kernel memory allocation(KMA) activity
-m : Report message & semaphore acitivity
-p : Report pagin acitivity(page-in & fault activity)
-q : Report average queue length while occupied & percent of time occupied
-r : Report unused memory pages & disk blocks
-u : Report CPU utilization
-v : Report status of process. i-node, file tables
-x : Report remote file-shring activity
-w : Report system swapping & switching activity
-y : Report TTY device activity
-A : Report all data
참고: 특정옵션을 주지 않으면 기본 옵션이 -u
================================================================================
# sar 3 5                                                 -- 3초 간격으로 5회 실행
SunOS yasicom 5.8 Generic_108529-09 i86pc    12/03/01
01:23:35    %usr    %sys    %wio   %idle
01:23:38       0       0       0     100
01:23:41       0       0       0     100
01:23:44       0       1       0      99
01:23:47       0       0       0     100
01:23:50       0       0       0     100
Average        0       0       0     100
# sar 3 5                                    -- 특정 옵션 없이 cpu 점검
SunOS yasicom 5.8 Generic_108529-09 i86pc    12/03/01
01:23:35    %usr    %sys    %wio   %idle
01:23:38       0       0       0     100
01:23:41       0       0       0     100
01:23:44       0       1       0      99
01:23:47       0       0       0     100
01:23:50       0       0       0     100
Average        0       0       0     100
# sar -o /tmp/sar_1.file 3 5
SunOS yasicom 5.8 Generic_108529-09 i86pc    12/03/01
01:24:50    %usr    %sys    %wio   %idle
01:24:53       0       2       0      98
01:24:56       0       0       0     100
01:24:59       0       0       0     100
01:25:02       0       0       0     100
01:25:05       0       0       0     100
Average        0       0       0     100
# ls -l /tmp/sar_1.file
-rw-r--r--   1 root     other      17640 12월  3일  01:25 /tmp/sar_1.file
# sar -f /tmp/sar_1.file
SunOS yasicom 5.8 Generic_108529-09 i86pc    12/03/01
01:24:50    %usr    %sys    %wio   %idle
01:24:53       0       2       0      98
01:24:56       0       0       0     100
01:24:59       0       0       0     100
01:25:02       0       0       0     100
01:25:05       0       0       0     100
Average        0       0       0     100
# sar -b 3 5                                      -- 버퍼의 activity 점검
SunOS yasicom 5.8 Generic_108529-09 i86pc    12/03/01
01:26:14 bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s                
01:26:17       0       0     100       0       0     100       0       0
01:26:20       0       0     100       0       0     100       0       0
01:26:23       0       5     100       4       9      58       0       0
01:26:26       0       1     100       1       1       0       0       0
01:26:29       0       0     100       0       0     100       0       0
Average        0       1     100       1       2      52       0       0             
-- %rcache와 %wcache는 시스템 버퍼의 유효값
-- %rcache가 90 이하로 떨어지거나, %wcache가 65 이하로 측정되면 버퍼 스페이스를 증가시켜서 성능 증가시킴
#
#
#
# sar -d 10 3                                                
-- 디스크 입출력 점검...10초간격으로 3번
SunOS yasicom 5.8 Generic_108529-09 i86pc    12/03/01
01:28:21   device        %busy   avque   r+w/s  blks/s  avwait  avserv
01:28:31   cmdk0             0     0.0       2      26     0.0     2.4
           fd0               0     0.0       0       0     0.0     0.0
           nfs1              0     0.0       0       0     0.0     0.0
           nfs2              0     0.0       0       0     0.0     0.0
           sd0               0     0.0       0       0     0.0     0.0
           uhci0,bu          0     0.0       0       0     0.0     0.0
           uhci0,ct          0     0.0       0       0     0.0     0.0
           uhci0,in          0     0.0       0       0     0.0     0.0
           uhci0,is          0     0.0       0       0     0.0     0.0
           uhci0,to          0     0.0       0       0     0.0     0.0
01:28:41   cmdk0             0     0.0       1      14     0.0     2.4
           fd0               0     0.0       0       0     0.0     0.0
           nfs1              0     0.0       0       0     0.0     0.0
           nfs2              0     0.0       0       0     0.0     0.0
           sd0               0     0.0       0       0     0.0     0.0
           uhci0,bu          0     0.0       0       0     0.0     0.0
           uhci0,ct          0     0.0       0       0     0.0     0.0
           uhci0,in          0     0.0       0       0     0.0     0.0
           uhci0,is          0     0.0       0       0     0.0     0.0
           uhci0,to          0     0.0       0       0     0.0     0.0
01:28:51   cmdk0             0     0.0       1      14     0.0     2.4
           fd0               0     0.0       0       0     0.0     0.0
           nfs1              0     0.0       0       0     0.0     0.0
           nfs2              0     0.0       0       0     0.0     0.0
           sd0               0     0.0       0       0     0.0     0.0
           uhci0,bu          0     0.0       0       0     0.0     0.0
           uhci0,ct          0     0.0       0       0     0.0     0.0
           uhci0,in          0     0.0       0       0     0.0     0.0
           uhci0,is          0     0.0       0       0     0.0     0.0
           uhci0,to          0     0.0       0       0     0.0     0.0

Average    cmdk0             0     0.0       1      18     0.0     2.4
           fd0               0     0.0       0       0     0.0     0.0
           nfs1              0     0.0       0       0     0.0     0.0
           nfs2              0     0.0       0       0     0.0     0.0
           sd0               0     0.0       0       0     0.0     0.0
           uhci0,bu          0     0.0       0       0     0.0     0.0
           uhci0,ct          0     0.0       0       0     0.0     0.0
           uhci0,in          0     0.0       0       0     0.0     0.0
           uhci0,is          0     0.0       0       0     0.0     0.0
           uhci0,to          0     0.0       0       0     0.0     0.0
# sar -g 10 3                                                           -- 메모리와 page-in 점검...
SunOS yasicom 5.8 Generic_108529-09 i86pc    12/03/01
01:29:54  pgout/s ppgout/s pgfree/s pgscan/s %ufs_ipf                    
-- pgscan/s는 초당 페이지수인데...이 값이 높으면 가용 메모리 부족한 상태
01:30:04     0.90     1.80     1.80     0.00     0.00
01:30:14     0.90     1.80     1.80     0.00     0.00
01:30:24     0.90     1.80     1.80     0.00     0.00
Average      0.90     1.80     1.80     0.00     0.00
#
#
#
-- runq-sz는 메모리 상에서 대기중인 프로세스 쓰레드 수를 나타내며, 계속해서 2 이상을 나타내면 cpu가 한계치에 다다른 것으로 판단
-- %runocc는 어떤 run queue가 할당되었는지 나타낸 것으로 숫자가 적을 수록 우선 순위가 높다
# sar -r 10 3        -- 프로세스 점검         
SunOS yasicom 5.8 Generic_108529-09 i86pc    12/03/01
01:31:57 freemem freeswap
01:32:07     608   652136
01:32:17     606   652136
01:32:27     606   652136
Average      607   652136
# sar -r 10 3                              -- 가용 메모리와 swa3-file disk block
SunOS yasicom 5.8 Generic_108529-09 i86pc    12/03/01
01:34:32 freemem freeswap
01:34:42     610   652136
01:34:52     621   652136
01:35:02     622   652131
Average      617   652134                      
-- 가용 메모리가 인스톨된 메모리의 6% 보다 계속해서 작으면 가용 메모리가 부족한 경우로 잠재적인 병목현상
=============================================================================================
다음은 네트웍에 관련된 성능 측정입니다...
두가지 명령어를 살펴보겠습니다...
먼저 각 네트웍 인터페이스의 전송 상태를 알 수 있는 명령어로 netstat 명령이 있습니다..
옵션으로 -i 를 사용하면 tcp/ip 트래픽에 있어서 각 인터페이스의 패킷 사용량 상태를 확인 할 수 있습니다..
아래를 실행한 것을 보면..
Collision Rate = collis/opkts = 0/675407 = 0
이 수치가 5% ~ 10%에 가까워지면 네트웍에 오버로드가 초래된 것이라고 볼 수 있습니다..
Input packet Error Rate = ierrs/Ipkts
Ouput Packet Error Rate = Oerrs/Opkts
Input Packet Error Rate가 0.25% 보다 크게되면 시스템은 패킷을 드롭하게 됩니다..
=============================================================================
# netstat -i 5
    input   elxl0     output           input  (Total)    output
packets errs  packets errs  colls  packets errs  packets errs  colls
1553181 6     675370  0     0      2862401 6     1984590 0     0
11      0     1       0     0      21      0     11      0     0
10      0     2       0     0      20      0     12      0     0
10      0     2       0     0      20      0     12      0     0
12      0     2       0     0      22      0     12      0     0
10      0     2       0     0      22      0     14      0     0
10      0     2       0     0      20      0     12      0     0
9       0     2       0     0      19      0     12      0     0
7       0     2       0     0      17      0     12      0     0
10      0     3       0     0      20      0     13      0     0
8       0     2       0     0      16      0     10      0     0
                                 .
                                 .
                                 .
                                 .
                                 .
                                 .
# netstat -i
Name  Mtu  Net/Dest      Address        Ipkts  Ierrs Opkts  Oerrs Collis Queue
lo0   8232 loopback      localhost      1309340 0     1309340 0     0      0
elxl0 1500 192.168.0.0   yasicom        1553317 6     675407 0     0      0
Name  Mtu  Net/Dest                    Address                     Ipkts  Ierrs Opkts  Oerrs Collis
lo0   8252 localhost                   localhost                   1309340 0     1309340 0     0
elxl0 1500 fe80::201:2ff:fe7d:3cb4/10  fe80::201:2ff:fe7d:3cb4     1553320 6     675410 0     0
=============================================================================================
두번째 네트웍에 관련된 성능측정 명령어로 snoop이 있습니다..
이것은 네트웍에서 패킷을 캡처하는데 사용하며, 모든 각 클라이언트와 서버간의 coll trace를 담을 수 있습니다..
다음은 이 명령어를 이용해서 네트웍에 패킷을 특정 파일에 보관하고, 다시 그 파일에 저장된 내용을 확인하는 예입니다.
=============================================================================================
# snoop -o /tmp/a
Using device /dev/elxl (promiscuous mode)
20 ^C
# snoop -i /tmp/a
  1   0.00000  192.168.0.1 -> yasicom      TELNET C port=3565
  2   0.00023      yasicom -> 192.168.0.1  TELNET R port=3565 Using device /dev/el
  3   0.15040  192.168.0.1 -> 192.168.0.255 UDP D=39213 S=3516 LEN=832
  4   0.04999  192.168.0.1 -> yasicom      TELNET C port=3565
  5   0.79813      yasicom -> 192.168.0.1  TELNET R port=3565
  6   0.10485  192.168.0.1 -> yasicom      TELNET C port=3565
  7   0.00020      yasicom -> 192.168.0.1  TELNET R port=3565
  8   0.20046  192.168.0.1 -> yasicom      TELNET C port=3565
  9   0.06794  192.168.0.1 -> 192.168.0.255 UDP D=39213 S=3517 LEN=276
 10   0.00068  192.168.0.1 -> 192.168.0.255 UDP D=39213 S=3518 LEN=120
 11   0.62573      yasicom -> 192.168.0.1  TELNET R port=3565
 12   0.10825  192.168.0.1 -> yasicom      TELNET C port=3565
 13   0.00021      yasicom -> 192.168.0.1  TELNET R port=3565
 14   0.20042  192.168.0.1 -> yasicom      TELNET C port=3565
 15   0.69107      yasicom -> 192.168.0.1  TELNET R port=3565 \r\00011
 16   0.11157  192.168.0.1 -> yasicom      TELNET C port=3565
 17   0.00020      yasicom -> 192.168.0.1  TELNET R port=3565 \r\00012 \r\00013 \r\00014
 18   0.09619  192.168.0.1 -> 192.168.0.255 UDP D=39213 S=3519 LEN=832
 19   0.10424  192.168.0.1 -> yasicom      TELNET C port=3565
 20   0.50641  192.168.0.1 -> 192.168.0.255 UDP D=39213 S=3520 LEN=276
====================================================================
이제 툴하나만 소개하고...솔라리스에 대한 정리는 끝납니다..헐헐~
마지막으로 소개할 툴은 모냐면...
sdtprocess라는 툴입니다..이 툴은 CDE 환경에서 사용하는 성능 측정 툴입니다...
역쉬...GUI툴이기 때문에 마우스로 또각또각 찍어가면서 툴의 사용법을 익히시기 바랍니다..
글고....프리웨어로 웹에서 top 이란 툴을 제공하고 있습니다..
www.sunfreeware.com에 가시면...있습니다..
각자 OS 버전에 맞는 것으로 다운 받으셔서...pkgadd 하여 설치하시기 바랍니다...

Solaris7 에서 SSH(openssh) 설치

Posted 2009. 2. 17. 11:47


밑에 보시면 Solaris 8 에서 설치하는 글이 있는데 또 적는 이유는  Solaris 8에서 조금 더 수정 및 추가가 되어야 하는 부분이 있어서 이렇게 다시 적습니다. (2009.01.23)

환경 : Solaris7 SPARC


1. SSH 설치에 필요한 Package 다운로드

http://sunfreeware.com  에서 접속하여 오른쪽에 있는 Solaris7 x86, Solaris8 SPARC 중 해당 시스템 사항에 맞추어서 클릭하여  아래에 적힌 목록들을 다운

egd-0.8-sol7-sparc-local
gcc-3.4.6-sol7-sparc-local.gz
libgcc-3.4.6-sol7-sparc-local.gz
openssh-5.1p1-sol7-sparc-local.gz
openssl-0.9.8i-sol7-sparc-local.gz
perl-5.8.8-sol7-sparc-local
prngd-0.9.25-sol7-sparc-local.gz
tcp_wrappers-7.6-sol7-sparc-local.gz
zlib-1.2.3-sol7-sparc-local.gz

위에 리스트중에 이미 설치되어있는것은 생략하셔도 됩니다.
혹시 이 버젼보다 상위 버젼이 나왔다면 그것을 받아서 설치하셔도 됩니다.



2. Package 압축 해제 및 설치

위의 파일들은 모두 패키지 형식이기 때문에 gzip으로 압축만 풀고 간단한 명령어가 치면 자동으로

설치 됩니다.

예) #  gzip -d openssh-5.1p1-sol7-sparc-local.gz   

이렇게 모두 압축을 풀어주세요

압축을 풀게 되면 openssh-5.1p1-sol7-sparc-local 이렇게만 남습니다.


그다음 패키지를 풀면됩니다.


예) # pkgadd -d openssh-5.1p1-sol7-sparc-local

The following packages are available:
  1  SMCosh511     openssh
                   (sparc) 5.1p1

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all

Processing package instance <SMCosh511> from </home/kuma/openssh-5.1p1-sol7-sparc-local>

openssh
(sparc) 5.1p1
The OpenSSH Group
Using </usr/local> as the package base directory.
## Processing package information.
## Processing system information.
   6 package pathnames are already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

Installing openssh as <SMCosh511>

## Installing part 1 of 1.
/usr/local/bin/scp
/usr/local/bin/sftp
/usr/local/bin/slogin <symbolic link>
/usr/local/bin/ssh
/usr/local/bin/ssh-add
/usr/local/bin/ssh-agent
/usr/local/bin/ssh-keygen
/usr/local/bin/ssh-keyscan
/usr/local/doc/openssh/CREDITS
/usr/local/doc/openssh/ChangeLog
/usr/local/doc/openssh/INSTALL
/usr/local/doc/openssh/LICENCE
/usr/local/doc/openssh/OVERVIEW
/usr/local/doc/openssh/README
/usr/local/doc/openssh/README.dns
/usr/local/doc/openssh/README.platform
/usr/local/doc/openssh/README.privsep
/usr/local/doc/openssh/README.smartcard
/usr/local/doc/openssh/README.tun
/usr/local/doc/openssh/TODO
/usr/local/doc/openssh/WARNING.RNG
/usr/local/doc/openssh/contrib/Makefile
/usr/local/doc/openssh/contrib/README
/usr/local/doc/openssh/contrib/aix/README
/usr/local/doc/openssh/contrib/aix/buildbff.sh
/usr/local/doc/openssh/contrib/aix/inventory.sh
/usr/local/doc/openssh/contrib/aix/pam.conf
/usr/local/doc/openssh/contrib/caldera/openssh.spec
/usr/local/doc/openssh/contrib/caldera/ssh-host-keygen
/usr/local/doc/openssh/contrib/caldera/sshd.init
/usr/local/doc/openssh/contrib/caldera/sshd.pam
/usr/local/doc/openssh/contrib/cygwin/Makefile
/usr/local/doc/openssh/contrib/cygwin/README
/usr/local/doc/openssh/contrib/cygwin/ssh-host-config
/usr/local/doc/openssh/contrib/cygwin/ssh-user-config
/usr/local/doc/openssh/contrib/cygwin/sshd-inetd
/usr/local/doc/openssh/contrib/findssl.sh
/usr/local/doc/openssh/contrib/gnome-ssh-askpass1.c
/usr/local/doc/openssh/contrib/gnome-ssh-askpass2.c
/usr/local/doc/openssh/contrib/hpux/README
/usr/local/doc/openssh/contrib/hpux/egd
/usr/local/doc/openssh/contrib/hpux/egd.rc
/usr/local/doc/openssh/contrib/hpux/sshd
/usr/local/doc/openssh/contrib/hpux/sshd.rc
/usr/local/doc/openssh/contrib/redhat/gnome-ssh-askpass.csh
/usr/local/doc/openssh/contrib/redhat/gnome-ssh-askpass.sh
/usr/local/doc/openssh/contrib/redhat/openssh.spec
/usr/local/doc/openssh/contrib/redhat/sshd.init
/usr/local/doc/openssh/contrib/redhat/sshd.init.old
/usr/local/doc/openssh/contrib/redhat/sshd.pam
/usr/local/doc/openssh/contrib/redhat/sshd.pam.old
/usr/local/doc/openssh/contrib/solaris/README
/usr/local/doc/openssh/contrib/ssh-copy-id
/usr/local/doc/openssh/contrib/ssh-copy-id.1
/usr/local/doc/openssh/contrib/sshd.pam.freebsd
/usr/local/doc/openssh/contrib/sshd.pam.generic
/usr/local/doc/openssh/contrib/suse/openssh.spec
/usr/local/doc/openssh/contrib/suse/rc.config.sshd
/usr/local/doc/openssh/contrib/suse/rc.sshd
/usr/local/doc/openssh/contrib/suse/sysconfig.ssh
/usr/local/etc/moduli
/usr/local/etc/ssh_config
/usr/local/etc/sshd_config
/usr/local/libexec/sftp-server
/usr/local/libexec/ssh-keysign
/usr/local/libexec/ssh-rand-helper
/usr/local/sbin/sshd
/usr/local/share/Ssh.bin
/usr/local/share/man/man1/scp.1
/usr/local/share/man/man1/sftp.1
/usr/local/share/man/man1/slogin.1 <symbolic link>
/usr/local/share/man/man1/ssh-add.1
/usr/local/share/man/man1/ssh-agent.1
/usr/local/share/man/man1/ssh-keygen.1
/usr/local/share/man/man1/ssh-keyscan.1
/usr/local/share/man/man1/ssh.1
/usr/local/share/man/man5/ssh_config.5
/usr/local/share/man/man5/sshd_config.5
/usr/local/share/man/man8/sftp-server.8
/usr/local/share/man/man8/ssh-keysign.8
/usr/local/share/man/man8/ssh-rand-helper.8
/usr/local/share/man/man8/sshd.8
[ verifying class <none> ]

Installation of <SMCosh511> was successful.
#

이렇게 위의 리스트에 적혀있는 파일들을 예)를 보시고 설치 하시면 됩니다.



3. SSH 접속 환경 구성

# mkdir /var/empty 

# chown root:sys /var/empty
소유자와 그룹을 root:sys로 변경

# chmod 755 /var/empty
empty 사용 권한은 755(rwxr-xr-x)

# groupadd sshd
그룹 sshd 만들기

# useradd -g sshd -c 'sshd privsep' -d /var/empty -s /bin/false sshd



4. Getting Entropy (Solaris 8버젼 이상에서는 필요가 없는 부분입니다.)

만약 이부분을 하지않고 진행할 경우 ssh-keygen  명령어 사용시 에러가 발생하게 됩니다.

# ssh-keygen -t rsa1 -f /usr/local/etc/ssh_host_key -N ""
PRNG is not seeded

여기 진행부분은 필히 순서를 지켜서 사용하셔야 합니다.

먼저 /var/log or /var/adm 로 이동하세요

# cd /var/log
# cat syslog > /usr/local/etc/prngd/prngd-seed

or

# cd /var/adm
# cat messages > /usr/local/etc/prngd/prngd-seed

# mkdir /var/spool/prngd

# /usr/local/sbin/prngd /var/spool/prngd/pool
이부분이 prngd 실행하는 부분입니다.

# ln -s /var/spool/prngd/pool /dev/egde-pool

그다음 /etc/init.d 디렉토리에서 prngd 파일을 하나 생성해야합니다.

# vi prngd  or   # cat >> prngd

#!/bin/sh

pid=`/usr/bin/ps -e | /usr/bin/grep prngd | /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
case $1 in
'start')
 /usr/local/sbin/prngd /var/spool/prngd/pool
 ;;
'stop')
 if [ "${pid}" != "" ]
 then
  /usr/bin/kill ${pid}
 fi
 ;;
*)
 echo "usage: /etc/init.d/prngd {start|stop}"
 ;;
esac

이 파일은 제가 첨부파일로 올려놓겠습니다.




# chown root:sys /etc/init.d/prngd
prngd 파일의 소유자 및 그룹을  root:sys 로 변경

# chmod 755 /etc/init.d/prngd
prngd 파일의 권한을 755 (r-xr-xr-x)

# ln -s /etc/init.d/prngd /etc/rc2.d/S99prngd

이렇게 하시면 Server Reboot 데몬이 자동 실행되어 가동이 됩니다.




5. Tcp_Wrapper 설정

# vi /etc/hosts.allow
sshd : All    (추가)

# vi /etc/hosts.deny
Server로 접근 못하게 할 IP 등을 넣어시면 됩니다.

위 두부분은 파일만 만들어 놓고 나중에 추가 사항들을 추가 하시는게 좋을것 같습니다. 만약 원격으로 하실 경우 직접 서버가 있는 곳까지 가야할 상황이 생길 수 있으니까요.



6. SSH 사용을 위한 암호키 생성

먼저 PATH에 /usr/local/bin 과 /usr/local/sbin 이 등록되어 있어야 명령어를 실행하실 수 있습니다.

# ssh-keygen -t rsa1 -f /usr/local/etc/ssh_host_key -N ""
# ssh-keygen -t dsa -f /usr/local/etc/ssh_host_dsa_key -N ""
# ssh-keygen -t rsa -f /usr/local/etc/ssh_host_rsa_key -N ""

이렇게 하시면

예) # ssh-keygen -t rsa1 -f /usr/local/etc/ssh_host_key -N ""

Generating public/private rsa1 key pair.
Your identification has been saved in /usr/local/etc/ssh_host_key.
Your public key has been saved in /usr/local/etc/ssh_host_key.pub.
The key fingerprint is:
4f:00:d4:cc:c8:b2:7e:41:6e:3d:5d:c5:d0:52:17:cc root@unknown
The key's randomart image is:
+--[RSA1 2048]----+
|       oo=        .*=.o|
|        . +.+     o oE |
|               = ... . .  |
|            . + o.. .    |
|      .  .  .S..  ..     |
|    .    .  o          . |
|     .    .               |
|                          |
|                          |
+-----------------+
bash-2.03#

이런 형식의 내용을 화면에 뿌려줍니다.  만들어진 파일은 /usr/local/etc/ 안에 있습니다.



7. sshd Daemon Script 작성

# vi /etc/init.d/sshd

#!/bin/sh

pid=`/usr/bin/ps -e | /usr/bin/grep sshd | /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
case $1 in
'start')
/usr/local/sbin/sshd
;;
'stop')
if [ "${pid}" != "" ]
then
/usr/bin/kill ${pid}
fi
;;
*)
echo "usage: /etc/init.d/sshd {start|stop}"
;;
esac


혹은

case "$1" in

'start')
     # Start the ssh daemon
     if [ -f /usr/local/sbin/sshd ]; then
          echo "starting SSHD daemon"
          /usr/local/sbin/sshd &
     fi
     ;;

'stop')
     # Stop the ssh deamon
     PID=`/usr/bin/ps -e -u 0 | /usr/bin/fgrep sshd | /usr/bin/awk '{print $1}'`
     if [ ! -z "$PID" ] ; then
          /usr/bin/kill ${PID} >/dev/null 2>&1
     fi
     ;;

*)
     echo "usage: /etc/init.d/sshd {start|stop}"
     ;;

esac
exit 0

둘중에 하나를 작성하시면 됩니다.
제가 사용하는 파일을 첨부파일로 올리겠습니다.



# chown root:sys /etc/init.d/sshd
sshd 파일의 소유자 및 그룹을  root:sys 로 변경

# chmod 755 /etc/init.d/sshd
sshd 파일의 권한을 755 (r-xr-xr-x)

# cat >> /etc/rc2.d/S99sshd
/etc/init.d/sshd start
Ctrl + C <- 이거 아시죠? 빠져나오기.. ^^

# chome 744 /etc/rc2.d/S99sshd
sshd 파일의 권한을 744 (rwxr--r--)

이렇게 하시면 Server Reboot 데몬이 자동 실행되어 가동이 됩니다.



8. SSH, PRNGD 실행 및 가동여부 확인

# /etc/init.d/prngd start

# /etc/init.d/prngd stop

# ps -ef | grep prngd
    root 20381     1  0 16:18:33 ?        0:00 /usr/local/sbin/prngd /var/spool/prngd/pool

데몬이 제대로 올라오는지 확인.


# /etc/rc2.d/S99sshd
starting SSHD daemon

# ps -ef | grep sshd
    root   478     1  0 16:16:27 ?        0:02 /usr/local/sbin/sshd

이렇게 띄워져 있다면 실행되고 있습니다.

해 보시고 문제가 있다면 댓글을 남겨주세요~!

Solaris8 SSH 설치

Posted 2009. 2. 17. 11:38


현재 제가 설치하는 것을 토대로 해서 적겠습니다. (2008.11.27)

환경 : Solaris8 SPARC
          bash 쉘


1. SSH 설치에 필요한 Package 다운로드

http://sunfreeware.com  에서 접속하여 오른쪽에 있는 Solaris8 x86, Solaris8 SPARC 중 해당 시스템 사항에 맞추어서 클릭하여  아래에 적힌 목록들을 다운

gcc-3.4.6-sol8-sparc-local.gz
libgcc-3.4.6-sol8-sparc-local.gz
openssh-5.1p1-sol8-sparc-local.gz
openssl-0.9.8i-sol8-sparc-local.gz
prngd-0.9.25-sol8-sparc-local.gz
tcp_wrappers-7.6-sol8-sparc-local.gz
zlib-1.2.3-sol8-sparc-local.gz

위에 리스트중에 이미 설치되어있는것은 생략하셔도 됩니다.
혹시 이 버젼보다 상위 버젼이 나왔다면 그것을 받아서 설치하셔도 됩니다.



2. Package 압축 해제 및 설치

위의 파일들은 모두 패키지 형식이기 때문에 gzip으로 압축만 풀고 간단한 명령어가 치면 자동으로

설치 됩니다.

예) bash-2.03#  gzip -d openssh-5.1p1-sol8-sparc-local.gz   

아~ 위에서 bash-2.03#  이부분은 제가 bash 쉘 환경으로 작업하는거니 착오 없으시길 바랍니다.

이렇게 모두 압축을 풀어주세요

압축을 풀게 되면 openssh-5.1p1-sol8-sparc-local 이렇게만 남습니다.


그다음 패키지를 풀면됩니다.


예) bash-2.03# pkgadd -d openssh-5.1p1-sol8-sparc-local

The following packages are available:
  1  SMCosh511     openssh
                   (sparc) 5.1p1

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all

Processing package instance <SMCosh511> from </down/ssh/openssh-5.1p1-sol8-sparc-local>

openssh
(sparc) 5.1p1
The OpenSSH Group
Using </usr/local> as the package base directory.
## Processing package information.
## Processing system information.
   4 package pathnames are already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

Installing openssh as <SMCosh511>

## Installing part 1 of 1.
/usr/local/bin/scp
/usr/local/bin/sftp
/usr/local/bin/slogin <symbolic link>
/usr/local/bin/ssh
/usr/local/bin/ssh-add
/usr/local/bin/ssh-agent
/usr/local/bin/ssh-keygen
/usr/local/bin/ssh-keyscan
/usr/local/doc/openssh/CREDITS
/usr/local/doc/openssh/ChangeLog
/usr/local/doc/openssh/INSTALL
/usr/local/doc/openssh/LICENCE
/usr/local/doc/openssh/OVERVIEW
/usr/local/doc/openssh/README
/usr/local/doc/openssh/README.dns
/usr/local/doc/openssh/README.platform
/usr/local/doc/openssh/README.privsep
/usr/local/doc/openssh/README.smartcard
/usr/local/doc/openssh/README.tun
/usr/local/doc/openssh/TODO
/usr/local/doc/openssh/WARNING.RNG
/usr/local/doc/openssh/contrib/Makefile
/usr/local/doc/openssh/contrib/README
/usr/local/doc/openssh/contrib/aix/README
/usr/local/doc/openssh/contrib/aix/buildbff.sh
/usr/local/doc/openssh/contrib/aix/inventory.sh
/usr/local/doc/openssh/contrib/aix/pam.conf
/usr/local/doc/openssh/contrib/caldera/openssh.spec
/usr/local/doc/openssh/contrib/caldera/ssh-host-keygen
/usr/local/doc/openssh/contrib/caldera/sshd.init
/usr/local/doc/openssh/contrib/caldera/sshd.pam
/usr/local/doc/openssh/contrib/cygwin/Makefile
/usr/local/doc/openssh/contrib/cygwin/README
/usr/local/doc/openssh/contrib/cygwin/ssh-host-config
/usr/local/doc/openssh/contrib/cygwin/ssh-user-config
/usr/local/doc/openssh/contrib/cygwin/sshd-inetd
/usr/local/doc/openssh/contrib/findssl.sh
/usr/local/doc/openssh/contrib/gnome-ssh-askpass1.c
/usr/local/doc/openssh/contrib/gnome-ssh-askpass2.c
/usr/local/doc/openssh/contrib/hpux/README
/usr/local/doc/openssh/contrib/hpux/egd
/usr/local/doc/openssh/contrib/hpux/egd.rc
/usr/local/doc/openssh/contrib/hpux/sshd
/usr/local/doc/openssh/contrib/hpux/sshd.rc
/usr/local/doc/openssh/contrib/redhat/gnome-ssh-askpass.csh
/usr/local/doc/openssh/contrib/redhat/gnome-ssh-askpass.sh
/usr/local/doc/openssh/contrib/redhat/openssh.spec
/usr/local/doc/openssh/contrib/redhat/sshd.init
/usr/local/doc/openssh/contrib/redhat/sshd.init.old
/usr/local/doc/openssh/contrib/redhat/sshd.pam
/usr/local/doc/openssh/contrib/redhat/sshd.pam.old
/usr/local/doc/openssh/contrib/solaris/README
/usr/local/doc/openssh/contrib/ssh-copy-id
/usr/local/doc/openssh/contrib/ssh-copy-id.1
/usr/local/doc/openssh/contrib/sshd.pam.freebsd
/usr/local/doc/openssh/contrib/sshd.pam.generic
/usr/local/doc/openssh/contrib/suse/openssh.spec
/usr/local/doc/openssh/contrib/suse/rc.config.sshd
/usr/local/doc/openssh/contrib/suse/rc.sshd
/usr/local/doc/openssh/contrib/suse/sysconfig.ssh
/usr/local/etc/moduli
/usr/local/etc/ssh_config
/usr/local/etc/sshd_config
/usr/local/libexec/sftp-server
/usr/local/libexec/ssh-keysign
/usr/local/libexec/ssh-rand-helper
/usr/local/sbin/sshd
/usr/local/share/Ssh.bin
/usr/local/share/man/man1/scp.1
/usr/local/share/man/man1/sftp.1
/usr/local/share/man/man1/slogin.1 <symbolic link>
/usr/local/share/man/man1/ssh-add.1
/usr/local/share/man/man1/ssh-agent.1
/usr/local/share/man/man1/ssh-keygen.1
/usr/local/share/man/man1/ssh-keyscan.1
/usr/local/share/man/man1/ssh.1
/usr/local/share/man/man5/ssh_config.5
/usr/local/share/man/man5/sshd_config.5
/usr/local/share/man/man8/sftp-server.8
/usr/local/share/man/man8/ssh-keysign.8
/usr/local/share/man/man8/ssh-rand-helper.8
/usr/local/share/man/man8/sshd.8
[ verifying class <none> ]

Installation of <SMCosh511> was successful.

bash-2.03#

이렇게 위의 리스트에 적혀있는 파일들을 예)를 보시고 설치 하시면 됩니다.



3. SSH 접속 환경 구성

# mkdir /var/empty 

# chown root:sys /var/empty
소유자와 그룹을 root:sys로 변경

# chmod 755 /var/empty
empty 사용 권한은 755(rwxr-xr-x)

# groupadd sshd
그룹 sshd 만들기

# useradd -g sshd -c 'sshd privsep' -d /var/empty -s /bin/false sshd



4. Tcp_Wrapper 설정

# vi /etc/hosts.allow
sshd : All    (추가)

# vi /etc/hosts.deny
Server로 접근 못하게 할 IP 등을 넣어시면 됩니다.

위 두부분은 파일만 만들어 놓고 나중에 추가 사항들을 추가 하시는게 좋을것 같습니다. 만약 원격으로 하실 경우 직접 서버가 있는 곳까지 가야할 상황이 생길 수 있으니까요.



5. SSH 사용을 위한 암호키 생성

먼저 PATH에 /usr/local/bin 과 /usr/local/sbin 이 등록되어 있어야 명령어를 실행하실 수 있습니다.

# ssh-keygen -t rsa1 -f /usr/local/etc/ssh_host_key -N ""
# ssh-keygen -t dsa -f /usr/local/etc/ssh_host_dsa_key -N ""
# ssh-keygen -t rsa -f /usr/local/etc/ssh_host_rsa_key -N ""

이렇게 하시면

예) # ssh-keygen -t rsa1 -f /usr/local/etc/ssh_host_key -N ""

Generating public/private rsa1 key pair.
Your identification has been saved in /usr/local/etc/ssh_host_key.
Your public key has been saved in /usr/local/etc/ssh_host_key.pub.
The key fingerprint is:
4f:00:d4:cc:c8:b2:7e:41:6e:3d:5d:c5:d0:52:17:cc root@unknown
The key's randomart image is:
+--[RSA1 2048]----+
|       oo=        .*=.o|
|        . +.+     o oE |
|               = ... . .  |
|            . + o.. .    |
|      .  .  .S..  ..     |
|    .    .  o          . |
|     .    .               |
|                          |
|                          |
+-----------------+
bash-2.03#

이런 형식의 내용을 화면에 뿌려줍니다.  만들어진 파일은 /usr/local/etc/ 안에 있습니다.



6. sshd Daemon Script 작성

# vi /etc/init.d/sshd

#!/bin/sh

pid=`/usr/bin/ps -e | /usr/bin/grep sshd | /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
case $1 in
'start')
/usr/local/sbin/sshd
;;
'stop')
if [ "${pid}" != "" ]
then
/usr/bin/kill ${pid}
fi
;;
*)
echo "usage: /etc/init.d/sshd {start|stop}"
;;
esac


혹은

case "$1" in

'start')
     # Start the ssh daemon
     if [ -f /usr/local/sbin/sshd ]; then
          echo "starting SSHD daemon"
          /usr/local/sbin/sshd &
     fi
     ;;

'stop')
     # Stop the ssh deamon
     PID=`/usr/bin/ps -e -u 0 | /usr/bin/fgrep sshd | /usr/bin/awk '{print $1}'`
     if [ ! -z "$PID" ] ; then
          /usr/bin/kill ${PID} >/dev/null 2>&1
     fi
     ;;

*)
     echo "usage: /etc/init.d/sshd {start|stop}"
     ;;

esac
exit 0

둘중에 하나를 작성하시면 됩니다.

# chown root:sys /etc/init.d/sshd
sshd 파일의 소유자 및 그룹을  root:sys 로 변경

# chmod 555 /etc/init.d/sshd
sshd 파일의 권한을 555 (r-xr-xr-x)

# cat >> /etc/rc2.d/S99sshd
/etc/init.d/sshd start
Ctrl + C <- 이거 아시죠? 빠져나오기.. ^^

# chome 744 /etc/rc2.d/S99sshd
sshd 파일의 권한을 744 (rwxr--r--)

이렇게 하시면 Server Reboot 데몬이 자동 실행되어 가동이 됩니다.



7. SSH 실행 및 가동여부 확인

# /etc/rc2.d/S99sshd
starting SSHD daemon

# ps -ef | grep sshd
    root   478     1  0 16:16:27 ?        0:02 /usr/local/sbin/sshd

이렇게 띄워져 있다면 실행되고 있습니다.

해 보시고 문제가 있다면 댓글을 남겨주세요~!

« PREV : 1 : 2 : 3 : 4 : 5 : NEXT »