Thursday, December 8, 2011

restore your grub after install wiundows

http://www.unixmen.com/linux-tutorials/documentations-a-howto/1724-restore-grub-2-after-reinstalling-windows-xpvistawin7

Thursday, November 24, 2011

listing iptables

If we want to listing all rules of our iptableswith othe information, here is the command:

iptables -L INPUT -n --line-numbers
iptables -L OUTPUT -n --line-numbers
iptables -L OUTPUT -n --line-numbers | less
iptables -L spamips -n -v --line-numbers
iptables -L spamips -n -v --line-numbers | grep 202.54.1.2

here is the example:
internal:/home/fatur # iptables -L OUTPUT -n --line-numbers
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
1 PORT12_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:143
2 PORT11_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:53
3 PORT10_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:3128
4 PORT09_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:4559
5 PORT08_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:3306
6 PORT07_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:139
7 PORT06_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:110
8 PORT05_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:23
9 PORT04_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:221
10 PORT03_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:81
11 PORT02_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:21
12 PORT01_OUT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:25
13 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 STRING match "mediafire.com" ALGO name kmp TO 65535
14 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 STRING match "microsoft.com" ALGO name kmp TO 65535

Now we want to delete the rules:

internal:/home/fatur # iptables -D OUTPUT 16

Wednesday, November 16, 2011

Wednesday, November 2, 2011

saving you iptables

this tutorial work on OpenSUSE 11.04, if you want to save the configuration of tour iptables, do this command on root level:

iptables-save > /etc/sysconfig/iptables-net

if you want this config always load after restart/ reboot your machine,
Edit with pico, mcedit or vi:/etc/init.d/network

# mcedit /etc/init.d/network

insert this command

iptables-restore < /etc/sysconfig/iptables-net

Done.....

Friday, October 21, 2011

stat usesfull tool on linux

Sometime you want to know about the informations of the file on you GNU/Linux machine, with stat command you will get information about the files. Please take a look the sample.

