Archive for the ‘Solaris’ Category
LACP di Solaris 10
LACP merupakan singkatan dari Link Aggregation Control Protocol, fungsi dari LACP ini memungkinkan penggabungan multiple interface jaringan / network interface / LAN card untuk bekerja secara bersamaan sehingga bandwidth yang dihasilkan akan lebih besar dan juga terdapat redundansinya. LACP ini mirip seperti IPMP (IP Multipathing) meskipun IPMP boros IP address dan bisa menyebabkan permasalahaan saat menjalankan remote SSH. Sedangkan IP LACP hanya membutuhkan 1 IP address, dan kamu harus memastikan bahwa switch yang kamu gunakan support LACP. Pada contoh dibawah ini kita menggunakan metode IP-hashing dan kamu atur switchnya untuk IP-hashing/Layer 3 hashing.
Untuk membuat aggregate ini, lakukan langkah berikut ini :
# dladm create-aggr -1 active -PL3 -d e1000g0 -d e1000g1 1
# ifonfig aggr1 plumb
# ifconfig aggr1 192.168.0.1 netmask 255.255.255.0 up
Untuk menghapus aggregat :
# dladm delete-aggr 1
Untuk menghapus interface :
# dladm remove-aggr -d e1000g1 1
Pengamanan Server dengan IP Filter
Untuk mengamankan sistem terutama di Solaris 10, kita bisa menggunakan IP Filter yang cukup handal untuk dijadikan sebagai firewall. IP Filter merupakan host-based firewall technology yang bekerja pada layer kernel sistem operasi. Dengan IP Filter, kita bisa membatasi akses ke server dan akses ke network service.
Berikut konfigurasi yang saya terapkan di server :
- cek minimal paket yang sudah terinstall : SUNWipfr & SUNWipfu
# pkginfo | grep “IP Filter”
system SUNWipfh IP Filter header files
system SUNWipfr IP Filter utilities, (Root)
system SUNWipfu IP Filter utilities, (Usr)
- cek service pfil dan ipfilter, pfil untuk menentukan interface mana yang akan difilter
# svcs network/pfil
STATE STIME FMRI
online 9:19:58 svc:/network/pfil:default
# svcs network/ipfilter
STATE STIME FMRI
online 9:20:25 svc:/network/ipfilter:default
- buat file baru di /etc/pfil/pfil.ap dan tentukan eth mana yang akan difilter
# more /etc/pfil/pfil.ap
#IP Filter pfil autopush setup
#
# See autopush(1M) manpage for more information.
#
# Format of the entries in this file is:
#
#major minor lastminor modules#le -1 0 pfil
#qe -1 0 pfil
#hme -1 0 pfil
#qfe -1 0 pfil
#eri -1 0 pfil
#ce -1 0 pfil
#bge -1 0 pfil
#be -1 0 pfil
#vge -1 0 pfil
#ge -1 0 pfil
#nf -1 0 pfil
#fa -1 0 pfil
#ci -1 0 pfil
#el -1 0 pfil
#ipdptp -1 0 pfil
#lane -1 0 pfil
#dmfe -1 0 pfil
rtls0 -1 0 pfil
- edit file di /etc/ipf/ipf.conf buat naruh rules-nya.
# vi /etc/ipf/ipf.conf
#
# ipf.conf
#
# IP Filter rules to be loaded during startup
#
# See ipf(4) manpage for more information on
# IP Filter rules syntax.
# ———————————————————————- #
# Untuk mengijinkan loopback interfaces
pass in quick on lo0 all
pass out quick on lo0 all# Untuk mengijinkan semua traffic yang out dari server
pass out quick all keep state# Untuk mengijinkan akses ssh dari port 2222
pass in quick proto tcp from 10.14.0.0/16 to any port = 2222 keep state# Untuk mengijinkn akses http pada port 80 dari semua network
pass in quick proto tcp from any to any port = 80 keep state# Untuk mengijinkan paket ICMP atau ping
pass in quick proto icmp from 10.14.0.0/16 to any icmp-type 8# Untuk nge-block semua traffic yang tidak diinginkan
block in log all# ———————————————————————- #
- reboot server
# reboot
- cek statistic dg ipfstats
# ipfstat
bad packets: in 0 out 0
IPv6 packets: in 0 out 0
input packets: blocked 73913 passed 3505 nomatch 0 counted 0 short 0
output packets: blocked 0 passed 3409 nomatch 2035 counted 0 short 0
input packets logged: blocked 73913 passed 0
output packets logged: blocked 0 passed 0
packets logged: input 0 output 0
log failures: input 4785 output 0
fragment state(in): kept 0 lost 0 not fragmented 0
fragment state(out): kept 0 lost 0 not fragmented 0
packet state(in): kept 37 lost 16
packet state(out): kept 2 lost 2035
ICMP replies: 0 TCP RSTs sent: 0
Invalid source(in): 0
Result cache hits(in): 0 (out): 0
IN Pullups succeeded: 0 failed: 0
OUT Pullups succeeded: 0 failed: 0
Fastroute successes: 0 failures: 0
TCP cksum fails(in): 0 (out): 0
IPF Ticks: 8496
Packet log flags set: (0)
none
- cek lebih detail per rules
# ipfstat -h -i
0 pass in quick on lo0 all
2 pass in quick proto tcp from 10.14.0.0/16 to any port = 2222 keep state
51 pass in quick proto tcp from any to any port = 80 keep state
2037 pass in quick proto icmp from 10.14.0.0/16 to any icmp-type echo
75197 block in log all
- sekarang kita nmap dari komputer lain :
# nmap -sS -T4 10.14.206.x
Starting Nmap 4.20 ( http://insecure.org ) at 2009-08-30 14:22 WIT
Interesting ports on 10.14.206.x:
Not shown: 1696 filtered ports
PORT STATE SERVICE
80/tcp open http
MAC Address: 00:13:D4:13:C4:D7 (Asustek Computer)Nmap finished: 1 IP address (1 host up) scanned in 29.402 seconds
dladm – Menampilkan Status, Speed, Duplex, Statistic, MTU Link
dladm adalah utiliti admin untuk data-link interface / network interface, yang membantu admin untuk mengetahui status link (UP/DOWN) , speed, MTU, duplex, statistic network interface secara real time pada masing network interface. Berikut ini adalah contoh penggunaan dladm command.
Menampilkan Status/Speed/Duplex suatu Link
# dladm show-dev
Menampilkan Status Link
# dladm show-link
Menampilkan Statistic real-time
# dladm show-dev -s -i 5
Menampilkan Statistic total
# dladm show-dev -s
Visualisasi IP Filter dan PF list
IP Filter merupakan firewall yang dipakai oleh Solaris. Untuk menampilkan statistik paket yang difilter, bisa menggunakan command ipfstat. Hasil output ini berasal dari akumulasi paket yang di filter oleh kernel.
solaris – IP Filter: v4.1.9 – state top 08:42:17
Src: 0.0.0.0, Dest: 0.0.0.0, Proto: any, Sorted by: # bytes
Source IP Destination IP ST PR #pkts #bytes ttl
10.14.209.32,3214 10.14.206.13,80 5/5 tcp 273370 12586933 80:05:47
10.14.208.23,1320 10.14.206.13,80 0/5 tcp 207000 9106344 41:39:50
10.14.208.23,1457 10.14.206.13,80 0/5 tcp 149568 6392159 44:03:26
10.14.200.84,49314 10.14.206.13,80 5/5 tcp 107208 4866132 75:04:21
10.14.208.23,1601 10.14.206.13,80 0/5 tcp 111145 4828458 44:27:38
10.14.208.23,1709 10.14.206.13,80 0/5 tcp 88419 3968923 27:42:07
10.14.205.17,3268 10.14.206.13,80 5/5 tcp 78403 3685166 53:48:33
10.14.205.17,3266 10.14.206.13,80 5/5 tcp 77096 3616934 53:47:39
10.14.208.23,1127 10.14.206.13,80 5/5 tcp 79538 3576975 1:04:01
10.14.208.23,1124 10.14.206.13,80 5/5 tcp 79213 3547978 1:02:36
10.14.200.81,1351 10.14.206.13,80 5/5 tcp 73025 3503442 85:36:04
10.14.200.84,49315 10.14.206.13,80 5/5 tcp 77004 3479009 75:03:18
10.14.205.17,3652 10.14.206.13,80 5/5 tcp 64679 3048409 53:47:34
10.14.208.61,45299 10.14.206.13,80 5/5 tcp 53772 3020717 99:51:53
10.14.208.61,45320 10.14.206.13,80 5/5 tcp 51771 2917694 99:51:49
10.14.208.23,1458 10.14.206.13,80 0/5 tcp 67798 2887281 43:44:30
10.14.208.61,45321 10.14.206.13,80 5/5 tcp 43892 2467482 99:51:47
10.14.208.23,1317 10.14.206.13,80 0/5 tcp 52295 2280132 26:45:11
10.14.208.23,1605 10.14.206.13,80 0/5 tcp 44579 1974644 44:42:42
10.14.200.23,1106 10.14.206.13,80 5/5 tcp 36294 1688046 61:15:34
10.14.206.48,137 10.14.206.255,137 0/0 udp 16314 1272708 1:51
10.14.205.10,4548 10.14.206.13,80 5/5 tcp 26233 1243175 28:45:30
10.14.200.72,49229 10.14.206.13,80 5/5 tcp 24691 1109756 74:13:24
10.14.200.72,49231 10.14.206.13,80 5/5 tcp 20508 915068 74:13:24
10.14.206.14,1077 10.14.206.13,80 5/5 tcp 15974 872927 108:50:12
10.14.206.20,49994 10.14.206.13,80 5/5 tcp 19844 863330 31:42:44
10.14.207.67,1674 10.14.206.13,80 5/5 tcp 17952 850565 79:42:43
10.14.207.67,1673 10.14.206.13,80 5/5 tcp 17013 803089 79:42:04
10.14.209.38,2292 10.14.206.13,80 5/5 tcp 15987 736581 5:04:59
10.14.206.14,1079 10.14.206.13,80 5/5 tcp 13192 716780 108:50:14
10.14.205.10,4604 10.14.206.13,80 5/5 tcp 15032 710942 28:03:04
10.14.206.14,1078 10.14.206.13,80 5/5 tcp 12899 697884 108:50:13
10.14.206.24,4150 10.14.206.13,80 5/5 tcp 12355 679882 87:31:38
10.14.10.33,2103 10.14.206.13,80 5/5 tcp 14361 673547 110:54:52
10.14.206.20,49991 10.14.206.13,80 5/5 tcp 14788 647137 31:42:44
10.14.206.24,4026 10.14.206.13,80 5/5 tcp 11719 643914 87:31:32
10.14.207.70,2594 10.14.206.13,80 5/5 tcp 13554 633645 104:55:46
10.14.206.24,4300 10.14.206.13,80 5/5 tcp 11522 632098 87:31:42
10.14.206.32,1049 10.14.206.13,80 0/5 tcp 12921 562377 118:46:39
10.14.206.20,49992 10.14.206.13,80 5/5 tcp 12107 527802 31:42:44
10.14.207.70,4962 10.14.206.13,80 5/5 tcp 10497 488905 104:29:37
10.14.207.67,1325 10.14.206.13,80 5/5 tcp 10236 485159 78:53:03
10.14.10.33,4096 10.14.206.13,80 5/5 tcp 10169 478540 111:04:38
10.14.200.72,49226 10.14.206.13,80 5/5 tcp 10132 457302 74:13:25
10.14.206.32,1150 10.14.206.13,80 5/5 tcp 9893 442537 120:00:00
10.14.206.32,1151 10.14.206.13,80 6/5 tcp 8883 384561 120:00:00
10.14.207.67,1324 10.14.206.13,80 5/5 tcp 7955 376142 78:53:13
10.14.205.10,1113 10.14.206.13,80 5/5 tcp 7913 374778 27:33:46
10.14.207.67,4064 10.14.206.13,80 5/5 tcp 7910 371409 80:17:50
10.14.10.33,4278 10.14.206.13,80 5/5 tcp 7417 347020 111:20:38
10.14.207.67,2363 10.14.206.13,80 5/5 tcp 6622 310668 81:02:49
10.14.10.33,4223 10.14.206.13,80 5/5 tcp 6600 307564 111:14:40
10.14.207.67,4057 10.14.206.13,80 5/5 tcp 6414 302241 80:17:53
10.14.207.67,1356 10.14.206.13,80 5/5 tcp 5997 286207 78:53:24
10.14.207.67,1085 10.14.206.13,80 5/5 tcp 5818 277241 80:23:53
10.14.206.32,1152 10.14.206.13,80 5/5 tcp 6234 275997 120:00:00
Monitoring File Sistem
Penting bagi seorang administrator OpenSolaris maupun Solaris untuk tahu kondisi file sistemnya, misalnya tahu disk yang tersisa berapa, disk yang bisa digunakan, disuruh ngukur direktori sang bos di /export/home/multimedia, antisipasi kalau kapasitas disk mau abis, dsb…
Nah, untuk melakukan tugas-tugas diatas, minimal ada 2 tool yaitu df, du.
1. df
df ini berfungsi buat menampilkan informasi tentang disk yang digunakan secara detail, free space, total disk, mount, & etc. Ada beberapa option yang digunakan dalam menjalankan perintah ini agar hasil yang di keluarkan mudah dimengerti dan mudah dipahami.
format perintahnya :
df -option resource
# df -a
/ (rpool/ROOT/s10x_u6wos_07b): 5390295 blocks 5390295 files
/devices (/devices ): 0 blocks 0 files
/system/contract (ctfs ): 0 blocks 2147483613 files
/proc (proc ): 0 blocks 7946 files
/etc/mnttab (mnttab ): 0 blocks 0 files
/etc/svc/volatile (swap ): 1065336 blocks 146796 files
/system/object (objfs ): 0 blocks 2147483440 files
/etc/dfs/sharetab (sharefs ): 0 blocks 2147483646 files
/lib/libc.so.1 (/usr/lib/libc/libc_hwcap1.so.1): 5390295 blocks 5390295 files
/dev/fd (fd ): 0 blocks 0 files
/tmp (swap ): 1065336 blocks 146796 files
/var/run (swap ): 1065336 blocks 146796 files
/export (rpool/export ): 5390295 blocks 5390295 files
/export/home (rpool/export/home ): 5390295 blocks 5390295 files
/rpool (rpool ): 5390295 blocks 5390295 files
/net (-hosts ): 0 blocks 0 files
/home (auto_home ): 0 blocks 0 files
/vol (solaris10:vold(pid617)): 0 blocks -1 files
keterangan : df -a untuk menampilkan semua file system, termasuk yg ada di file /etc/mnttab
# df -b
Filesystem avail
rpool/ROOT/s10x_u6wos_07b 2695149
/devices 0
ctfs 0
proc 0
mnttab 0
swap 532668
objfs 0
sharefs 0
/usr/lib/libc/libc_hwcap1.so.1 2695149
fd 0
swap 532668
swap 532668
rpool/export 2695149
rpool/export/home 2695149
rpool 2695149
keterangan : df -b untuk menampilkan free disk dlm Kbytes
# df -k
Filesystem kbytes used avail capacity Mounted on
rpool/ROOT/s10x_u6wos_07b
8193024 4416180 2694939 63% /
/devices 0 0 0 0% /devices
ctfs 0 0 0 0% /system/contract
proc 0 0 0 0% /proc
mnttab 0 0 0 0% /etc/mnttab
swap 532784 368 532416 1% /etc/svc/volatile
objfs 0 0 0 0% /system/object
sharefs 0 0 0 0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
7111119 4416180 2694939 63% /lib/libc.so.1
fd 0 0 0 0% /dev/fd
swap 532492 76 532416 1% /tmp
swap 532448 32 532416 1% /var/run
rpool/export 8193024 19 2694939 1% /export
rpool/export/home 8193024 2300 2694939 1% /export/home
rpool 8193024 35 2694939 1% /rpool
keterangan : df -k untuk menampilkan free disk dalam Kbytes
# df -h
Filesystem size used avail capacity Mounted on
rpool/ROOT/s10x_u6wos_07b
7.8G 4.2G 2.6G 63% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 520M 368K 520M 1% /etc/svc/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
6.8G 4.2G 2.6G 63% /lib/libc.so.1
fd 0K 0K 0K 0% /dev/fd
swap 520M 76K 520M 1% /tmp
swap 520M 32K 520M 1% /var/run
rpool/export 7.8G 19K 2.6G 1% /export
rpool/export/home 7.8G 2.2M 2.6G 1% /export/home
rpool 7.8G 35K 2.6G 1% /rpool
keterangan : df -h untuk menampilkan free disk dalam bentuk yg mudah dibaca manusia, ada Kilo, Mega, dan GigaByte.
2. du
du berfungsi untuk menampilkan disk block yang di pakai file dan direktori. Masing-masing block terdiri dari 512 bytes.
format perintahnya :
du -option direktori
# du -k /export/home/
1 /export/home/my-zone
3 /export/home/admin/agus/etc/cacao/private
15 /export/home/admin/agus/etc/cacao/instances/default/modules
6 /export/home/admin/agus/etc/cacao/instances/default/security/jsse
6 /export/home/admin/agus/etc/cacao/instances/default/security/snmp
323 /export/home/admin/agus/etc/cacao/instances/default/security/nss/unknown
324 /export/home/admin/agus/etc/cacao/instances/default/security/nss/wellknown
324 /export/home/admin/agus/etc/cacao/instances/default/security/nss/localca
973 /export/home/admin/agus/etc/cacao/instances/default/security/nss
989 /export/home/admin/agus/etc/cacao/instances/default/security
51 /export/home/admin/agus/etc/cacao/instances/default/private/modules
63 /export/home/admin/agus/etc/cacao/instances/default/private
1069 /export/home/admin/agus/etc/cacao/instances/default
1070 /export/home/admin/agus/etc/cacao/instances
1075 /export/home/admin/agus/etc/cacao
1344 /export/home/admin/agus/etc
1346 /export/home/admin/agus
2302 /export/home/admin
1 /export/home/root/test/a/b/c
3 /export/home/root/test/a/b
4 /export/home/root/test/a
1 /export/home/root/test/d/e/f
3 /export/home/root/test/d/e
4 /export/home/root/test/d
10 /export/home/root/test
12 /export/home/root
2317 /export/home
keterangan : du -k untuk menampilkan ukuran direktori dalam kbytes.
# du -h /export/home/
1K /export/home/my-zone
3K /export/home/admin/agus/etc/cacao/private
15K /export/home/admin/agus/etc/cacao/instances/default/modules
6K /export/home/admin/agus/etc/cacao/instances/default/security/jsse
6K /export/home/admin/agus/etc/cacao/instances/default/security/snmp
323K /export/home/admin/agus/etc/cacao/instances/default/security/nss/unknown
324K /export/home/admin/agus/etc/cacao/instances/default/security/nss/wellknown
324K /export/home/admin/agus/etc/cacao/instances/default/security/nss/localca
973K /export/home/admin/agus/etc/cacao/instances/default/security/nss
989K /export/home/admin/agus/etc/cacao/instances/default/security
51K /export/home/admin/agus/etc/cacao/instances/default/private/modules
63K /export/home/admin/agus/etc/cacao/instances/default/private
1.0M /export/home/admin/agus/etc/cacao/instances/default
1.0M /export/home/admin/agus/etc/cacao/instances
1.0M /export/home/admin/agus/etc/cacao
1.3M /export/home/admin/agus/etc
1.3M /export/home/admin/agus
2.2M /export/home/admin
1K /export/home/root/test/a/b/c
3K /export/home/root/test/a/b
4K /export/home/root/test/a
1K /export/home/root/test/d/e/f
3K /export/home/root/test/d/e
4K /export/home/root/test/d
10K /export/home/root/test
12K /export/home/root
2.3M /export/home
keterangan : du -h untuk menampilkan agar ukuran mudah dibaca
# du -sh /export/home/
2.3M /export/home
keterangan : du -sh untuk menampilkan ukuran direktori dan summarize-nya, dg perintah ini lebih simpel, karena nanti outputnya yg ditampilkan cuman 1 line.
Sebenarnya masih ada satu lagi yaitu quot, tapi ak lum nyoba-nyoba yang ini.
OpenSolaris, Linux, Solaris
OpenSolaris sebenernya nama gerakan meng-opensource-kan kernel Solaris. Jadi sebenernya ya Unix juga. Linux sendiri awalnya kan hanya kernel yang kemudian jadi GNU/Linux, trus banyak distro yg menggunakan kernel ini menjadi full distro seperti slackware, debian, fedora, dkk. Sama saja skrg ada kernel Solaris yg kemudian dijadikan distro oleh Nexenta, Schilix dan Belenix.
Solaris sendiri adalah OS Unix yg sangat populer. Sebelumnya sudah ada juga Unix OS yg membuka diri seperti FreeBSD. Yang menarik adalah fitur-fitur Solaris 10 yg keren-keren sudah ada di kernel OpenSolaris, jadi bisa belajar fitur2 itu di kompi rumah. Contohnya ZFS, Dtrace, Zoning.
Solaris 10 dan Solaris Express adalah dua benda yang berbeda. Solaris 10 terbaru sedangkan Solaris Express sendiri adalah semacam snapshots dari pengembangan Solaris berikutnya. Kalau Anda perhatikan nanti di kernel Solaris Express dan OpenSolaris, uname akan menunjukkan SunOS 5.11 sedang Solaris 10 adalah SunOS 5.10.
Kalo ga percaya, buruan install Solaris dan OpenSolaris terbaru?
Disable Xserver
# svcs | grep login
online 5:53:35 svc:/system/console-login:default
online 5:53:53
svc:/application/graphical-login/cde-login:default# svcadm disable cde-login
Run Level di Solaris
Run level di Solaris dan di Linux itu berbeda, di Linux punya aliran tersendiri walaupun basenya dari BSD. Solaris berangkat dari System V, jadi punya aliran yang berbeda pula dengan Linux. Kalau di Linux level 3 merupakan server dengan text mode, kalau di Solaris ada:
S atau s : single-user state
0 : ke firmware
1 : system admin mode, di SMF milestonenya: svc:/milestone/single-user:default
2 : system multi-user (service dengan fungsi server tidak jalan), di SMF milestonenya: svc:/milestone/multi-user:default
3 : extend multi-user mode dan fasilitas network tersedia (service dengan fungsi server jalan), di SMF milestonenya:
svc:/milestone/multi-user-server:default
4 : bisa di define sebagai alternatif level 3
5 : shut down machine
6 : restart/reboot
Setting Password Policy
Untuk mengubah default policy pembuatan password regular user, kamu bisa ngubah di file ini
# cat /etc/default/passwd
#ident “@(#)passwd.dfl 1.7 04/04/22 SMI”
#
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
MAXWEEKS=
MINWEEKS=
PASSLENGTH=6# NAMECHECK enables/disables login name checking.
# The default is to do login name checking.
# Specifying a value of “NO” will disable login name checking.
#
#NAMECHECK=NO# HISTORY sets the number of prior password changes to keep and
# check for a user when changing passwords. Setting the HISTORY
# value to zero (0), or removing/commenting out the flag will
# cause all users’ prior password history to be discarded at the
# next password change by any user. No password history will
# be checked if the flag is not present or has zero value.
# The maximum value of HISTORY is 26.
#
# This flag is only enforced for user accounts defined in the
# local passwd(4)/shadow(4) files.
#
#HISTORY=0
#
# Password complexity tunables. The values listed are the defaults
# which are compatible with previous releases of passwd.
# See passwd(1) and pam_authtok_check(5) for use warnings and
# discussion of the use of these options.
#
#MINDIFF=3
#MINALPHA=2
#MINNONALPHA=1
#MINUPPER=0
#MINLOWER=0
#MAXREPEATS=0
#MINSPECIAL=0
#MINDIGIT=0
#WHITESPACE=YES
#
#
# passwd performs dictionary lookups if DICTIONLIST or DICTIONDBDIR
# is defined. If the password database does not yet exist, it is
# created by passwd. See passwd(1), pam_authtok_check(5) and
# mkdict(1) for more information.
#
#DICTIONLIST=
#DICTIONDBDIR=/var/passwd
