Jumat, 22 Maret 2013

Prerouting & Postrouting

prerouting adalah mangle dengan parameter berdasar sumber, jadi ketika anda menerapkan rule saya, mangle tersebut hanya mengenali ip sumber ( src address ) yang masuk dari interface publik.

Sedangkan forward itu mangle dengan parameter berdasar sumber dan tujuan. jadi bisa diterapkan untuk mengenali ip sumber ( src address ) dan tujuan ( dst address )

Istilahnya gampangnya:
prerouting itu from who ?
Sedangkan
forward itu from who forward to who?
Lain lagi postrouting
postrouting itu to who?
global in bisa digunakan apabila parameter yang akan kita filter adalah segala sesuatu yang masuk ke mikrotik.
global out bisa kita gunakan apabila kita akan memfilter segala sesuatu yang keluar dari mikrotik.


Sumber: http://waduhlupa.lagi/

Jumat, 08 Juni 2012

Squid. Youtube an error occured. Please try again later.

Jika anda pengguna squid yang mengalami error pada youtube, silahkan update storeurl.pl anda dengan storeurl.pl di bawah ini.

 $|=1;  
 while (<>) {  
 @X = split;  
 #    $X[1] =~ s/&sig=.*//;  
 $x = $X[0] . " ";  
 $_ = $X[1];  
 $u = $X[1];  
 if ($X[1] =~ /(youtube|google).*videoplayback\?/){  
 @itag = m/[&?](itag=[0-9]*)/;  
 @id = m/[&?](id=[^\&]*)/;  
 @range = m/[&?](range=[^\&\s]*)/;  
 @begin = m/[&?](begin=[^\&\s]*)/;  
 @redirect = m/[&?](redirect_counter=[^\&]*)/;  
 print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/@itag&@id&@range@begin@redirect\n";  
 #speedtest  
 }elsif (m/^http:\/\/(.*)\/speedtest\/(.*\.(jpg|txt))\?(.*)/) {  
 print $x . "http://www.speedtest.net.SQUIDINTERNAL/speedtest/" . $2 . "\n";  
 #mediafire  
 }elsif (m/^http:\/\/199\.91\.15\d\.\d*\/\w{12}\/(\w*)\/(.*)/) {  
 print $x . "http://www.mediafire.com.SQUIDINTERNAL/" . $1 ."/" . $2 . "\n";  
 #fileserve  
 }elsif (m/^http:\/\/fs\w*\.fileserve\.com\/file\/(\w*)\/[\w-]*\.\/(.*)/) {  
 print $x . "http://www.fileserve.com.SQUIDINTERNAL/" . $1 . "./" . $2 . "\n";  
 #filesonic  
 }elsif (m/^http:\/\/s[0-9]*\.filesonic\.com\/download\/([0-9]*)\/(.*)/) {  
 print $x . "http://www.filesonic.com.SQUIDINTERNAL/" . $1 . "\n";  
 #4shared  
 }elsif (m/^http:\/\/[a-zA-Z]{2}\d*\.4shared\.com(:8080|)\/download\/(.*)\/(.*\..*)\?.*/) {  
 print $x . "http://www.4shared.com.SQUIDINTERNAL/download/$2\/$3\n";  
 #4shared preview  
 }elsif (m/^http:\/\/[a-zA-Z]{2}\d*\.4shared\.com(:8080|)\/img\/(\d*)\/\w*\/dlink__2Fdownload_2F(\w*)_3Ftsid_3D[\w-]*\/preview\.mp3\?sId=\w*/) {  
 print $x . "http://www.4shared.com.SQUIDINTERNAL/$2\n";  
 #photos-X.ak.fbcdn.net where X a-z  
 }elsif (m/^http:\/\/photos-[a-z](\.ak\.fbcdn\.net)(\/.*\/)(.*\.jpg)/) {  
 print $x . "http://photos" . $1 . "/" . $2 . $3 . "\n";  
 #YX.sphotos.ak.fbcdn.net where X 1-9, Y a-z  
 } elsif (m/^http:\/\/[a-z][0-9]\.sphotos\.ak\.fbcdn\.net\/(.*)\/(.*)/) {  
 print $x . "http://photos.ak.fbcdn.net/" . $1 ."/". $2 . "\n";  
 #maps.google.com  
 } elsif (m/^http:\/\/(cbk|mt|khm|mlt|tbn)[0-9]?(.google\.co(m|\.uk|\.id).*)/) {  
 print $x . "http://" . $1 . $2 . "\n";  
 # compatibility for old cached get_video?video_id  
 } elsif (m/^http:\/\/([0-9.]{4}|.*\.youtube\.com|.*\.googlevideo\.com|.*\.video\.google\.com).*?(videoplayback\?id=.*?|video_id=.*?)\&(.*?)/) {  
 $z = $2; $z =~ s/video_id=/get_video?video_id=/;  
 print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $z . "\n";  
 } elsif (m/^http:\/\/www\.google-analytics\.com\/__utm\.gif\?.*/) {  
 print $x . "http://www.google-analytics.com/__utm.gif\n";  
 #Cache High Latency Ads  
 } elsif (m/^http:\/\/([a-z0-9.]*)(\.doubleclick\.net|\.quantserve\.com|\.googlesyndication\.com|yieldmanager|cpxinteractive)(.*)/) {  
 $y = $3;$z = $2;  
 for ($y) {  
 s/pixel;.*/pixel/;  
 s/activity;.*/activity/;  
 s/(imgad[^&]*).*/\1/;  
 s/;ord=[?0-9]*//;  
 s/;&timestamp=[0-9]*//;  
 s/[&?]correlator=[0-9]*//;  
 s/&cookie=[^&]*//;  
 s/&ga_hid=[^&]*//;  
 s/&ga_vid=[^&]*//;  
 s/&ga_sid=[^&]*//;  
 # s/&prev_slotnames=[^&]*//  
 # s/&u_his=[^&]*//;  
 s/&dt=[^&]*//;  
 s/&dtd=[^&]*//;  
 s/&lmt=[^&]*//;  
 s/(&alternate_ad_url=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;  
 s/(&url=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;  
 s/(&ref=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;  
 s/(&cookie=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;  
 s/[;&?]ord=[?0-9]*//;  
 s/[;&]mpvid=[^&;]*//;  
 s/&xpc=[^&]*//;  
 # yieldmanager  
 s/\?clickTag=[^&]*//;  
 s/&u=[^&]*//;  
 s/&slotname=[^&]*//;  
 s/&page_slots=[^&]*//;  
 }  
 print $x . "http://" . $1 . $2 . $y . "\n";  
 #cache high latency ads  
 } elsif (m/^http:\/\/(.*?)\/(ads)\?(.*?)/) {  
 print $x . "http://" . $1 . "/" . $2 . "\n";  
 # spicific servers starts here....  
 } elsif (m/^http:\/\/(www\.ziddu\.com.*\.[^\/]{3,4})\/(.*?)/) {  
 print $x . "http://" . $1 . "\n";  
 #cdn, varialble 1st path  
 } elsif (($u =~ /filehippo/) && (m/^http:\/\/(.*?)\.(.*?)\/(.*?)\/(.*)\.([a-z0-9]{3,4})(\?.*)?/)) {  
 @y = ($1,$2,$4,$5);  
 $y[0] =~ s/[a-z0-9]{2,5}/cdn./;  
 print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";  
 #rapidshare  
 } elsif (($u =~ /rapidshare/) && (m/^http:\/\/(([A-Za-z]+[0-9-.]+)*?)([a-z]*\.[^\/]{3}\/[a-z]*\/[0-9]*)\/(.*?)\/([^\/\?\&]{4,})$/)) {  
 print $x . "http://cdn." . $3 . "/SQUIDINTERNAL/" . $5 . "\n";  
 } elsif (($u =~ /maxporn/) && (m/^http:\/\/([^\/]*?)\/(.*?)\/([^\/]*?)(\?.*)?$/)) {  
 print $x . "http://" . $1 . "/SQUIDINTERNAL/" . $3 . "\n";  
 #like porn hub variables url and center part of the path, filename etention 3 or 4 with or without ? at the end  
 } elsif (($u =~ /tube8|pornhub|xvideos/) && (m/^http:\/\/(([A-Za-z]+[0-9-.]+)*?(\.[a-z]*)?)\.([a-z]*[0-9]?\.[^\/]{3}\/[a-z]*)(.*?)((\/[a-z]*)?(\/[^\/]*){4}\.[^\/\?]{3,4})(\?.*)?$/)) {  
 print $x . "http://cdn." . $4 . $6 . "\n";  
 #...spicific servers end here.  
 #photos-X.ak.fbcdn.net where X a-z  
 } elsif (m/^http:\/\/photos-[a-z].ak.fbcdn.net\/(.*)/) {  
 print $x . "http://photos.ak.fbcdn.net/" . $1 . "\n";  
 #for yimg.com video  
 } elsif (m/^http:\/\/(.*yimg.com)\/\/(.*)\/([^\/\?\&]*\/[^\/\?\&]*\.[^\/\?\&]{3,4})(\?.*)?$/) {  
 print $x . "http://cdn.yimg.com//" . $3 . "\n";  
 #for yimg.com doubled  
 } elsif (m/^http:\/\/(.*?)\.yimg\.com\/(.*?)\.yimg\.com\/(.*?)\?(.*)/) {  
 print $x . "http://cdn.yimg.com/" . $3 . "\n";  
 #for yimg.com with &sig=  
 } elsif (m/^http:\/\/(.*?)\.yimg\.com\/(.*)/) {  
 @y = ($1,$2);  
 $y[0] =~ s/[a-z]+[0-9]+/cdn/;  
 $y[1] =~ s/&sig=.*//;  
 print $x . "http://" . $y[0] . ".yimg.com/" . $y[1] . "\n";  
 #youjizz. We use only domain and filename  
 } elsif (($u =~ /media[0-9]{2,5}\.youjizz/) && (m/^http:\/\/(.*)(\.[^\.\-]*?\..*?)\/(.*)\/([^\/\?\&]*)\.([^\/\?\&]{3,4})((\?|\%).*)?$/)) {  
 @y = ($1,$2,$4,$5);  
 $y[0] =~ s/(([a-zA-A]+[0-9]+(-[a-zA-Z])?$)|(.*cdn.*)|(.*cache.*))/cdn/;  
 print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";  
 #general purpose for cdn servers. add above your specific servers.  
 } elsif (m/^http:\/\/([0-9.]*?)\/\/(.*?)\.(.*)\?(.*?)/) {  
 print $x . "http://squid-cdn-url//" . $2 . "." . $3 . "\n";  
 #generic http://variable.domain.com/path/filename."ex" "ext" or "exte" with or withour "? or %"  
 } elsif (m/^http:\/\/(.*)(\.[^\.\-]*?\..*?)\/(.*)\.([^\/\?\&]{2,4})((\?|\%).*)?$/) {  
 @y = ($1,$2,$3,$4);  
 $y[0] =~ s/(([a-zA-A]+[0-9]+(-[a-zA-Z])?$)|(.*cdn.*)|(.*cache.*))/cdn/;  
 print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";  
 # generic http://variable.domain.com/...  
 } elsif (m/^http:\/\/(([A-Za-z]+[0-9-]+)*?|.*cdn.*|.*cache.*)\.(.*?)\.(.*?)\/(.*)$/) {  
 print $x . "http://cdn." . $3 . "." . $4 . "/" . $5 . "\n";  
 # spicific extention that ends with ?  
 } elsif (m/^http:\/\/(.*?)\/(.*?)\.(jp(e?g|e|2)|gif|png|tiff?|bmp|ico|flv|wmv|3gp|mp(4|3)|exe|msi|zip|on2|mar|rar|cab|amf|swf)(.*)/) {  
 print $x . "http://" . $1 . "/" . $2 . "." . $3 . "\n";  
 # all that ends with ;  
 } elsif (m/^http:\/\/(.*?)\/(.*?)\;(.*)/) {  
 print $x . "http://" . $1 . "/" . $2 . "\n";  
 } else {  
 print $x . $_ . "sucks\n";  
 }  
 }  
Jangan lupa merubah settingan berikut ini di squid.conf anda:
storeurl_rewrite_children 15
storeurl_rewrite_concurrency 100

Sumber

Selasa, 29 November 2011

Install Deepfreeze Enterprise (khusus buat Serapuh NET)

1. Install di Server.
- download dlu deepfreeze ny dr situs ini bg. Klik aja disini
- trus ekstract, (klik kanan, ekstract here)
- trus buka file DF6Ent.exe
- pilih next,
- I accept, Install, OK
- masukkan customization code, bwt aja Serapuh NET
- trus restart komputer.

2. Jalankan Deepfreeze Enterprize Console di Server Billing
- Start, All Program, Faronics, Deep Freeze Enterprise, Deep Freeze Console.
- Klik pada Entire Network, tunggu beberapa saat sampa Deep Freeze Client nya muncul.
- Kalo gk muncul, terpaksa ganti deepfreeze yg di client.

3. Buat Deep Freeze Client, (jika gk muncul Deepfreeze Client di Deep Freeze Console)
- Pertama buka dulu Deepfreeze Enterprise Administrator di server.
- Setelah muncul, ada tab Welcome, Configuration, Onetime Passowords.
- Pilih Configuration, muncul tab Passwords, Drives, Restart/Shutdown, dll...
- Pada tab password ceklist nomor 1, masukkan password.
- Pada tab Miscellaneous, klik LAN, ceklist Use default Port, ceklist Use hard rebootwhen Thawed, hilangkan Show Frozen icon on system tray, hilangkan Control Windows Update.
- Setelah itu, klik Create di samping help, pilih Create Workstation Install Program, simpan di tempat yang aman atau di Flashdisk (inilah program yg mw diinstall di Client)

4. Install Deep Freeze Workstation (Client)
- Buka dulu deepfreeze yg di client (Ctrl+Shift+Alt+F6), pilih Boot Thawed, restart now.
- Setelah restart (deepfreeze terbuka), Install deepfreeze nya dari yang sudah di Creat tadi.
- Next, Finish.
- Jika sudah siap, nanti muncul di Deepfreeze Server Console.
- Selesai.

Selasa, 22 November 2011

Tutorial Instalasi Squid Lusca pada Ubuntu 11.04 Server

1. Bahan-bahan:
- Ubuntu 11.04
- Ip proxy 192.168.3.1
- Gatewai 192.168.3.254
- Ip mikrotik ke arah proxy 192.168.3.254/24
- Ram 1 GB
- HDD Sata 250 GB

2. Install Paket
# sudo apt-get update
# sudo apt-get install squid
# sudo apt-get install squid squidclient squid-cgi
# sudo apt-get install gcc
# sudo apt-get install build-essential
grep -E "#define\W+__FD_SETSIZE" /usr/include/*.h /usr/include/*/*.h
# nano /usr/include/linux/posix_types.h


#define __FD_SETSIZE 65536
# nano /usr/include/bits/typesizes.h

#define __FD_SETSIZE 65536

# nano /etc/pam.d/login


Session required /lib/security/pam_limits.so

# sudo apt-get install build-essential
# sudo apt-get install sharutils
# sudo apt-get install ccze
# sudo apt-get install libzip-dev
# sudo apt-get install automake1.9


3.Download Lusca

download lusca lewat terminal ubuntu dengan perintah :

wget http://untuk-kita-semua.googlecode.com/files/LUSCA_FMI.tar.gz

lalu ekstrak dan masuk ke foldernya :

# tar xzvf LUSCA_FMI.tar.gz
# cd LUSCA_FMI/


CATATAN : jika memakai ubuntu 64bit lakukan perintah ini #---------> make distclean

cek procesor
# cat /proc/cpuinfo
di web : http://en.gentoo-wiki.com/wiki/Safe_Cflags/AMD

amd athlon II x2 240:
CHOST="x86_64-pc-linux-gnu" \
CFLAGS="-march=amdfam10 -O2 -pipe" \
CXXFLAGS="${CFLAGS}" \
./configure --prefix=/usr --exec_prefix=/usr --bindir=/usr/sbin --sbindir=/usr/sbin --libexecdir=/usr/lib/squid --sysconfdir=/etc/squid \
--localstatedir=/var/spool/squid --datadir=/usr/share/squid --enable-http-gzip --enable-async-io=24 --with-aufs-threads=24 --with-pthreads --enable-storeio=aufs \
--enable-linux-netfilter --enable-arp-acl --enable-epoll --enable-removal-policies=heap --with-aio --with-dl --enable-snmp \
--enable-delay-pools --enable-htcp --enable-cache-digests --disable-unlinkd --enable-large-cache-files --with-large-files \
--enable-err-languages=English --enable-default-err-language=English --with-maxfd=65536

CHOST="x86_64-pc-linux-gnu" \
CFLAGS="-march=k8 -O2 -pipe" \
./configure --prefix=/usr --exec_prefix=/usr --bindir=/usr/sbin --sbindir=/usr/sbin --libexecdir=/usr/lib/squid --sysconfdir=/etc/squid \
--localstatedir=/var/spool/squid --datadir=/usr/share/squid --enable-async-io=24 --with-aufs-threads=24 --with-pthreads --enable-storeio=aufs \
--enable-linux-netfilter --enable-arp-acl --enable-epoll --enable-removal-policies=heap --with-aio --with-dl --enable-snmp \
--enable-delay-pools --enable-htcp --enable-cache-digests --disable-unlinkd --enable-large-cache-files --with-large-files \
--enable-err-languages=English --enable-default-err-language=English --with-maxfd=65536

ok..!! sekarang dimulai tahap compile nya :

CHOST="x86_64
-pc-linux-gnu" \
CFLAGS="-march=k8 -O2 -pipe" \
./configure --prefix=/usr --exec_prefix=/usr --bindir=/usr/sbin --sbindir=/usr/sbin --libexecdir=/usr/lib/squid --sysconfdir=/etc/squid \
--localstatedir=/var/spool/squid --datadir=/usr/share/squid --enable-http-gzip --enable-async-io=24 --with-aufs-threads=24 --with-pthreads --enable-storeio=aufs \
--enable-linux-netfilter --enable-arp-acl --enable-epoll --enable-removal-policies=heap --with-aio --with-dl --enable-snmp \
--enable-delay-pools --enable-htcp --enable-cache-digests --disable-unlinkd --enable-large-cache-files --with-large-files \
--enable-err-languages=Eng
lish --enable-default-err-language=English --with-maxfd=65536




selanjutnya, ketik perintah berikut di terminal ubuntu:

# make
# sudo make install
Quote:
Edit squid.conf

agar perintah sudo /etc/init.d/squid stop jalan di ubuntu 10.10
#copy file squid yg ada di folder tunning ke /etc/init.d/

jgn lupa di :
#sudo chmod +x /etc/init.d/squid

stop dulu squidnya :
#sudo /etc/init.d/squid stop

#paste file squid.conf dan storeur.pl yg di download tadi kedalam folder /etc/squid
4. Langkah selanjutnya

Code:

# Memberikan permission pada folder cache
mkdir /var/log/squid
touch /var/log/squid/access.log
touch /var/log/squid/cache.log
chmod 755 -Rf /cache1/ /cache2/ /cache3/
chmod 755 -Rf /var/log/squid
chown -Rf proxy:proxy /cache1/ /cache2/ /cache3/
chown -Rf proxy:proxy /var/log/squid
chown -Rf proxy:proxy /var/log/squid/access.log
chown -Rf proxy:proxy /var/log/squid/cache.log

chown proxy:proxy /cache1
chown proxy:proxy /cache2
chown proxy:proxy /cache3
chmod 777 /cache1
chmod 777 /cache2
chmod 777 /cache3
chown proxy:proxy /etc/squid/storeurl.pl
chmod 777 /etc/squid/storeurl.pl

# Membuat folder-folder swap/cache di dalam folder cache yang telah ditentukan dengan perintah :

squid -f /etc/squid/squid.conf -z

# Restart squid
sudo /etc/init.d/squid restart

Reboot CPU nya...