fatur@majoris:~> stat IBM\ SOP.odt
File: `IBM SOP.odt'
Size: 529948 Blocks: 1040 IO Block: 4096 regular file
Device: 801h/2049d Inode: 25691512 Links: 1
Access: (0744/-rwxr--r--) Uid: ( 2001/ fatur) Gid: ( 100/ users)
Access: 2011-10-21 19:58:52.762000001 +0700
Modify: 2011-10-21 19:58:52.722000002 +0700
Change: 2011-10-21 19:58:52.722000002 +0700
Birth: -
fatur@majoris:~>

So, without options you can have the following information:

File : Size in Bytes
Blocks : Number of blocks used
IO Block : Size in bytes of every block.
Device : The identifier number of your storage device (hard-drive, pen drive, etc.)
Inode : The inode number that the file or directory is linked to.
Access/Modify and change Times : Note that the timestamps also include which time zone that accesses or modifications took place in, in this example +0700 (Indonesia Time)

Thursday, October 13, 2011

Instalasi SQUID di OpenSUSE 11.4

Jika Anda sedang berselancar internet disuatu cafe, kantor, sekolah, kampus maupun tempat lain, dan merasakan kecepatan berselancar Anda di dunia maya terasa sangat cepat dan lancar. Boleh jadi tenpat dimana Anda berselancar memiliki proxy server dengan Squid. Ya, Squid jika anda masih bingung apa itu Squid silahkan bertanya pada Om Google atau simak link berikut ini Websitenya Squid.
Pada tutorial ini saya akan coba berikan tips tentang Squid yang diinstalasikan pada server IBM, dengan versi OpenSUSE 11.4. Pada waktu saya lihat script konfigurasi di OpenSUSE 11.4 ini sangat sederhana sekali, mungkin OpenSUSE mengindari orang-orang pusing dulu waktu lihat scriptnya dan tidak jadi melakukan instalasi.
Oya, maaf ya tips ini hanya berlaku bagi pencinta GNU/Linux saja, untuk produk operating system yang lain, silahkan googling.
Yang pertama pastikan anda tahu IP adress server Anda, soalnya pada tips ini ada konfigurasi dimana disisi client harus memasukkan alamat proxy server Squidnya.


Setelah Anda mengetahui ip Anda, langkah ke 2 lakukan instalasi Squid pada server GNU/Linux anda.



Tanda "i" pada gambar diatas berarti Squid sudah di instalasikan pada OS OpenSUSE 11.4.

Berikut adalah isi dari file squid.conf yang bisa anda edit dengan tool editing kesayangan Anda.

server1:/home/fatur # cat /etc/squid/squid.conf

Isianya adalah sebagai berikut ini:

-----------------------------------------------------------
#
# Recommended minimum configuration:
#
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT

#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager

# Deny requests to certain unsafe ports
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

# allow localhost always proxy functionality
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 3128

# We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?

# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/cache/squid 100 16 256

# Leave coredumps in the first cache dir
coredump_dir /var/cache/squid

# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
------------------------------------------------------------

Ya, sangat simpel sekali, jika Anda belum pernah melihat konfigurasi sebelumnya, selayaknya Anda harus bersyukur, karena kalau Anda melihat konfigurasinya pasti sedikit puyeng...

Berikut adalah beberapa bagian yang saya rubah.

----------------------------------------------------------------------
acl localnet src 192.168.1.0/24 # RFC1918 possible internal network
cache_dir ufs /var/cache/squid 20000 16 256
----------------------------------------------------------------------

Mungkin Anda bingung, dengan melakukan editing 2 line diatas, sudah punya server Squid?. Hehehehe.... jangan khawatir, memang hanya sesimpel itu. Akan tetapi, banyak opsi-opsi lain untuk memaksimalkan kinerja Squid server kita jika kita mau belajar tentunya. Jadi jangan pandang Linux itu susah, bayangkanlah Linux itu mudah, lalu lihat apa yang terjadi. Terkadang kita memang sering dipermaikan dengan pikiran kita, sesuatu yng sebenarnya mudah jadi sulit karena mikirnya udah sulit duluan. Jadi, hati-hati dengan pikiran Anda ya...

Walah, sampai lupa menterjemahkan arti line-line diatas ya. Yang pertama, artinya bahwa Squid anda dan semua komputer client yang memanfaatkan Squid berada di subnet yang sama, 192.168.1.1-192.168.1.254. Nah yang kedua, berapakah yang Anda alokasi dari space harddisk yang ada untuk squid Anda?, pada tips ini saya memberikan 20000 MB atau 2 GB space sebagai penampung/ cache. Arti dari 16 dan 256 diatas silahkan baca dokumentasinya ya, biar Anda jadi lebih mengerti.


Yang tak kalah pentingnya kita juga harus memperhatikan line berikut ini:
------------------------
http_port 3128
------------------------

Apalagi nich? Tenang, ini adalah port dimana Anda harus mensetting di browser client anda nantinya.

Udah dech, setelah hasil editing disimpan. Lakukan restart service Squid Anda dengan perintah berikut.

fatur@server1:~> sudo /etc/init.d/squid restart


Done. Horay........

Setting browser client anda seperti berikut ini.



Untuk membuktikan apakah benar Squid Anda berfungsi atau tidak lihat lognya. Lokasi dari log Squid berada di:

/var/log/squid/

Berikut ini adalah contoh isi dari lognya,

1318516410.238 153 192.168.1.64 TCP_MISS/200 18080 GET http://api.my.kompas.com/panel/timeline/? - DIRECT/202.61.113.15 application/javascript
1318516410.285 33 192.168.1.64 TCP_REFRESH_UNMODIFIED/304 518 GET http://stat.my.kidsklik.com/images/my_kompas/nav_down.png - DIRECT/202.61.113.16 image/png
1318516438.781 86 192.168.1.64 TCP_MISS/200 450 GET http://api.my.kompas.com/panel/notification/undefined? - DIRECT/202.61.113.15 application/javascript
1318516460.384 84 192.168.1.64 TCP_MISS/200 450 GET http://api.my.kompas.com/panel/notification/undefined? - DIRECT/202.61.113.15 application/javascript
1318516463.995 85 192.168.1.64 TCP_MISS/200 450 GET http://api.my.kompas.com/panel/notification/undefined? - DIRECT/202.61.113.15 application/javascript
1318516510.763 81 192.168.1.64 TCP_MISS/200 450 GET http://api.my.kompas.com/panel/notification/undefined? - DIRECT/202.61.113.15 application/javascript
1318516532.416 81 192.168.1.64 TCP_MISS/200 450 GET http://api.my.kompas.com/panel/notification/undefined? - DIRECT/202.61.113.15 application/javascript
1318516535.988 90 192.168.1.64 TCP_MISS/200 450 GET http://api.my.kompas.com/panel/notification/undefined? - DIRECT/202.61.113.15 application/javascript
1318516547.182 163 192.168.1.64 TCP_MISS/200 18131 GET http://api.my.kompas.com/panel/timeline/? - DIRECT/202.61.113.15 application/javascript
1318516547.252 57 192.168.1.64 TCP_REFRESH_UNMODIFIED/304 518 GET http://stat.my.kidsklik.com/images/my_kompas/nav_down.png - DIRECT/202.61.113.16 image/png
1318516552.395 290 192.168.1.64 TCP_REFRESH_MODIFIED/302 806 GET http://fxfeeds.mozilla.com/en-US/firefox/headlines.xml - DIRECT/68.232.44.119 text/html
1318516552.457 58 192.168.1.64 TCP_REFRESH_MODIFIED/302 854 GET http://fxfeeds.mozilla.com/firefox/headlines.xml - DIRECT/68.232.44.119 text/html
1318516552.756 295 192.168.1.64 TCP_MISS/301 689 GET http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml - DIRECT/118.98.42.114 text/html
1318516553.003 244 192.168.1.64 TCP_REFRESH_MODIFIED/200 11939 GET http://feeds.bbci.co.uk/news/rss.xml? - DIRECT/118.98.42.88 text/xml
1318516561.732 161 192.168.1.64 TCP_MISS/200 18131 GET http://api.my.kompas.com/panel/timeline/? - DIRECT/202.61.113.15 application/javascript
1318516563.310 161 192.168.1.64 TCP_MISS/200 18131 GET http://api.my.kompas.com/panel/timeline/? - DIRECT/202.61.113.15 application/javascript
1318516563.356 32 192.168.1.64 TCP_REFRESH_UNMODIFIED/304 518 GET http://stat.my.kidsklik.com/images/my_kompas/nav_down.png - DIRECT/202.61.113.16 image/png
1318516582.739 81 192.168.1.64 TCP_MISS/200 450 GET http://api.my.kompas.com/panel/notification/undefined? - DIRECT/202.61.113.15 application/javascript
1318516604.358 81 192.168.1.64 TCP_MISS/200 450 GET http://api.my.kompas.com/panel/notification/undefined? - DIRECT/202.61.113.15 application/javascript
1318516607.973 87 192.168.1.64 TCP_MISS/200 450 GET http://api.my.kompas.com/panel/notification/undefined? - DIRECT/202.61.113.15 application/javascript
server1:/home/fatur #


Semoga memberikan pencerahan, selamat mencoba ya, semoga berhasil.

Melakukan resize file yang besar dikompres menjadi file kecil

Video berikut ini adalah tips untuk Anda yang akan melakukan resize pada sebuah file PDF yang besar menjadi file PDF yang lebih kecil. Selamat menikmati, semoga membantu.

Menggabungkan file kecil yang telah dipecah (zoom)

Pada tutorial sebelumnya sudah saya berikan tips, yaitu cara melakukan pemecahan file besar menjadi beberapa bagian files kecil. Nah kali ini saya akan melakukan penggabungan file yang kecil-kecil tersebut menjadi satu kesatuan file, sehingga file yang akan digababungkan nanti menjadi satu kesatuan yang utuh. Berikut adalah tips yang akan saya berikan, selamat menikmati semoga bermanfaat.


Wednesday, October 12, 2011

Memecah file besar menjadi file kecil dengan Winzip

Terkadang kita mempunyai sebuah file besar yang harus kita kirimkan dengan e-mail. Seperti yang kita ketahui sendiri untuk mengirimkan file besar dengan email sangat sulit dan mempunyai batasan.
Oleh karena itulah, video ini dibuat. Intinya adalah melakukan pemecahan file besar menjadi beberapa buah file kecil agar memudahkan untuk dikirimkan melalui email.

Selamat menikmati, semoga bermanfaat.


Menyimpan alamt email di google mail

Jika Anda mempunyai email di Google, maka semua email yang masuk dapat dengan mudah kita melakukan update buku alamat ke dalam account kita. Bagaimana caranya, simak video berikut ini. Semoga bermanfaat.



Friday, September 30, 2011

Restart(close and open) a new console window and continue running these commands on Rails

Setelah semalaman berkutat dengan instalasi yang error Ruby di OpenSuse 11.3 akhirnya kutemukan obatnya...

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

restart console

Insert the following code to the last line of your .bashrc file then save your changes
$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm”
Restart(close and open) a new console window and continue running these commands
  • rvm install 1.8.7
  • rvm install 1.9.2
  • rvm —default 1.9.2
  • rvm use 1.9.2
  • ruby -v
  • gem update —system
  • gem install rails
  • rvm rubygems current
  • Finally

  • fatur@internal:~> rails new ~/test/code
          create
          create  README
          create  Rakefile
          create  config.ru
          create  .gitignore
          create  Gemfile
          create  app
          create  app/assets/images/rails.png
          create  app/assets/javascripts/application.js
          create  app/assets/stylesheets/application.css
          create  app/controllers/application_controller.rb
          create  app/helpers/application_helper.rb
          create  app/mailers
          create  app/models
          create  app/views/layouts/application.html.erb
          create  app/mailers/.gitkeep
          create  app/models/.gitkeep
          create  config
          create  config/routes.rb
          create  config/application.rb
          create  config/environment.rb
          create  config/environments
          create  config/environments/development.rb
          create  config/environments/production.rb
          create  config/environments/test.rb
          create  config/initializers
          create  config/initializers/backtrace_silencers.rb
          create  config/initializers/inflections.rb
          create  config/initializers/mime_types.rb
          create  config/initializers/secret_token.rb
          create  config/initializers/session_store.rb
          create  config/initializers/wrap_parameters.rb
          create  config/locales
          create  config/locales/en.yml
          create  config/boot.rb
          create  config/database.yml
          create  db
          create  db/seeds.rb
          create  doc
          create  doc/README_FOR_APP
          create  lib
          create  lib/tasks
          create  lib/tasks/.gitkeep
          create  lib/assets
          create  lib/assets/.gitkeep
          create  log
          create  log/.gitkeep
          create  public
          create  public/404.html
          create  public/422.html
          create  public/500.html
          create  public/favicon.ico
          create  public/index.html
          create  public/robots.txt
          create  script
          create  script/rails
          create  test/fixtures
          create  test/fixtures/.gitkeep
          create  test/functional
          create  test/functional/.gitkeep
          create  test/integration
          create  test/integration/.gitkeep
          create  test/unit
          create  test/unit/.gitkeep
          create  test/performance/browsing_test.rb
          create  test/test_helper.rb
          create  tmp/cache
          create  tmp/cache/assets
          create  vendor/assets/stylesheets
          create  vendor/assets/stylesheets/.gitkeep
          create  vendor/plugins
          create  vendor/plugins/.gitkeep
             run  bundle install
    /home/fatur/.rvm/gems/ruby-1.8.7-p352/gems/bundler-1.0.20/lib/bundler/index.rb:110: [BUG] Segmentation fault
    ruby 1.8.7 (2010-01-10 patchlevel 249) [i586-linux]

    Fetching source index for http://rubygems.org/
    fatur@internal:~>

Tuesday, May 24, 2011

count all files in one folder

Sometimes we want to know how many files in folder using GNU/Linux command, here the code:



$ls -1 targetdir | wc -l 
454
Enjoy.....

Tuesday, April 26, 2011

iptables

Untuk melihat DNAT yang dibelakukan di iptables:

internal:/home/fatur # iptables -t nat -L -v
Chain PREROUTING (policy ACCEPT 265K packets, 29M bytes)
 pkts bytes target     prot opt in     out     source               destination
96559 4999K DNAT       tcp  --  eth0   any     anywhere             anywhere            tcp dpt:http to:192.168.1.1:3128
    0     0 REDIRECT   tcp  --  eth0   any     anywhere             anywhere            tcp dpt:http redir ports 3128

Chain OUTPUT (policy ACCEPT 358K packets, 26M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain POSTROUTING (policy ACCEPT 523K packets, 45M bytes)
 pkts bytes target     prot opt in     out     source               destination

Untuk melihat list di chain INPUT:

internal:/home/fatur # iptables -L INPUT
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
PORT12_IN  tcp  --  anywhere             anywhere            tcp dpt:imap
PORT11_IN  tcp  --  anywhere             anywhere            tcp dpt:domain
PORT10_IN  tcp  --  anywhere             anywhere            tcp dpt:ndl-aas
PORT09_IN  tcp  --  anywhere             anywhere            tcp dpt:hylafax
PORT08_IN  tcp  --  anywhere             anywhere            tcp dpt:mysql
PORT07_IN  tcp  --  anywhere             anywhere            tcp dpt:netbios-ssn
PORT06_IN  tcp  --  anywhere             anywhere            tcp dpt:pop3
PORT05_IN  tcp  --  anywhere             anywhere            tcp dpt:telnet
PORT04_IN  tcp  --  anywhere             anywhere            tcp dpt:ssh
PORT03_IN  tcp  --  anywhere             anywhere            tcp dpt:http
PORT02_IN  tcp  --  anywhere             anywhere            tcp dpt:ftp
PORT01_IN  tcp  --  anywhere             anywhere            tcp dpt:smtp

untuk melihat chain INPUT beserta port yang dipakai:

internal:/home/fatur # iptables -nL INPUT
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
PORT12_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:143
PORT11_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:53
PORT10_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:3128
PORT09_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:4559
PORT08_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:3306
PORT07_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:139
PORT06_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:110
PORT05_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:23
PORT04_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:22
PORT03_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80
PORT02_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:21
PORT01_IN  tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:25



Untuk melihat chain INPUT secara lebih detail:
internal:/home/fatur # iptables -vnL INPUT
Chain INPUT (policy ACCEPT 10M packets, 7783M bytes)
 pkts bytes target     prot opt in     out     source               destination
    1    44 PORT12_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:143
  758 42290 PORT11_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:53
3338K  420M PORT10_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:3128
    0     0 PORT09_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:4559
    2    84 PORT08_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:3306
61676   42M PORT07_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:139
    1    44 PORT06_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:110
    1    44 PORT05_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:23
73196 4317K PORT04_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22
16237 3426K PORT03_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80
    1    44 PORT02_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:21
    2    84 PORT01_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:25

Untuk melihat chain INPUT secara detail beserta line numbernya, line number disini bisa digunakan untuk mendeleted rule-rule yang ingin dibuang.

internal:/home/fatur # iptables -vnL INPUT --line-numbers
Chain INPUT (policy ACCEPT 10M packets, 7790M bytes)
num   pkts bytes target     prot opt in     out     source               destination
1        1    44 PORT12_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:143
2      758 42290 PORT11_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:53
3    3341K  421M PORT10_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:3128
4        0     0 PORT09_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:4559
5        2    84 PORT08_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:3306
6    61676   42M PORT07_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:139
7        1    44 PORT06_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:110
8        1    44 PORT05_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:23
9    73206 4318K PORT04_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22
10   16252 3427K PORT03_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80
11       1    44 PORT02_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:21
12       2    84 PORT01_IN  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:25


Untuk melakukan delete rules no 11 pada chain INPUT:


internal:/home/fatur # iptables -D INPUT 11   

Untuk melakukan insert rule, setelah hal ini diproses maka rules yang di insertkan akan berapa pada posisi pertama.
 
internal:/home/fatur #iptables -I INPUT -p tcp -s 212.100.apa.saja --dport 22 -j logaccept

Untuk melakukan replace pada chain yang sudah dibuat:

internal:/home/fatur #iptables -R INPUT 1 -p tcp -s 100.100.200.100 --dport 22 -j ACCEPT



Untuk melakukan drop dengan spesifikasi IP tertentu:


internal:/home/fatur #iptables -I FORWARD -d 123.123.123.123 -j DROP
 
hal ini bisa diberlakukan juga pada chain yang lain, misalnya:
 
internal:/home/fatur #iptables -I OUTPUT -d 123.123.123.123 -j DROP
 
Untuk melakukan drop packet dengan subnet tertentu :
iptables -I FORWARD -s 192.168.2.0/255.255.255.0 -j DROP
 
Drop alamat website tertentu
internal:/home/fatur #iptables -A OUTPUT -p tcp -d whateversite.com  -j DROP 


Salam
Fatur

Thursday, April 7, 2011

Linux Rename Multiple Files At a Shell Prompt

rename file

from:
3207020003001_0%.pdf
3207020005010_0%.pdf
3207020007002_0%.pdf
3207060003014_0%.pdf
3207080007004_0%.pdf

to

3207020003001_0.pdf
3207020005010_0.pdf
3207020007002_0.pdf
3207060003014_0.pdf
3207080007004_0.pdf

command:  for i in *.pdf; do mv $i `echo $i |cut -c1-15,17-20` ; done


3207080007001_50%.pdf
3207080007003_50%.pdf
3207080007005_50%.pdf
3207080007002_50%.pdf


to


3207080007001_50.pdf  
3207080007003_50.pdf  
3207080007005_50.pdf
3207080007002_50.pdf



commad: for i in *.pdf; do mv $i `echo $i |cut -c1-16,18-21` ; done


3207080007001_100%.pdf
3207080007004_100%.pdf
3207080007002_100%.pdf
3207080007005_100%.pdf

to

3207080007001_100.pdf  
3207080007004_100.pdf  
3207080007002_100.pdf  
3207080007005_100.pdf


for i in *.pdf; do mv $i `echo $i |cut -c1-17,19-22` ; done


ref: http://www.cyberciti.biz/tips/renaming-multiple-files-at-a-shell-prompt.html

Monday, March 14, 2011

Crontab Sarg

I am using GNU/Linux OpenSUSE 11.3 as server operating system for this tutorial.  Make easy to read your squid access report, install the sarg application follow this link. With sarg you can monitor the user activities that using squid as the cache server. To make the sarg report automatically using cron please follow this instruction. If u have problem yo can comment in this page or yoy can mail me faturr [at] gmail.com. Thank you for reading.

$ sudo vi /etc/sysconfig/sarg
RUN_SARGREPORT=yes


$ sudo crontab -e
#sarg
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
00 08-18/1 * * * sarg-reports today
00 00 * * * sarg-reports daily
00 01 * * 1 sarg-reports weekly
30 02 1 * * sarg-reports monthly

The preview edit is look like like this image.



The sarg report is look like this.

Problem with installation and configuration? We can help you or your company. Call +62 888 198 0879 or +62 821 337 600 29.

Monday, March 7, 2011

Linux command


Perintah du (disk usage) digunakan untuk meengetahui besaran dari file yang akan ditampilkan dalam layar monitor, untuk mengetahui detail yang bisa dihsilkan oleh perintah du bisa menggunakan 'man du' (tanpa tanda kutip)
$man du 

NAME
       du - estimate file space usage


SYNOPSIS
       du [OPTION]... [FILE]...
       du [OPTION]... --files0-from=F


DESCRIPTION
       Summarize disk usage of each FILE, recursively for directories.

Sample of du command: 


fatur@123$ du -ah --time *
19M 2011-03-07 10:27 20110307/To_20110304/aa.mdb
1.6M 2011-03-07 11:07 20110307/To_20110304/nn.rar
404K 2011-03-07 11:04 20110307/To_20110304/4.rar
1.2M 2011-03-07 10:27 20110307/To_20110304/gg.rar

Thursday, January 20, 2011

Saidar untuk memonitor GNU/Linux Ubuntu melalui console/ terminal

Saidar adalah aplikasi untuk menampilkan statistik dari sebuah sistem operasi. Statistik termasuk adalah penggunaan CPU, proses, load, memori, swap, jaringan I / O dan disk I / O dari sistem operasi dari sebuah komputer.

Saidar memanfaatkan pustaka libstatgrab. Libstatgrab adalah pustaka yang menyediakan akses lintas platform untuk membaca statistik dari sistem yang sedang berjalan. Pustaka ini ditulis dalam bahasa C dan menyajikan pilihan interface yang berguna yang dapat digunakan untuk mengakses statistik dari sebuah sistem operasi yang sedang berjalan. Daftar statistik yang saat ini bisa di dukung adalah penggunaan CPU, penggunaan memori, penggunaan media penyimpanan, jumlah proses, lalu lintas jaringan, disk I / O, dan banyak lagi.

Beberapa operating sistem yang disupport adalah Solaris 2.x, Linux 2.2/2.4/2.6, 4.x/5.x FreeBSD, NetBSD 1.6.x, OpenBSD 3.x, Dragonfly BSD 1.0, HP-UX, dan Cygwin.

Proses instalasinya sangat mudah jika anda memakai  GNU/Linux Ubuntu 9.10, tentunya dengan akses internet yang sudah terhubung.

$sudo apt-get install saidar

Dibawah ini adalah hasil capture dari system GNU/Linux Ubuntu 9.10 yang sedang berjalan.


Monday, January 3, 2011

Conky

Conky adalah sebuah script yang berjalan di GNU/Linux, fungsinya untuk memonitor segala sesuatu yang berkaitan dengan sytem yang sedang berjalan. Conky yang saya posting saat ini adalah yang berjalan pada Laptop T60. Conky mememiliki kurang lebih 300 build-in object yang bisa membantu kita untuk memonitor system pada komputer atau pada laptop kita. Kalau anda tertarik dengan tampilan conky saya, anda harus siap-siap melakukan instalasi GNU/Linux pada laptop/ komputer kesayangan anda.





Pada gambar conky saya diatas, saya melakukan monitoring pada laptop IBM T60, beberapa parameter yang bisa diamati adalah:
- Kernel yang dipakai
- Hostname dari system yang dipakai
- Uptime atau berapa lama laptop/komputer sudah berjalan
- Resource yang dipakai oleh processor dan historynya yang di refresh setiap 4 detik
- Memori yang dipakai dan total memory yang ada dalam system.
- Process dan data yang sedang berjalan, disini saya memonitor resource yang paling banyak memakan memory dan paling banyak memakan resource processor.
- Network baik itu jika terkoneksi via kable maupun melalui wifi, selain IPaddress yang saya monitor saya juga memonitor uploada dan download dari network yang sedang aktif.
- Informasi jam, hari, tanggal, bulan dan tahun.

Berikut adalah script conkynya, silahkan di pakai jika anda menyukainya. Copy dan paste script berikut pada konfigurasi conky anda, sebagai contoh karena saya memakai GNU/Linux Ubuntu 10.10 maka script tersebut saya paste pada /etc/conky/conky.conf.




    background yes
    use_xft yes
    xftfont HandelGotD:size=9
    xftalpha 0.5
    update_interval 4.0
    total_run_times 0
    own_window yes
    own_window_type normal
    own_window_transparent yes
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
    double_buffer yes
    minimum_size 200 5
    maximum_width 220
    draw_shades no
    draw_outline no
    draw_borders no
    draw_graph_borders no
    default_color grey
    default_shade_color red
    default_outline_color green
    alignment top_right
    gap_x 12
    gap_y 48
    no_buffers yes
    uppercase no
    cpu_avg_samples 2
    override_utf8_locale no

    TEXT
    SYSTEM ${hr 2}
    ${alignc 42}${font Arial Black:size=16}M. Fahtur Rosi!${font}
    $sysname $kernel on $machine
    Hostname $alignr $nodename
    Uptime $alignr $uptime
    Load $alignr $loadavg
    BATT: ${alignr}${battery}
    
    PROCESSOR ${hr 2}
    Core 1 $alignr ${cpu cpu0}%
#    ${cpubar cpu0}
    Core 1 Proceess refresh every $alignr 4/s
    ${cpugraph cpu0}    
    Core 2 $alignr ${cpu cpu1}%
#    ${cpubar cpu1}
    Core 2 Proceess refresh every $alignr 4/s
    ${cpugraph cpu2}    
    
    MEM $alignc $mem / $memmax $alignr $memperc%
#    $membar

#    / $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_free_perc /}%
#    ${fs_bar /}
#    /home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_free_perc /home}%
#    ${fs_bar /home}
#    swap $alignc $swap / $swapmax $alignr $swapperc%
#    ${swapbar}

    PROCESSES ${hr 2}
    NAME $alignr CPU    PID
    ${top name 1} $alignr ${top cpu 1} ${top pid 1}
    ${top name 2} $alignr ${top cpu 2} ${top pid 2}
    ${top name 3} $alignr ${top cpu 3} ${top pid 3}
    ${top name 4} $alignr ${top cpu 4} ${top pid 4}
    ${top name 5} $alignr ${top cpu 5} ${top pid 5}
    #${top name 6} $alignr ${top pid 6} ${top pid 6}
    #${top name 7} $alignr ${top pid 7} ${top cpu 7}

    DATA ${hr 2}
    NAME $alignr MEM    CPU
    ${top_mem name 1} $alignr ${top_mem mem 1} ${top cpu 1}
    ${top_mem name 2} $alignr ${top_mem mem 2} ${top cpu 2}
    ${top_mem name 3} $alignr ${top_mem mem 3} ${top cpu 3}
    ${top_mem name 4} $alignr ${top_mem mem 4} ${top cpu 4}
    ${top_mem name 5} $alignr ${top_mem mem 5} ${top cpu 5}
    
    NETWORK INFO ${hr 2}
    WIFI $alignr ${addr wlan0}
    Upload:$color  ${upspeed wlan0}kb/s 
    Download:$color  ${downspeed wlan0}kb/s
    ETHERNET $alignr ${addr eth0}
    Upload:$color  ${upspeed eth0}kb/s 
    Download:$color  ${downspeed eth0}kb/s
   # Inbound $alignr ${downspeed eth0} kb/s
   # ${downspeedgraph eth0}
   # Outbound $alignr ${upspeed eth0} kb/s
   # ${upspeedgraph eth0}
   # $processes processes ($running_processes running)

    DAY INFO ${hr 2}
    ${time %a, } ${color }${time %e %B %G}
    ${time %Z,    }${color }${time %H:%M:%S}
Quad Core:

        background yes
        use_xft yes
        xftfont HandelGotD:size=9
        xftalpha 0.5
        update_interval 4.0
        total_run_times 0
        own_window yes
        own_window_type normal
        own_window_transparent yes
        own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
        double_buffer yes
        minimum_size 200 5
        maximum_width 220
        draw_shades no
        draw_outline no
        draw_borders no
        draw_graph_borders no
        default_color grey
        default_shade_color red
        default_outline_color green
        alignment top_right
        gap_x 12
        gap_y 48
        no_buffers yes
        uppercase no
        cpu_avg_samples 2
        override_utf8_locale no

        TEXT
        SYSTEM ${hr 2}
        ${alignc 42}${font Arial Black:size=16}M. Fahtur Rosi!${font}
        $sysname $kernel on $machine
        Hostname $alignr $nodename
        Uptime $alignr $uptime
        Load $alignr $loadavg
        BATT: ${alignr}${battery}
       
        PROCESSOR ${hr 2}
       Core 1 already use $alignr ${cpu cpu0}%
        ${cpubar cpu0}
    #   Core 1 Proceess refresh every $alignr 4/s
    #    ${cpugraph cpu0}   
Core 2 already use $alignr ${cpu cpu1}%
        ${cpubar cpu1}
    #   Core 2 Proceess refresh every $alignr 4/s
    #    ${cpugraph cpu1}  
Core 3 already use $alignr ${cpu cpu3}%
        ${cpubar cpu3}
    #   Core 3 Proceess refresh every $alignr 4/s
    #    ${cpugraph cpu3}   
Core 4 already use $alignr ${cpu cpu1}%
        ${cpubar cpu4}
    #   Core 4 Proceess refresh every $alignr 4/s
    #    ${cpugraph cpu4}   

        MEM $alignc $mem / $memmax $alignr $memperc%
    #    $membar

    #    / $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_free_perc /}%
    #    ${fs_bar /}
    #    /home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_free_perc /home}%
    #    ${fs_bar /home}
    #    swap $alignc $swap / $swapmax $alignr $swapperc%
    #    ${swapbar}

        PROCESSES ${hr 2}
        NAME $alignr CPU    PID
        ${top name 1} $alignr ${top cpu 1} ${top pid 1}
        ${top name 2} $alignr ${top cpu 2} ${top pid 2}
        ${top name 3} $alignr ${top cpu 3} ${top pid 3}
        ${top name 4} $alignr ${top cpu 4} ${top pid 4}
        ${top name 5} $alignr ${top cpu 5} ${top pid 5}
        #${top name 6} $alignr ${top pid 6} ${top pid 6}
        #${top name 7} $alignr ${top pid 7} ${top cpu 7}

        DATA ${hr 2}
        NAME $alignr MEM    CPU
        ${top_mem name 1} $alignr ${top_mem mem 1} ${top cpu 1}
        ${top_mem name 2} $alignr ${top_mem mem 2} ${top cpu 2}
        ${top_mem name 3} $alignr ${top_mem mem 3} ${top cpu 3}
        ${top_mem name 4} $alignr ${top_mem mem 4} ${top cpu 4}
        ${top_mem name 5} $alignr ${top_mem mem 5} ${top cpu 5}
       
        NETWORK INFO ${hr 2}
        WIFI $alignr ${addr wlan0}
        Upload:$color  ${upspeed wlan0}kb/s
        Download:$color  ${downspeed wlan0}kb/s
        ETHERNET $alignr ${addr eth0}
        Upload:$color  ${upspeed eth0}kb/s
        Download:$color  ${downspeed eth0}kb/s
       # Inbound $alignr ${downspeed eth0} kb/s
       # ${downspeedgraph eth0}
       # Outbound $alignr ${upspeed eth0} kb/s
       # ${upspeedgraph eth0}
       # $processes processes ($running_processes running)

        DAY INFO ${hr 2}
        ${time %a, } ${color }${time %e %B %G}
        ${time %Z,    }${color }${time %H:%M:%S}



konfigurasi lain bisa dilihat di: http://conky.sourceforge.net/config_settings.html